Skip to content

Commit 3fff269

Browse files
authored
Merge pull request #4717 from hansva/4712
Revert and change folders for metadata items, #4712
2 parents fe080d9 + 2291fa6 commit 3fff269

File tree

20 files changed

+287
-698
lines changed

20 files changed

+287
-698
lines changed

core/src/main/java/org/apache/hop/metadata/api/HopMetadata.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,4 @@
5151
* @return the type of metadata this property represents.
5252
*/
5353
HopMetadataPropertyType hopMetadataPropertyType() default HopMetadataPropertyType.NONE;
54-
55-
/**
56-
* A boolean flag, represented as a string, which tells whether the given HopMetadata
57-
* implementation has to be shown into a tree of folders
58-
*
59-
* @return a boolean as string flag that will enable the UI to allow folders creation
60-
*/
61-
String subfoldersEnabled() default "false";
6254
}

core/src/main/java/org/apache/hop/metadata/api/HopMetadataBase.java

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222

2323
public class HopMetadataBase implements IHopMetadata {
2424

25-
@HopMetadataProperty protected String path;
26-
2725
/** All metadata objects have a name to uniquely identify it. */
2826
@HopMetadataProperty protected String name;
2927

28+
/** All metadata objects can have a virtual path to organize them */
29+
@HopMetadataProperty protected String virtualPath;
30+
3031
/**
3132
* The metadata provider name is optionally used at runtime to figure out where the metadata came
3233
* from. Optionally used by plugins. It's volatile because it's never persisted.
@@ -38,13 +39,13 @@ public HopMetadataBase() {}
3839
public HopMetadataBase(String name) {
3940
this();
4041
this.name = name;
41-
this.path = "";
42+
this.virtualPath = "";
4243
}
4344

44-
public HopMetadataBase(String name, String path) {
45+
public HopMetadataBase(String name, String virtualPath) {
4546
this();
4647
this.name = name;
47-
this.path = path;
48+
this.virtualPath = virtualPath;
4849
}
4950

5051
@Override
@@ -106,26 +107,40 @@ public void setMetadataProviderName(String metadataProviderName) {
106107
this.metadataProviderName = metadataProviderName;
107108
}
108109

110+
/**
111+
* Get the virtual path set on a metadata item
112+
*
113+
* @return a String representing the virtual path
114+
*/
109115
@Override
110-
public String getPath() {
111-
return path;
116+
public String getVirtualPath() {
117+
return virtualPath;
112118
}
113119

120+
/**
121+
* Set the virtual path on a metadata item
122+
*
123+
* @param virtualPath the virtual path to set to the metadata item
124+
*/
114125
@Override
115-
public void setPath(String path) {
116-
this.path = path;
126+
public void setVirtualPath(String virtualPath) {
127+
this.virtualPath = virtualPath;
117128
}
118129

130+
/**
131+
* Return the virtual path and name of the object
132+
*
133+
* @return the virtual path and name of the object
134+
*/
119135
@Override
120136
public String getFullName() {
121-
if (path == null || path.isBlank()) {
137+
if (virtualPath == null || virtualPath.isEmpty()) {
122138
return name;
139+
}
140+
if (virtualPath.endsWith("/")) {
141+
return virtualPath + name;
123142
} else {
124-
if (path.endsWith("/")) {
125-
return path + name;
126-
} else {
127-
return path + "/" + name;
128-
}
143+
return virtualPath + "/" + name;
129144
}
130145
}
131146
}

core/src/main/java/org/apache/hop/metadata/api/IHopMetadata.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,22 @@ public interface IHopMetadata {
5353
*/
5454
void setMetadataProviderName(String metadataProviderName);
5555

56-
String getPath();
56+
/**
57+
* @return the virtual path for organizing metadata items
58+
*/
59+
String getVirtualPath();
5760

58-
void setPath(String path);
61+
/**
62+
* Set the virtual path on a metadata item
63+
*
64+
* @param virtualPath the virtual path to set to the metadata item
65+
*/
66+
void setVirtualPath(String virtualPath);
5967

68+
/**
69+
* Get the complete name of the object (virtual path + name)
70+
*
71+
* @return the full name of the object
72+
*/
6073
String getFullName();
6174
}

core/src/main/java/org/apache/hop/metadata/api/IHopMetadataSerializer.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.util.List;
2121
import org.apache.hop.core.exception.HopException;
22-
import org.apache.hop.metadata.serializer.FileSystemNode;
2322

2423
/**
2524
* This metadata interface describes how an object T can be serialized and analyzed.
@@ -68,11 +67,6 @@ public interface IHopMetadataSerializer<T extends IHopMetadata> {
6867
*/
6968
List<String> listObjectNames() throws HopException;
7069

71-
default FileSystemNode getFileSystemTree() throws HopException {
72-
throw new UnsupportedOperationException(
73-
"listObjectNames(String folderName, Boolean recursive) is not supported by this metadata serializer");
74-
}
75-
7670
/**
7771
* See if an object with the given name exists.
7872
*

core/src/main/java/org/apache/hop/metadata/serializer/FileSystemNode.java

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)