-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4529 from xdelox/4308-static-schema-subfolders
Segregate the schema definitions under relevant sub folders
- Loading branch information
Showing
19 changed files
with
722 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
core/src/main/java/org/apache/hop/metadata/serializer/FileSystemNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hop.metadata.serializer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
// Represents a node in the file system tree | ||
public class FileSystemNode { | ||
private String name; // Name of the file or folder | ||
private String path; // Absolute path to the file or folder | ||
private Type type; // Type (file or folder) | ||
private FileSystemNode parent; // Parent node | ||
private List<FileSystemNode> children; // Children nodes (only for folder) | ||
|
||
// Enum for node type | ||
public enum Type { | ||
FILE, | ||
FOLDER | ||
} | ||
|
||
// Constructor | ||
|
||
public FileSystemNode(String name, String path, Type type, FileSystemNode parent) { | ||
this.name = name; | ||
this.path = path; | ||
this.type = type; | ||
this.parent = parent; | ||
this.children = new ArrayList<>(); | ||
|
||
if (this.parent != null) { | ||
this.parent.addChild(this); | ||
} | ||
} | ||
|
||
// Add a child node | ||
|
||
public void addChild(FileSystemNode child) { | ||
if (this.type == Type.FOLDER) { | ||
this.children.add(child); | ||
} | ||
} | ||
|
||
// Getters | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public Type getType() { | ||
return type; | ||
} | ||
|
||
public FileSystemNode getParent() { | ||
return parent; | ||
} | ||
|
||
public List<FileSystemNode> getChildren() { | ||
return children; | ||
} | ||
|
||
public boolean isFolder() { | ||
return type == Type.FOLDER; | ||
} | ||
|
||
public boolean isFile() { | ||
return type == Type.FILE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.