diff --git a/src/main/java/zeenea/connector/dataproduct/DataProduct.java b/src/main/java/zeenea/connector/dataproduct/DataProduct.java index 4e18f97..a521c25 100644 --- a/src/main/java/zeenea/connector/dataproduct/DataProduct.java +++ b/src/main/java/zeenea/connector/dataproduct/DataProduct.java @@ -2,6 +2,7 @@ import java.util.*; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import zeenea.connector.Item; import zeenea.connector.dataset.Dataset; import zeenea.connector.exception.ExceptionUtils; @@ -10,6 +11,12 @@ /** Represents a data product which is a specialized type of Item. */ public final class DataProduct extends Item { + /** Enum representing the type of the data product. */ + public enum Type { + Custom, + DataProductSpecificationDotCom + } + /** The list of input ports for the data product. */ @NotNull private final List inputPorts; @@ -19,6 +26,13 @@ public final class DataProduct extends Item { /** The list of internal components for the data product. */ @NotNull private final List internalComponents; + /** The type of the data product. */ + @NotNull private final Type type; + + /** The source of the data product. */ + @Nullable + private final String source; + /** * Constructs a DataProduct instance using the provided builder. * @@ -32,6 +46,8 @@ private DataProduct(Builder builder) { inputPorts = List.copyOf(builder.inputPorts); outputPorts = List.copyOf(builder.outputPorts); internalComponents = List.copyOf(builder.internalComponents); + type = Optional.ofNullable(builder.type).orElse(Type.Custom); + source = builder.source; } /** @@ -61,6 +77,24 @@ private DataProduct(Builder builder) { return internalComponents; } + /** + * Gets the type of the data product. + * + * @return the type of the data product + */ + public @NotNull Type getType() { + return type; + } + + /** + * Gets the source of the data product. + * + * @return the source of the data product + */ + public @Nullable String getSource() { + return source; + } + /** * Checks if this DataProduct is equal to another object. * @@ -74,7 +108,9 @@ public boolean equals(Object o) { DataProduct that = (DataProduct) o; return Objects.equals(inputPorts, that.inputPorts) && Objects.equals(outputPorts, that.outputPorts) - && Objects.equals(internalComponents, that.internalComponents); + && Objects.equals(internalComponents, that.internalComponents) + && Objects.equals(type, that.type) + && Objects.equals(source, that.source); } /** @@ -84,7 +120,7 @@ public boolean equals(Object o) { */ @Override public int hashCode() { - return Objects.hash(inputPorts, outputPorts, internalComponents); + return Objects.hash(inputPorts, outputPorts, internalComponents, type, source); } /** @@ -111,6 +147,10 @@ public String toString() { + internalComponents + ", outputPorts=" + outputPorts + + ", type=" + + type + + ", source=" + + source + "}"; } @@ -151,6 +191,10 @@ public static class Builder extends Item.Builder { private List internalComponents = Collections.emptyList(); + private Type type; + + private String source; + /** * Set a collection of input ports to the data product. * @@ -217,6 +261,28 @@ public Builder internalComponents(Item... items) { return this; } + /** + * Sets the type of the data product. + * + * @param type the type of the data product + * @return the builder instance + */ + public Builder type(@NotNull Type type) { + this.type = type; + return this; + } + + /** + * Sets the source of the data product. + * + * @param source the source of the data product + * @return the builder instance + */ + public Builder source(@Nullable String source) { + this.source = source; + return this; + } + /** * Builds and returns a DataProduct instance. * diff --git a/version.txt b/version.txt index 7ec1d6d..ccbccc3 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.1.0 +2.2.0