Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert and change folders for metadata items, #4712 #4717

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,4 @@
* @return the type of metadata this property represents.
*/
HopMetadataPropertyType hopMetadataPropertyType() default HopMetadataPropertyType.NONE;

/**
* A boolean flag, represented as a string, which tells whether the given HopMetadata
* implementation has to be shown into a tree of folders
*
* @return a boolean as string flag that will enable the UI to allow folders creation
*/
String subfoldersEnabled() default "false";
}
45 changes: 30 additions & 15 deletions core/src/main/java/org/apache/hop/metadata/api/HopMetadataBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@

public class HopMetadataBase implements IHopMetadata {

@HopMetadataProperty protected String path;

/** All metadata objects have a name to uniquely identify it. */
@HopMetadataProperty protected String name;

/** All metadata objects can have a virtual path to organize them */
@HopMetadataProperty protected String virtualPath;

/**
* The metadata provider name is optionally used at runtime to figure out where the metadata came
* from. Optionally used by plugins. It's volatile because it's never persisted.
Expand All @@ -38,13 +39,13 @@ public HopMetadataBase() {}
public HopMetadataBase(String name) {
this();
this.name = name;
this.path = "";
this.virtualPath = "";
}

public HopMetadataBase(String name, String path) {
public HopMetadataBase(String name, String virtualPath) {
this();
this.name = name;
this.path = path;
this.virtualPath = virtualPath;
}

@Override
Expand Down Expand Up @@ -106,26 +107,40 @@ public void setMetadataProviderName(String metadataProviderName) {
this.metadataProviderName = metadataProviderName;
}

/**
* Get the virtual path set on a metadata item
*
* @return a String representing the virtual path
*/
@Override
public String getPath() {
return path;
public String getVirtualPath() {
return virtualPath;
}

/**
* Set the virtual path on a metadata item
*
* @param virtualPath the virtual path to set to the metadata item
*/
@Override
public void setPath(String path) {
this.path = path;
public void setVirtualPath(String virtualPath) {
this.virtualPath = virtualPath;
}

/**
* Return the virtual path and name of the object
*
* @return the virtual path and name of the object
*/
@Override
public String getFullName() {
if (path == null || path.isBlank()) {
if (virtualPath == null || virtualPath.isEmpty()) {
return name;
}
if (virtualPath.endsWith("/")) {
return virtualPath + name;
} else {
if (path.endsWith("/")) {
return path + name;
} else {
return path + "/" + name;
}
return virtualPath + "/" + name;
}
}
}
17 changes: 15 additions & 2 deletions core/src/main/java/org/apache/hop/metadata/api/IHopMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,22 @@ public interface IHopMetadata {
*/
void setMetadataProviderName(String metadataProviderName);

String getPath();
/**
* @return the virtual path for organizing metadata items
*/
String getVirtualPath();

void setPath(String path);
/**
* Set the virtual path on a metadata item
*
* @param virtualPath the virtual path to set to the metadata item
*/
void setVirtualPath(String virtualPath);

/**
* Get the complete name of the object (virtual path + name)
*
* @return the full name of the object
*/
String getFullName();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.List;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.metadata.serializer.FileSystemNode;

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

default FileSystemNode getFileSystemTree() throws HopException {
throw new UnsupportedOperationException(
"listObjectNames(String folderName, Boolean recursive) is not supported by this metadata serializer");
}

/**
* See if an object with the given name exists.
*
Expand Down

This file was deleted.

Loading
Loading