diff --git a/application.properties b/application.properties index e616bbf2d27..a4767c702e9 100644 --- a/application.properties +++ b/application.properties @@ -26,7 +26,7 @@ server.ssl.trust-store-password=egeria # WARNING! setting 'strict.ssl=false' allows java clients to open https connections without checking the validity of # certificates from the servers it is calling. -# Alternate you can import self signed certificates into java truststore or setup an truststore only for this app +# Alternate you can import self-signed certificates into java truststore or set up a truststore only for this app # by adding the store into server.ssl.trust-store parameter strict.ssl=true # Comma separated values of http headers to be added to ThreadLocal @@ -73,4 +73,3 @@ springdoc.swagger-ui.docExpansion=none # Endpoints web configuration #management.endpoints.web.exposure.include=* management.health.cassandra.enabled=false - diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/DataAssetExchangeInterface.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/DataAssetExchangeInterface.java index 9196035c111..e4e69f5cc93 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/DataAssetExchangeInterface.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/DataAssetExchangeInterface.java @@ -413,7 +413,7 @@ void clearAssetRelationship(String userId, * @param assetManagerName unique name of software capability representing the caller * @param relationshipTypeName type name of relationship to delete * @param fromAssetGUID unique identifier of the asset at end 1 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param forLineage return elements marked with the Memento classification? @@ -430,7 +430,7 @@ List getRelatedAssetsAtEnd2(String userId, String assetManagerName, String relationshipTypeName, String fromAssetGUID, - int startingFrom, + int startFrom, int pageSize, Date effectiveTime, boolean forLineage, @@ -447,7 +447,7 @@ List getRelatedAssetsAtEnd2(String userId, * @param assetManagerName unique name of software capability representing the caller * @param relationshipTypeName type name of relationship to delete * @param toAssetGUID unique identifier of the asset at end 2 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param forLineage return elements marked with the Memento classification? @@ -464,7 +464,7 @@ List getRelatedAssetsAtEnd1(String userId, String assetManagerName, String relationshipTypeName, String toAssetGUID, - int startingFrom, + int startFrom, int pageSize, Date effectiveTime, boolean forLineage, diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/SchemaExchangeInterface.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/SchemaExchangeInterface.java index 9cf1c5e9fcc..7322b4a0358 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/SchemaExchangeInterface.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/api/exchange/SchemaExchangeInterface.java @@ -54,6 +54,38 @@ String createSchemaType(String userId, PropertyServerException; + /** + * Create a new metadata element to represent a schema type. + * + * @param userId calling user + * @param assetManagerGUID unique identifier of software capability representing the caller + * @param assetManagerName unique name of software capability representing the caller + * @param assetManagerIsHome ensure that only the asset manager can update this schema element + * @param anchorGUID unique identifier of the intended anchor of the schema type + * @param externalIdentifierProperties optional properties used to define an external identifier + * @param schemaTypeProperties properties about the schema type to store + * @param forLineage return elements marked with the Memento classification? + * @param forDuplicateProcessing do not merge elements marked as duplicates? + * + * @return unique identifier of the new schema type + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + String createAnchoredSchemaType(String userId, + String assetManagerGUID, + String assetManagerName, + boolean assetManagerIsHome, + String anchorGUID, + ExternalIdentifierProperties externalIdentifierProperties, + boolean forLineage, + boolean forDuplicateProcessing, + SchemaTypeProperties schemaTypeProperties) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException; + + /** * Create a new metadata element to represent a schema type using an existing metadata element as a template. * diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/metadataelements/SchemaTypeElement.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/metadataelements/SchemaTypeElement.java index 6b5d7528035..9acca3fc276 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/metadataelements/SchemaTypeElement.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/metadataelements/SchemaTypeElement.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import org.odpi.openmetadata.accessservices.assetmanager.properties.DerivedSchemaTypeQueryTargetProperties; import org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties; import java.io.Serializable; @@ -17,18 +18,44 @@ import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementHeader; /** - * SchemaTypeElement contains the properties and header for a reference data asset retrieved from the metadata repository. + * SchemaTypeElement contains the properties and header for a schema type retrieved from the metadata repository. */ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) -public class SchemaTypeElement implements MetadataElement, Serializable +public class SchemaTypeElement implements MetadataElement { - private static final long serialVersionUID = 1L; - - private SchemaTypeProperties schemaTypeProperties = null; - private List correlationHeaders = null; private ElementHeader elementHeader = null; + private List correlationHeaders = null; + private SchemaTypeProperties schemaTypeProperties = null; + + /* + * For complex schema types such as StructSchemaType + */ + private int attributeCount = 0; + + /* + * For Map Schema Types + */ + private SchemaTypeElement mapFromElement = null; + private SchemaTypeElement mapToElement = null; + + /* + * For External Schema Types + */ + private SchemaTypeElement externalSchemaType = null; + + /* + * Schema options for SchemaTypeChoice + */ + private List schemaOptions = null; + + /* + * Used when a value, or set of values associated with the schema are derived rather than stored. + */ + private String formula = null; + private String formulaType = null; + private List queries = null; /** @@ -52,6 +79,19 @@ public SchemaTypeElement(SchemaTypeElement template) elementHeader = template.getElementHeader(); correlationHeaders = template.getCorrelationHeaders(); schemaTypeProperties = template.getSchemaTypeProperties(); + + attributeCount = template.getAttributeCount(); + + mapFromElement = template.getMapFromElement(); + mapToElement = template.getMapToElement(); + + externalSchemaType = template.getExternalSchemaType(); + + schemaOptions = template.getSchemaOptions(); + + formula = template.getFormula(); + formulaType = template.getFormulaType(); + queries = template.getQueries(); } } @@ -139,6 +179,194 @@ public void setSchemaTypeProperties(SchemaTypeProperties schemaTypeProperties) } + + + /** + * Return the count of attributes in this schema type. + * + * @return String data type name + */ + public int getAttributeCount() { return attributeCount; } + + + /** + * Set up the count of attributes in this schema type + * + * @param attributeCount data type name + */ + public void setAttributeCount(int attributeCount) + { + this.attributeCount = attributeCount; + } + + + + /** + * Return the type of schema element that represents the key or property name for the map. + * This is also called the domain of the map. + * + * @return SchemaElement + */ + public SchemaTypeElement getMapFromElement() + { + return mapFromElement; + } + + + /** + * Set up the type of schema element that represents the key or property name for the map. + * This is also called the domain of the map. + * + * @param mapFromElement SchemaElement + */ + public void setMapFromElement(SchemaTypeElement mapFromElement) + { + this.mapFromElement = mapFromElement; + } + + + /** + * Return the type of schema element that represents the property value for the map. + * This is also called the range of the map. + * + * @return SchemaElement + */ + public SchemaTypeElement getMapToElement() + { + return mapToElement; + } + + + /** + * Set up the type of schema element that represents the property value for the map. + * This is also called the range of the map. + * + * @param mapToElement SchemaType + */ + public void setMapToElement(SchemaTypeElement mapToElement) + { + this.mapToElement = mapToElement; + } + + + /** + * Return the schema type that is reusable amongst assets. + * + * @return bean describing external schema + */ + public SchemaTypeElement getExternalSchemaType() + { + return externalSchemaType; + } + + + /** + * Set up the schema type that is reusable amongst assets. + * + * @param externalSchemaType bean describing external schema + */ + public void setExternalSchemaType(SchemaTypeElement externalSchemaType) + { + this.externalSchemaType = externalSchemaType; + } + + + /** + * Return the list of alternative schema types that this attribute or asset may use. + * + * @return list of schema types + */ + public List getSchemaOptions() + { + if (schemaOptions == null) + { + return null; + } + else if (schemaOptions.isEmpty()) + { + return null; + } + + return schemaOptions; + } + + + /** + * Set up the list of alternative schema types that this attribute or asset may use. + * + * @param schemaOptions list of schema types + */ + public void setSchemaOptions(List schemaOptions) + { + this.schemaOptions = schemaOptions; + } + + + /** + * Return the formula used to combine the values of the queries. Each query is has a identifier and the + * formula has placeholders for these identifiers in it to show how the query results are combined. + * + * @return String formula + */ + public String getFormula() { return formula; } + + + /** + * Set up the formula used to combine the values of the queries. Each query is has a identifier and the + * formula has placeholders for these identifiers in it to show how the query results are combined. + * + * @param formula String formula + */ + public void setFormula(String formula) + { + this.formula = formula; + } + + + /** + * Return the specification language for the formula. + * + * @return string description + */ + public String getFormulaType() + { + return formulaType; + } + + + /** + * Set up the specification language for the formula. + * + * @param formulaType string description + */ + public void setFormulaType(String formulaType) + { + this.formulaType = formulaType; + } + + + /** + * Return the list of individual query targets for a derived column. + * + * @return list of queries and their target element + */ + public List getQueries() + { + return queries; + } + + + /** + * Set up the list of individual query targets for a derived column. + * + * @param queries list of queries and their target element + */ + public void setQueries(List queries) + { + this.queries = queries; + } + + /** * JSON-style toString * @@ -148,9 +376,17 @@ public void setSchemaTypeProperties(SchemaTypeProperties schemaTypeProperties) public String toString() { return "SchemaTypeElement{" + - "schemaTypeProperties=" + schemaTypeProperties + + "elementHeader=" + elementHeader + ", correlationHeaders=" + correlationHeaders + - ", elementHeader=" + elementHeader + + ", schemaTypeProperties=" + schemaTypeProperties + + ", attributeCount=" + attributeCount + + ", mapFromElement=" + mapFromElement + + ", mapToElement=" + mapToElement + + ", externalSchemaType=" + externalSchemaType + + ", schemaOptions=" + schemaOptions + + ", formula='" + formula + '\'' + + ", formulaType='" + formulaType + '\'' + + ", queries=" + queries + '}'; } @@ -168,14 +404,21 @@ public boolean equals(Object objectToCompare) { return true; } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) + if (! (objectToCompare instanceof SchemaTypeElement that)) { return false; } - SchemaTypeElement that = (SchemaTypeElement) objectToCompare; - return Objects.equals(getSchemaTypeProperties(), that.getSchemaTypeProperties()) && - Objects.equals(getCorrelationHeaders(), that.getCorrelationHeaders()) && - Objects.equals(getElementHeader(), that.getElementHeader()); + return attributeCount == that.attributeCount && + Objects.equals(elementHeader, that.elementHeader) + && Objects.equals(correlationHeaders, that.correlationHeaders) && + Objects.equals(schemaTypeProperties, that.schemaTypeProperties) && + Objects.equals(mapFromElement, that.mapFromElement) && + Objects.equals(mapToElement, that.mapToElement) && + Objects.equals(externalSchemaType, that.externalSchemaType) && + Objects.equals(schemaOptions, that.schemaOptions) && + Objects.equals(formula, that.formula) && + Objects.equals(formulaType, that.formulaType) && + Objects.equals(queries, that.queries); } @@ -187,6 +430,7 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(super.hashCode(), elementHeader, correlationHeaders, schemaTypeProperties); + return Objects.hash(elementHeader, correlationHeaders, schemaTypeProperties, attributeCount, mapFromElement, mapToElement, externalSchemaType, + schemaOptions, formula, formulaType, queries); } } diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/ComplexSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/ComplexSchemaTypeProperties.java deleted file mode 100644 index f0a12369d98..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/ComplexSchemaTypeProperties.java +++ /dev/null @@ -1,137 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetmanager.properties; - - -import com.fasterxml.jackson.annotation.*; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * ComplexSchemaTypeProperties describes a schema with multiple attributes. Notice it does not contain the attributes, - * just a count of them. This is because a complex schema type may have literally thousands of attributes - * and so the attribute contents are retrieved separated through calls that support paging. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class ComplexSchemaTypeProperties extends SchemaTypeProperties -{ - private int attributeCount = 0; - - - /** - * Default constructor used by subclasses - */ - public ComplexSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public ComplexSchemaTypeProperties(ComplexSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - attributeCount = template.getAttributeCount(); - } - } - - - /** - * Return the count of attributes in this schema type. - * - * @return String data type name - */ - public int getAttributeCount() { return attributeCount; } - - - /** - * Set up the count of attributes in this schema type - * - * @param attributeCount data type name - */ - public void setAttributeCount(int attributeCount) - { - this.attributeCount = attributeCount; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "ComplexSchemaTypeProperties{" + - "attributeCount=" + attributeCount + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", effectiveFrom=" + getEffectiveFrom() + - ", effectiveTo=" + getEffectiveTo() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - ComplexSchemaTypeProperties that = (ComplexSchemaTypeProperties) objectToCompare; - return attributeCount == that.attributeCount; - } - - - /** - * Create a hash code for this element type. - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), attributeCount); - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/DerivedSchemaTypeQueryTargetProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/DerivedSchemaTypeQueryTargetProperties.java new file mode 100644 index 00000000000..98f795cf774 --- /dev/null +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/DerivedSchemaTypeQueryTargetProperties.java @@ -0,0 +1,194 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.accessservices.assetmanager.properties; + + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.Objects; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * DerivedSchemaTypeQueryTargetProperties defines a query on a schema element that returns all or part of the value for a + * derived schema type. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class DerivedSchemaTypeQueryTargetProperties +{ + private String queryId = null; + private String query = null; + private String queryType = null; + private String queryTargetGUID = null; + + + + /** + * Default constructor + */ + public DerivedSchemaTypeQueryTargetProperties() + { + super(); + } + + + /** + * Copy/clone constructor. + * + * @param template template schema query to copy. + */ + public DerivedSchemaTypeQueryTargetProperties(DerivedSchemaTypeQueryTargetProperties template) + { + super(); + + if (template != null) + { + queryId = template.getQueryId(); + query = template.getQuery(); + queryType = template.getQueryType(); + queryTargetGUID = template.getQueryTargetGUID(); + } + } + + + /** + * Return the query id - this is used to identify where the results of this query should be plugged into + * the other queries or the formula for the parent derived schema element. + * + * @return String query identifier + */ + public String getQueryId() { return queryId; } + + + /** + * Set up the query id - this is used to identify where the results of this query should be plugged into + * the other queries or the formula for the parent derived schema element. + * + * @param queryId String query identifier + */ + public void setQueryId(String queryId) + { + this.queryId = queryId; + } + + + /** + * Return the query string for this element. The query string may have placeholders for values returned + * by queries that have a lower queryId than this element. + * + * @return String query + */ + public String getQuery() { return query; } + + + /** + * Set up the query string for this element. The query string may have placeholders for values returned + * by queries that have a lower queryId than this element. + * + * @param query String query + */ + public void setQuery(String query) + { + this.query = query; + } + + + /** + * Return the name of the query language used in the query. + * + * @return queryType String + */ + public String getQueryType() { return queryType; } + + + /** + * Set up the name of the query language used in the query. + * + * @param queryType String name + */ + public void setQueryType(String queryType) + { + this.queryType = queryType; + } + + + /** + * Return the unique identifier that describes the data source that will be queried to get part of the derived value. + * + * @return string guid + */ + public String getQueryTargetGUID() + { + return queryTargetGUID; + } + + + /** + * Set up the unique identifier that describes the data source that will be queried to get part of the derived value. + * + * @param queryTargetGUID string guid + */ + public void setQueryTargetGUID(String queryTargetGUID) + { + this.queryTargetGUID = queryTargetGUID; + } + + + /** + * Standard toString method. + * + * @return print out of variables in a JSON-style + */ + @Override + public String toString() + { + return "DerivedSchemaTypeQueryTargetProperties{" + + "queryId=" + queryId + + ", query='" + query + '\'' + + ", queryType='" + queryType + '\'' + + ", queryTargetGUID=" + queryTargetGUID + + '}'; + } + + + /** + * Compare the values of the supplied object with those stored in the current object. + * + * @param objectToCompare supplied object + * @return boolean result of comparison + */ + @Override + public boolean equals(Object objectToCompare) + { + if (this == objectToCompare) + { + return true; + } + if (!(objectToCompare instanceof DerivedSchemaTypeQueryTargetProperties)) + { + return false; + } + DerivedSchemaTypeQueryTargetProperties that = (DerivedSchemaTypeQueryTargetProperties) objectToCompare; + return Objects.equals(getQueryId(), that.getQueryId()) && + Objects.equals(getQuery(), that.getQuery()) && + Objects.equals(getQueryType(), that.getQueryType()) && + Objects.equals(getQueryTargetGUID(), that.getQueryTargetGUID()); + } + + + /** + * Create a hash code for this element type. + * + * @return int hash code + */ + @Override + public int hashCode() + { + return Objects.hash(getQueryId(), getQuery(), getQueryType(), getQueryTargetGUID()); + } +} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/EnumSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/EnumSchemaTypeProperties.java deleted file mode 100644 index 0fc5b6e7bac..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/EnumSchemaTypeProperties.java +++ /dev/null @@ -1,136 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetmanager.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * EnumSchemaTypeProperties carries the specialized parameters for creating or updating enum schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class EnumSchemaTypeProperties extends SimpleSchemaTypeProperties -{ - private String validValueSetGUID = null; - - /** - * Default constructor - */ - public EnumSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - * - * @param template template object to copy. - */ - public EnumSchemaTypeProperties(EnumSchemaTypeProperties template) - { - super(template); - } - - - /** - * Return the unique identifier of the valid value set that describes the enum values for this schema element. - * - * @return string guid - */ - public String getValidValueSetGUID() - { - return validValueSetGUID; - } - - - /** - * Set up the unique identifier of the value set that describes the enum values for this schema element. - * - * @param validValueSetGUID string guid - */ - public void setValidValueSetGUID(String validValueSetGUID) - { - this.validValueSetGUID = validValueSetGUID; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "EnumSchemaTypeProperties{" + - "validValueSetGUID='" + validValueSetGUID + '\'' + - ", dataType='" + getDataType() + '\'' + - ", defaultValue='" + getDefaultValue() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", effectiveFrom=" + getEffectiveFrom() + - ", effectiveTo=" + getEffectiveTo() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - EnumSchemaTypeProperties that = (EnumSchemaTypeProperties) objectToCompare; - return Objects.equals(validValueSetGUID, that.validValueSetGUID); - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), validValueSetGUID); - } -} diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/ExternalSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/ExternalSchemaTypeProperties.java deleted file mode 100644 index 2a00b24f58e..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/ExternalSchemaTypeProperties.java +++ /dev/null @@ -1,165 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetmanager.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * ExternalSchemaTypeProperties carries the unique identifier and properties of a reusable schema type. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class ExternalSchemaTypeProperties extends SimpleSchemaTypeProperties -{ - private String externalSchemaTypeGUID = null; - private SchemaTypeProperties externalSchemaType = null; - - /** - * Default constructor - */ - public ExternalSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - * - * @param template template object to copy. - */ - public ExternalSchemaTypeProperties(ExternalSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - externalSchemaTypeGUID = template.getExternalSchemaTypeGUID(); - externalSchemaType = template.getExternalSchemaType(); - } - } - - - /** - * Return the unique identifier of the external schema type. - * - * @return string guid - */ - public String getExternalSchemaTypeGUID() - { - return externalSchemaTypeGUID; - } - - - /** - * Set up the unique identifier of the external schema type. - * - * @param externalSchemaTypeGUID string guid - */ - public void setExternalSchemaTypeGUID(String externalSchemaTypeGUID) - { - this.externalSchemaTypeGUID = externalSchemaTypeGUID; - } - - - /** - * Return the schema type that is reusable amongst assets. - * - * @return bean describing external schema - */ - public SchemaTypeProperties getExternalSchemaType() - { - return externalSchemaType; - } - - - /** - * Set up the schema type that is reusable amongst assets. - * - * @param externalSchemaType bean describing external schema - */ - public void setExternalSchemaType(SchemaTypeProperties externalSchemaType) - { - this.externalSchemaType = externalSchemaType; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "ExternalSchemaTypeProperties{" + - "externalSchemaTypeGUID=" + externalSchemaTypeGUID + - ", externalSchemaType=" + externalSchemaType + - ", dataType='" + getDataType() + '\'' + - ", defaultValue='" + getDefaultValue() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties()+ - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - ExternalSchemaTypeProperties that = (ExternalSchemaTypeProperties) objectToCompare; - return Objects.equals(externalSchemaTypeGUID, that.externalSchemaTypeGUID) && - Objects.equals(externalSchemaType, that.externalSchemaType); - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), externalSchemaTypeGUID, externalSchemaType); - } -} diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/LiteralSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/LiteralSchemaTypeProperties.java deleted file mode 100644 index ed4961dc23d..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/LiteralSchemaTypeProperties.java +++ /dev/null @@ -1,158 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetmanager.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * LiteralSchemaTypeProperties carries the specialized parameters for creating or updating literal schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class LiteralSchemaTypeProperties extends SchemaTypeProperties -{ - private String dataType = null; - private String fixedValue = null; - - /** - * Default constructor - */ - public LiteralSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also - * likely to be being cloned in the same operation, and we want the definitions clone to point to the - * asset clone and not the original asset. - * - * @param template template object to copy. - */ - public LiteralSchemaTypeProperties(LiteralSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - dataType = template.getDataType(); - fixedValue = template.getFixedValue(); - } - } - - - /** - * Return the data type for this element. Null means unknown data type. - * - * @return String data type name - */ - public String getDataType() { return dataType; } - - - /** - * Set up the data type for this element. Null means unknown data type. - * - * @param dataType data type name - */ - public void setDataType(String dataType) - { - this.dataType = dataType; - } - - - /** - * Return the fixed value for the element. Null means fixed value is null. - * - * @return String containing fixed value - */ - public String getFixedValue() { return fixedValue; } - - - /** - * Set up the fixed value for the element. Null means fixed value is null. - * - * @param fixedValue String containing fixed value - */ - public void setFixedValue(String fixedValue) - { - this.fixedValue = fixedValue; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "LiteralSchemaTypeProperties{" + - "dataType='" + dataType + '\'' + - ", fixedValue='" + fixedValue + '\'' + - ", dataType='" + getDataType() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - LiteralSchemaTypeProperties that = (LiteralSchemaTypeProperties) objectToCompare; - return Objects.equals(dataType, that.dataType) && - Objects.equals(fixedValue, that.fixedValue); - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), dataType, getFixedValue()); - } -} diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/MapSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/MapSchemaTypeProperties.java deleted file mode 100644 index 64e69f3d686..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/MapSchemaTypeProperties.java +++ /dev/null @@ -1,169 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetmanager.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * MapSchemaType describes a schema element of type map. It stores the type of schema element for the domain - * (eg property name) for the map and the schema element for the range (eg property value) for the map. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class MapSchemaTypeProperties extends SchemaTypeProperties -{ - private SchemaTypeProperties mapFromElement = null; - private SchemaTypeProperties mapToElement = null; - - - /** - * Default constructor - */ - public MapSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public MapSchemaTypeProperties(MapSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - mapFromElement = template.getMapFromElement(); - mapToElement = template.getMapToElement(); - } - } - - - /** - * Return the type of schema element that represents the key or property name for the map. - * This is also called the domain of the map. - * - * @return SchemaElement - */ - public SchemaTypeProperties getMapFromElement() - { - return mapFromElement; - } - - - /** - * Set up the type of schema element that represents the key or property name for the map. - * This is also called the domain of the map. - * - * @param mapFromElement SchemaElement - */ - public void setMapFromElement(SchemaTypeProperties mapFromElement) - { - this.mapFromElement = mapFromElement; - } - - - /** - * Return the type of schema element that represents the property value for the map. - * This is also called the range of the map. - * - * @return SchemaElement - */ - public SchemaTypeProperties getMapToElement() - { - return mapToElement; - } - - - /** - * Set up the type of schema element that represents the property value for the map. - * This is also called the range of the map. - * - * @param mapToElement SchemaType - */ - public void setMapToElement(SchemaTypeProperties mapToElement) - { - this.mapToElement = mapToElement; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "MapSchemaTypeProperties{" + - "mapFromElement=" + mapFromElement + - ", mapToElement=" + mapToElement + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (!(objectToCompare instanceof MapSchemaTypeProperties)) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - MapSchemaTypeProperties that = (MapSchemaTypeProperties) objectToCompare; - return Objects.equals(getMapFromElement(), that.getMapFromElement()) && - Objects.equals(getMapToElement(), that.getMapToElement()); - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), mapFromElement, mapToElement); - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/PrimitiveSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/PrimitiveSchemaTypeProperties.java deleted file mode 100644 index 1c3f94e0c11..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/PrimitiveSchemaTypeProperties.java +++ /dev/null @@ -1,68 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.assetmanager.properties; - -import com.fasterxml.jackson.annotation.*; - - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * PrimitiveSchemaTypeProperties is a class for representing a primitive value. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class PrimitiveSchemaTypeProperties extends SimpleSchemaTypeProperties -{ - /** - * Default constructor - */ - public PrimitiveSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone constructor. - * - * @param template object to copy - */ - public PrimitiveSchemaTypeProperties(PrimitiveSchemaTypeProperties template) - { - super(template); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "PrimitiveSchemaTypeProperties{" + - "dataType='" + getDataType() + '\'' + - ", defaultValue='" + getDefaultValue() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SchemaTypeChoiceProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SchemaTypeChoiceProperties.java deleted file mode 100644 index 65c98be4d3b..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SchemaTypeChoiceProperties.java +++ /dev/null @@ -1,149 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetmanager.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.List; -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * SchemaTypeChoiceProperties carries the specialized parameters for creating or updating a choice of schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class SchemaTypeChoiceProperties extends SchemaTypeProperties -{ - private List schemaOptions = null; - - - /** - * Default constructor - */ - public SchemaTypeChoiceProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also - * likely to be being cloned in the same operation, and we want the definitions clone to point to the - * asset clone and not the original asset. - * - * @param template template object to copy. - */ - public SchemaTypeChoiceProperties(SchemaTypeChoiceProperties template) - { - super(template); - - if (template != null) - { - schemaOptions = template.getSchemaOptions(); - } - } - - - /** - * Return the list of alternative schema types that this attribute or asset may use. - * - * @return list of schema types - */ - public List getSchemaOptions() - { - if (schemaOptions == null) - { - return null; - } - else if (schemaOptions.isEmpty()) - { - return null; - } - - return schemaOptions; - } - - - /** - * Set up the list of alternative schema types that this attribute or asset may use. - * - * @param schemaOptions list of schema types - */ - public void setSchemaOptions(List schemaOptions) - { - this.schemaOptions = schemaOptions; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - SchemaTypeChoiceProperties that = (SchemaTypeChoiceProperties) objectToCompare; - return Objects.equals(getSchemaOptions(), that.getSchemaOptions()); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaTypeChoiceProperties{" + - "schemaOptions=" + schemaOptions + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), schemaOptions); - } -} diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SchemaTypeProperties.java index 9fb6f1049ec..d17a07f295a 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SchemaTypeProperties.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SchemaTypeProperties.java @@ -17,17 +17,6 @@ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "class") -@JsonSubTypes({ - @JsonSubTypes.Type(value = ComplexSchemaTypeProperties.class, name = "ComplexSchemaTypeProperties"), - @JsonSubTypes.Type(value = LiteralSchemaTypeProperties.class, name = "LiteralSchemaTypeProperties"), - @JsonSubTypes.Type(value = SimpleSchemaTypeProperties.class, name = "SimpleSchemaTypeProperties"), - @JsonSubTypes.Type(value = SchemaTypeChoiceProperties.class, name = "SchemaTypeChoiceProperties"), - @JsonSubTypes.Type(value = MapSchemaTypeProperties.class, name = "MapSchemaTypeProperties"), - }) public class SchemaTypeProperties extends SchemaProperties { private String versionNumber = null; diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SimpleSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SimpleSchemaTypeProperties.java deleted file mode 100644 index 3062730c547..00000000000 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-api/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/properties/SimpleSchemaTypeProperties.java +++ /dev/null @@ -1,167 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.assetmanager.properties; - -import com.fasterxml.jackson.annotation.*; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SimpleSchemaType; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * SimpleSchemaTypeProperties describes the properties of type that has a single value. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "class") -@JsonSubTypes( - { - @JsonSubTypes.Type(value = PrimitiveSchemaTypeProperties.class, name = "PrimitiveSchemaTypeProperties"), - @JsonSubTypes.Type(value = EnumSchemaTypeProperties.class, name = "EnumSchemaTypeProperties"), - @JsonSubTypes.Type(value = ExternalSchemaTypeProperties.class, name = "ExternalSchemaTypeProperties"), - }) -public class SimpleSchemaTypeProperties extends SchemaTypeProperties -{ - private String dataType = null; - private String defaultValue = null; - - - /** - * Default constructor used by subclasses - */ - public SimpleSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public SimpleSchemaTypeProperties(SimpleSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - dataType = template.getDataType(); - defaultValue = template.getDefaultValue(); - } - } - - - /** - * Return the data type for this element. Null means unknown data type. - * - * @return String data type name - */ - public String getDataType() { return dataType; } - - - /** - * Set up the data type for this element. Null means unknown data type. - * - * @param dataType data type name - */ - public void setDataType(String dataType) - { - this.dataType = dataType; - } - - - /** - * Return the default value for the element. Null means no default value set up. - * - * @return String containing default value - */ - public String getDefaultValue() { return defaultValue; } - - - /** - * Set up the default value for the element. Null means no default value set up. - * - * @param defaultValue String containing default value - */ - public void setDefaultValue(String defaultValue) - { - this.defaultValue = defaultValue; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SimpleSchemaTypeProperties{" + - "dataType='" + dataType + '\'' + - ", defaultValue='" + defaultValue + '\'' + - ", dataType='" + getDataType() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", isDeprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", usage='" + getUsage() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", vendorProperties=" + getVendorProperties() + - ", typeName='" + getTypeName() + '\'' + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (!(objectToCompare instanceof SimpleSchemaType)) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - SimpleSchemaTypeProperties that = (SimpleSchemaTypeProperties) objectToCompare; - return Objects.equals(getDataType(), that.getDataType()) && - Objects.equals(getDefaultValue(), that.getDefaultValue()); - } - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), dataType, defaultValue); - } -} diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/DataAssetExchangeClient.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/DataAssetExchangeClient.java index 3de4f863367..279819ca373 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/DataAssetExchangeClient.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/DataAssetExchangeClient.java @@ -792,7 +792,7 @@ public void clearAssetRelationship(String userId, * @param assetManagerName unique name of software server capability representing the caller * @param relationshipTypeName type name of relationship to delete * @param fromAssetGUID unique identifier of the asset at end 1 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param forLineage return elements marked with the Memento classification? @@ -810,7 +810,7 @@ public List getRelatedAssetsAtEnd2(String userId, String assetManagerName, String relationshipTypeName, String fromAssetGUID, - int startingFrom, + int startFrom, int pageSize, Date effectiveTime, boolean forLineage, @@ -836,7 +836,7 @@ public List getRelatedAssetsAtEnd2(String userId, userId, relationshipTypeName, fromAssetGUID, - startingFrom, + startFrom, pageSize, forLineage, forDuplicateProcessing); @@ -853,7 +853,7 @@ public List getRelatedAssetsAtEnd2(String userId, * @param assetManagerName unique name of software server capability representing the caller * @param relationshipTypeName type name of relationship to delete * @param toAssetGUID unique identifier of the asset at end 2 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param forLineage return elements marked with the Memento classification? @@ -871,7 +871,7 @@ public List getRelatedAssetsAtEnd1(String userId, String assetManagerName, String relationshipTypeName, String toAssetGUID, - int startingFrom, + int startFrom, int pageSize, Date effectiveTime, boolean forLineage, @@ -896,7 +896,7 @@ public List getRelatedAssetsAtEnd1(String userId, userId, relationshipTypeName, toAssetGUID, - startingFrom, + startFrom, pageSize, forLineage, forDuplicateProcessing); diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/SchemaExchangeClientBase.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/SchemaExchangeClientBase.java index 80998fb9f5c..c60048d74b1 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/SchemaExchangeClientBase.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-client/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/client/exchange/SchemaExchangeClientBase.java @@ -155,7 +155,101 @@ public String createSchemaType(String userId, UserNotAuthorizedException, PropertyServerException { - final String methodName = "createSchemaType"; + final String methodName = "createSchemaType"; + + return this.createSchemaType(userId, + assetManagerGUID, + assetManagerName, + assetManagerIsHome, + null, + externalIdentifierProperties, + forLineage, + forDuplicateProcessing, + schemaTypeProperties, + methodName); + } + + + /** + * Create a new metadata element to represent a schema type. + * + * @param userId calling user + * @param assetManagerGUID unique identifier of software server capability representing the caller + * @param assetManagerName unique name of software server capability representing the caller + * @param assetManagerIsHome ensure that only the asset manager can update this schema element + * @param anchorGUID unique identifier of the intended anchor of the schema type + * @param externalIdentifierProperties optional properties used to define an external identifier + * @param schemaTypeProperties properties about the schema type to store + * @param forLineage return elements marked with the Memento classification? + * @param forDuplicateProcessing do not merge elements marked as duplicates? + * + * @return unique identifier of the new schema type + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + @Override + public String createAnchoredSchemaType(String userId, + String assetManagerGUID, + String assetManagerName, + boolean assetManagerIsHome, + String anchorGUID, + ExternalIdentifierProperties externalIdentifierProperties, + boolean forLineage, + boolean forDuplicateProcessing, + SchemaTypeProperties schemaTypeProperties) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + final String methodName = "createAnchoredSchemaType"; + + return this.createSchemaType(userId, + assetManagerGUID, + assetManagerName, + assetManagerIsHome, + anchorGUID, + externalIdentifierProperties, + forLineage, + forDuplicateProcessing, + schemaTypeProperties, + methodName); + } + + + /** + * Create a new metadata element to represent a schema type. + * + * @param userId calling user + * @param assetManagerGUID unique identifier of software server capability representing the caller + * @param assetManagerName unique name of software server capability representing the caller + * @param assetManagerIsHome ensure that only the asset manager can update this schema element + * @param anchorGUID unique identifier of the intended anchor of the schema type + * @param externalIdentifierProperties optional properties used to define an external identifier + * @param schemaTypeProperties properties about the schema type to store + * @param forLineage return elements marked with the Memento classification? + * @param forDuplicateProcessing do not merge elements marked as duplicates? + * @param methodName calling method + * + * @return unique identifier of the new schema type + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + private String createSchemaType(String userId, + String assetManagerGUID, + String assetManagerName, + boolean assetManagerIsHome, + String anchorGUID, + ExternalIdentifierProperties externalIdentifierProperties, + boolean forLineage, + boolean forDuplicateProcessing, + SchemaTypeProperties schemaTypeProperties, + String methodName) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { final String propertiesParameterName = "schemaTypeProperties"; final String qualifiedNameParameterName = "schemaTypeProperties.qualifiedName"; @@ -170,7 +264,7 @@ public String createSchemaType(String userId, externalIdentifierProperties, methodName)); - final String urlTemplate = serverPlatformURLRoot + urlTemplatePrefix + "/schema-types?assetManagerIsHome={2}&forLineage={3}&forDuplicateProcessing={4}"; + final String urlTemplate = serverPlatformURLRoot + urlTemplatePrefix + "/schema-types?assetManagerIsHome={2}&forLineage={3}&forDuplicateProcessing={4}&anchorGUID={5}"; GUIDResponse restResult = restClient.callGUIDPostRESTCall(methodName, urlTemplate, @@ -179,7 +273,8 @@ public String createSchemaType(String userId, userId, assetManagerIsHome, forLineage, - forDuplicateProcessing); + forDuplicateProcessing, + anchorGUID); return restResult.getGUID(); } diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/converters/SchemaTypeConverter.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/converters/SchemaTypeConverter.java index 83e1075b218..706b7ffd58a 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/converters/SchemaTypeConverter.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/converters/SchemaTypeConverter.java @@ -3,7 +3,8 @@ package org.odpi.openmetadata.accessservices.assetmanager.converters; import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement; -import org.odpi.openmetadata.accessservices.assetmanager.properties.*; +import org.odpi.openmetadata.accessservices.assetmanager.properties.DerivedSchemaTypeQueryTargetProperties; +import org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties; import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification; @@ -47,7 +48,7 @@ public SchemaTypeConverter(OMRSRepositoryHelper repositoryHelper, * @param beanClass name of the class to create * @param schemaRootHeader header of the schema element that holds the root information * @param schemaTypeTypeName name of type of the schema type to create - * @param instanceProperties properties describing the schema type + * @param schemaRootProperties properties describing the schema type * @param schemaRootClassifications classifications from the schema root entity * @param attributeCount number of attributes (for a complex schema type) * @param validValueSetGUID unique identifier of the set of valid values (for an enum schema type) @@ -59,7 +60,7 @@ public SchemaTypeConverter(OMRSRepositoryHelper repositoryHelper, * @param mapToSchemaType bean containing the properties of the schema type that is part of a map definition * @param schemaTypeOptionGUIDs list of unique identifiers for schema types that could be the type for this attribute * @param schemaTypeOptions list of schema types that could be the type for this attribute - * @param queryTargets list of relationships to schema types that contain data values used to derive the schema type value(s) + * @param queryTargetRelationships list of relationships to schema types that contain data values used to derive the schema type value(s) * @param methodName calling method * @return bean populated with properties from the instances supplied * @throws PropertyServerException there is a problem instantiating the bean @@ -68,7 +69,7 @@ public SchemaTypeConverter(OMRSRepositoryHelper repositoryHelper, public B getNewSchemaTypeBean(Class beanClass, InstanceHeader schemaRootHeader, String schemaTypeTypeName, - InstanceProperties instanceProperties, + InstanceProperties schemaRootProperties, List schemaRootClassifications, int attributeCount, String validValueSetGUID, @@ -80,7 +81,7 @@ public B getNewSchemaTypeBean(Class beanClass, B mapToSchemaType, List schemaTypeOptionGUIDs, List schemaTypeOptions, - List queryTargets, + List queryTargetRelationships, String methodName) throws PropertyServerException { try @@ -92,27 +93,94 @@ public B getNewSchemaTypeBean(Class beanClass, if (returnBean instanceof SchemaTypeElement) { - if ((schemaRootHeader != null) && (instanceProperties != null)) + if ((schemaRootHeader != null) && (schemaRootProperties != null)) { - /* - * The schema type has different subtypes. - * This next piece of logic sorts out which type of schema bean to create. - */ SchemaTypeElement bean = (SchemaTypeElement)returnBean; bean.setElementHeader(this.getMetadataElementHeader(beanClass, schemaRootHeader, schemaRootClassifications, methodName)); - bean.setSchemaTypeProperties(this.getSchemaTypeProperties(beanClass, - schemaTypeTypeName, - instanceProperties, - schemaRootClassifications, - attributeCount, - validValueSetGUID, - externalSchemaTypeGUID, - externalSchemaType, - mapFromSchemaType, - mapToSchemaType, - schemaTypeOptions, - methodName)); + + /* + * Set up schema properties to create. + */ + InstanceProperties instanceProperties = new InstanceProperties(schemaRootProperties); + SchemaTypeProperties schemaTypeProperties = new SchemaTypeProperties(); + + schemaTypeProperties.setQualifiedName(this.removeQualifiedName(instanceProperties)); + schemaTypeProperties.setDisplayName(this.removeDisplayName(instanceProperties)); + schemaTypeProperties.setDescription(this.removeDescription(instanceProperties)); + schemaTypeProperties.setIsDeprecated(this.removeIsDeprecated(instanceProperties)); + schemaTypeProperties.setVersionNumber(this.removeVersionNumber(instanceProperties)); + schemaTypeProperties.setAuthor(this.removeAuthor(instanceProperties)); + schemaTypeProperties.setUsage(this.removeUsage(instanceProperties)); + schemaTypeProperties.setEncodingStandard(this.removeEncodingStandard(instanceProperties)); + schemaTypeProperties.setNamespace(this.removeNamespace(instanceProperties)); + schemaTypeProperties.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties)); + + /* + * Any remaining properties are returned in the extended properties. They are + * assumed to be defined in a subtype. + */ + schemaTypeProperties.setTypeName(bean.getElementHeader().getType().getTypeName()); + schemaTypeProperties.setExtendedProperties(this.getRemainingExtendedProperties(instanceProperties)); + + bean.setSchemaTypeProperties(schemaTypeProperties); + + bean.setAttributeCount(attributeCount); + bean.setMapFromElement((SchemaTypeElement)mapFromSchemaType); + bean.setMapToElement((SchemaTypeElement)mapToSchemaType); + bean.setExternalSchemaType((SchemaTypeElement)externalSchemaType); + + if ((schemaTypeOptions != null) && (! schemaTypeOptions.isEmpty())) + { + List schemaTypeOptionBeans = new ArrayList<>(); + + for (B optionBean : schemaTypeOptions) + { + if (optionBean != null) + { + schemaTypeOptionBeans.add((SchemaTypeElement) optionBean); + } + } + + if (! schemaTypeOptionBeans.isEmpty()) + { + bean.setSchemaOptions(schemaTypeOptionBeans); + } + } + + InstanceProperties classificationProperties = + super.getClassificationProperties(OpenMetadataAPIMapper.CALCULATED_VALUE_CLASSIFICATION_TYPE_NAME, + schemaRootClassifications); + + bean.setFormula(this.getFormula(classificationProperties)); + bean.setFormulaType(this.getFormulaType(classificationProperties)); + + if (queryTargetRelationships != null) + { + List queryTargets = new ArrayList<>(); + + for (Relationship relationship : queryTargetRelationships) + { + if ((relationship != null) && (relationship.getEntityTwoProxy() != null)) + { + DerivedSchemaTypeQueryTargetProperties queryTargetProperties = new DerivedSchemaTypeQueryTargetProperties(); + + queryTargetProperties.setQueryId(this.getQueryId(relationship.getProperties())); + queryTargetProperties.setQuery(this.getQuery(relationship.getProperties())); + queryTargetProperties.setQueryTargetGUID(relationship.getEntityTwoProxy().getGUID()); + + queryTargets.add(queryTargetProperties); + } + else + { + handleBadRelationship(beanClass.getName(), relationship, methodName); + } + } + if (! queryTargets.isEmpty()) + { + bean.setQueries(queryTargets); + } + } return returnBean; } @@ -129,348 +197,4 @@ public B getNewSchemaTypeBean(Class beanClass, return null; } - - - /** - * Return the converted bean. This is a special method used for schema types since they are stored - * as a collection of instances. - * - * @param beanClass name of the class to create - * @param schemaTypeTypeName name of type of the schema type to create - * @param instanceProperties properties describing the schema type - * @param attributeCount number of attributes (for a complex schema type) - * @param validValueSetGUID unique identifier of the set of valid values (for an enum schema type) - * @param externalSchemaTypeGUID unique identifier of the external schema type - * @param externalSchemaType bean containing the properties of the schema type that is shared by multiple attributes/assets - * @param mapFromSchemaType bean containing the properties of the schema type that is part of a map definition - * @param mapToSchemaType bean containing the properties of the schema type that is part of a map definition - * @param schemaTypeOptions list of schema types that could be the type for this attribute - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - private SchemaTypeProperties getSchemaTypeProperties(Class beanClass, - String schemaTypeTypeName, - InstanceProperties instanceProperties, - List schemaRootClassifications, - int attributeCount, - String validValueSetGUID, - String externalSchemaTypeGUID, - B externalSchemaType, - B mapFromSchemaType, - B mapToSchemaType, - List schemaTypeOptions, - String methodName) throws PropertyServerException - { - SchemaTypeProperties returnBean = null; - - /* - * The schema type has different subtypes. - * This next piece of logic sorts out which type of schema bean to create. - */ - - if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.PRIMITIVE_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getPrimitiveSchemaType(instanceProperties); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.LITERAL_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getLiteralSchemaType(instanceProperties); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.COMPLEX_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getComplexSchemaType(instanceProperties, attributeCount); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.LITERAL_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getEnumSchemaType(instanceProperties, validValueSetGUID); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.MAP_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getMapSchemaType(instanceProperties, mapFromSchemaType, mapToSchemaType); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_NAME)) - { - returnBean = this.getSchemaTypeChoice(instanceProperties, schemaTypeOptions); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.EXTERNAL_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getExternalSchemaType(instanceProperties, externalSchemaTypeGUID, externalSchemaType); - } - else - { - /* - * This will throw an exception - */ - super.validateInstanceType(OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, - beanClass.getName(), - schemaTypeTypeName, - methodName); - } - - if (returnBean != null) - { - InstanceProperties classificationProperties = - super.getClassificationProperties(OpenMetadataAPIMapper.CALCULATED_VALUE_CLASSIFICATION_TYPE_NAME, - schemaRootClassifications); - - returnBean.setFormula(this.getFormula(classificationProperties)); - returnBean.setFormulaType(this.getFormulaType(classificationProperties)); - } - - return returnBean; - } - - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getLiteralSchemaType(InstanceProperties instanceProperties) - { - LiteralSchemaTypeProperties schemaType = new LiteralSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setDataType(this.removeDataType(propertiesCopy)); - schemaType.setFixedValue(this.removeFixedValue(propertiesCopy)); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getPrimitiveSchemaType(InstanceProperties instanceProperties) - { - PrimitiveSchemaTypeProperties schemaType = new PrimitiveSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setDataType(this.removeDataType(propertiesCopy)); - schemaType.setDefaultValue(this.removeDefaultValue(propertiesCopy)); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param attributeCount number of attributes (for a complex schema type) - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getComplexSchemaType(InstanceProperties instanceProperties, - int attributeCount) - { - ComplexSchemaTypeProperties schemaType = new ComplexSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setAttributeCount(attributeCount); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param validValueSetGUID unique identifier of the set of valid values (for an enum schema type) - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getEnumSchemaType(InstanceProperties instanceProperties, - String validValueSetGUID) - { - EnumSchemaTypeProperties schemaType = new EnumSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setDataType(this.removeDataType(propertiesCopy)); - schemaType.setDefaultValue(this.removeDefaultValue(propertiesCopy)); - schemaType.setValidValueSetGUID(validValueSetGUID); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param schemaTypeOptions list of schema types that could be the type for this attribute - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getSchemaTypeChoice(InstanceProperties instanceProperties, - List schemaTypeOptions) - { - SchemaTypeChoiceProperties schemaType = new SchemaTypeChoiceProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - if ((schemaTypeOptions != null) && (! schemaTypeOptions.isEmpty())) - { - List schemaTypeOptionBeans = new ArrayList<>(); - - for (B optionBean : schemaTypeOptions) - { - if (optionBean != null) - { - schemaTypeOptionBeans.add((SchemaTypeProperties) optionBean); - } - } - - if (! schemaTypeOptionBeans.isEmpty()) - { - schemaType.setSchemaOptions(schemaTypeOptionBeans); - } - - } - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param externalSchemaTypeGUID unique identifier of the external schema type - * @param externalSchemaType bean containing the properties of the schema type that is shared by multiple attributes/assets - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getExternalSchemaType(InstanceProperties instanceProperties, - String externalSchemaTypeGUID, - B externalSchemaType) - { - ExternalSchemaTypeProperties schemaType = new ExternalSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - if (externalSchemaType != null) - { - schemaType.setExternalSchemaTypeGUID(externalSchemaTypeGUID); - schemaType.setExternalSchemaType((SchemaTypeProperties)externalSchemaType); - } - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param mapFromSchemaType bean containing the properties of the schema type that is part of a map definition - * @param mapToSchemaType bean containing the properties of the schema type that is part of a map definition - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getMapSchemaType(InstanceProperties instanceProperties, - B mapFromSchemaType, - B mapToSchemaType) - { - MapSchemaTypeProperties schemaType = new MapSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - if (mapFromSchemaType != null) - { - schemaType.setMapFromElement((SchemaTypeProperties) mapFromSchemaType); - } - - if (mapToSchemaType != null) - { - schemaType.setMapFromElement((SchemaTypeProperties) mapFromSchemaType); - } - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Set up the properties found in every schema type. - * - * @param bean bean to fill - * @param instanceProperties properties from the entity - */ - private void updateBasicSchemaTypeProperties(SchemaTypeProperties bean, - InstanceProperties instanceProperties) - { - bean.setQualifiedName(this.removeQualifiedName(instanceProperties)); - bean.setDisplayName(this.removeDisplayName(instanceProperties)); - bean.setDescription(this.removeDescription(instanceProperties)); - bean.setIsDeprecated(this.removeIsDeprecated(instanceProperties)); - bean.setVersionNumber(this.removeVersionNumber(instanceProperties)); - bean.setAuthor(this.removeAuthor(instanceProperties)); - bean.setUsage(this.removeUsage(instanceProperties)); - bean.setEncodingStandard(this.removeEncodingStandard(instanceProperties)); - bean.setNamespace(this.removeNamespace(instanceProperties)); - bean.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties)); - } } diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/DataAssetExchangeHandler.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/DataAssetExchangeHandler.java index cdf2e836078..4a0e85aba2d 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/DataAssetExchangeHandler.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/DataAssetExchangeHandler.java @@ -1023,7 +1023,7 @@ public void clearAssetRelationship(String userId, * @param assetManagerName unique name of software server capability representing the caller * @param relationshipTypeName type name of relationship to delete * @param fromAssetGUID unique identifier of the asset at end 1 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? @@ -1042,7 +1042,7 @@ public List getRelatedAssetsAtEnd2(String userId, String assetManagerName, String relationshipTypeName, String fromAssetGUID, - int startingFrom, + int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, @@ -1071,7 +1071,7 @@ public List getRelatedAssetsAtEnd2(String userId, 2, forLineage, forDuplicateProcessing, - startingFrom, + startFrom, pageSize, effectiveTime, methodName); @@ -1100,7 +1100,7 @@ public List getRelatedAssetsAtEnd2(String userId, * @param assetManagerName unique name of software server capability representing the caller * @param relationshipTypeName type name of relationship to delete * @param toAssetGUID unique identifier of the asset at end 2 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? @@ -1119,7 +1119,7 @@ public List getRelatedAssetsAtEnd1(String userId, String assetManagerName, String relationshipTypeName, String toAssetGUID, - int startingFrom, + int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, @@ -1148,7 +1148,7 @@ public List getRelatedAssetsAtEnd1(String userId, 1, forLineage, forDuplicateProcessing, - startingFrom, + startFrom, pageSize, effectiveTime, methodName); diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/ProcessExchangeHandler.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/ProcessExchangeHandler.java index 9e595944658..ac9188404af 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/ProcessExchangeHandler.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/ProcessExchangeHandler.java @@ -3136,6 +3136,7 @@ public List getProcessCallers(String userId, * @param forDuplicateProcessing do not merge elements marked as duplicates? * @param effectiveTime the time that the retrieved elements must be effective for (null for any time, new Date() for now) * @param methodName calling method + * @return unique identifier of the new relationship * * @throws InvalidParameterException one of the parameters is invalid * @throws UserNotAuthorizedException the user is not authorized to issue this request diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/SchemaExchangeHandler.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/SchemaExchangeHandler.java index b9d1b3b0abd..d2a057a888f 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/SchemaExchangeHandler.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/handlers/SchemaExchangeHandler.java @@ -19,14 +19,12 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementHeader; import org.odpi.openmetadata.metadatasecurity.server.OpenMetadataServerSecurityVerifier; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; import org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -228,6 +226,7 @@ private void addCorrelationPropertiesToSchemaAttributes(String * @param userId calling user * @param correlationProperties properties to help with the mapping of the elements in the external asset manager and open metadata * @param assetManagerIsHome ensure that only the asset manager can update this schema element + * @param anchorGUID unique identifier of the intended anchor of the schema type * @param schemaTypeProperties properties about the schema type to store * @param forLineage the request is to support lineage retrieval this means entities with the Memento classification can be returned * @param forDuplicateProcessing the request is for duplicate processing and so must not deduplicate @@ -243,6 +242,7 @@ private void addCorrelationPropertiesToSchemaAttributes(String public String createSchemaType(String userId, MetadataCorrelationProperties correlationProperties, boolean assetManagerIsHome, + String anchorGUID, SchemaTypeProperties schemaTypeProperties, boolean forLineage, boolean forDuplicateProcessing, @@ -266,6 +266,11 @@ public String createSchemaType(String userId, builder.setEffectivityDates(schemaTypeProperties.getEffectiveFrom(), schemaTypeProperties.getEffectiveTo()); + if (anchorGUID != null) + { + builder.setAnchors(userId, anchorGUID, methodName); + } + String schemaTypeGUID = schemaTypeHandler.addSchemaType(userId, this.getExternalSourceGUID(correlationProperties, assetManagerIsHome), this.getExternalSourceName(correlationProperties, assetManagerIsHome), @@ -326,110 +331,26 @@ private SchemaTypeBuilder getSchemaTypeBuilder(SchemaTypeProperties schemaType, methodName, repositoryHelper); - SchemaTypeBuilder schemaTypeBuilder = new SchemaTypeBuilder(schemaType.getQualifiedName(), - schemaType.getDisplayName(), - schemaType.getDescription(), - schemaType.getVersionNumber(), - schemaType.getIsDeprecated(), - schemaType.getAuthor(), - schemaType.getUsage(), - schemaType.getEncodingStandard(), - schemaType.getNamespace(), - schemaType.getFormula(), - schemaType.getAdditionalProperties(), - typeGUID, - typeName, - schemaType.getExtendedProperties(), - repositoryHelper, - serviceName, - serverName); - - if (schemaType instanceof LiteralSchemaTypeProperties) - { - LiteralSchemaTypeProperties literalSchemaTypeProperties = (LiteralSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setDataType(literalSchemaTypeProperties.getDataType()); - schemaTypeBuilder.setFixedValue(literalSchemaTypeProperties.getFixedValue()); - } - else if (schemaType instanceof SimpleSchemaTypeProperties) - { - SimpleSchemaTypeProperties simpleSchemaTypeProperties = (SimpleSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setDataType(simpleSchemaTypeProperties.getDataType()); - schemaTypeBuilder.setDefaultValue(simpleSchemaTypeProperties.getDefaultValue()); - - if (schemaType instanceof EnumSchemaTypeProperties) - { - EnumSchemaTypeProperties enumSchemaTypeProperties = (EnumSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setValidValuesSetGUID(enumSchemaTypeProperties.getValidValueSetGUID()); - } - else if (schemaType instanceof ExternalSchemaTypeProperties) - { - ExternalSchemaTypeProperties externalSchemaTypeProperties = (ExternalSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setExternalSchemaTypeGUID(externalSchemaTypeProperties.getExternalSchemaTypeGUID()); - } - } - else if (schemaType instanceof SchemaTypeChoiceProperties) - { - SchemaTypeChoiceProperties schemaTypeChoiceProperties = (SchemaTypeChoiceProperties)schemaType; - - if (schemaTypeChoiceProperties.getSchemaOptions() != null) - { - List schemaOptionBuilders = new ArrayList<>(); - - for (SchemaTypeProperties schemaOption : schemaTypeChoiceProperties.getSchemaOptions()) - { - if (schemaOption != null) - { - schemaOptionBuilders.add(this.getSchemaTypeBuilder(schemaOption, - repositoryHelper, - serviceName, - serverName, - methodName)); - } - } - - if (! schemaOptionBuilders.isEmpty()) - { - schemaTypeBuilder.setSchemaOptions(schemaOptionBuilders); - } - } - } - else if (schemaType instanceof MapSchemaTypeProperties) - { - MapSchemaTypeProperties mapSchemaTypeProperties = (MapSchemaTypeProperties)schemaType; - - SchemaTypeBuilder mapFromBuilder = null; - SchemaTypeBuilder mapToBuilder = null; - - if (mapSchemaTypeProperties.getMapFromElement() != null) - { - mapFromBuilder = this.getSchemaTypeBuilder(mapSchemaTypeProperties.getMapFromElement(), - repositoryHelper, - serviceName, - serverName, - methodName); - } - - if (mapSchemaTypeProperties.getMapToElement() != null) - { - mapToBuilder = this.getSchemaTypeBuilder(mapSchemaTypeProperties.getMapToElement(), - repositoryHelper, - serviceName, - serverName, - methodName); - } - - schemaTypeBuilder.setMapTypes(mapFromBuilder, mapToBuilder); - } - - return schemaTypeBuilder; + return new SchemaTypeBuilder(schemaType.getQualifiedName(), + schemaType.getDisplayName(), + schemaType.getDescription(), + schemaType.getVersionNumber(), + schemaType.getIsDeprecated(), + schemaType.getAuthor(), + schemaType.getUsage(), + schemaType.getEncodingStandard(), + schemaType.getNamespace(), + schemaType.getFormula(), + schemaType.getAdditionalProperties(), + typeGUID, + typeName, + schemaType.getExtendedProperties(), + repositoryHelper, + serviceName, + serverName); } - /** * Create a new metadata element to represent a schema type using an existing metadata element as a template. * @@ -578,7 +499,6 @@ public void updateSchemaType(String userId, * @throws UserNotAuthorizedException the user is not authorized to issue this request * @throws PropertyServerException there is a problem reported in the open metadata server(s) */ - @SuppressWarnings(value = "unused") public void setupSchemaTypeParent(String userId, String assetManagerGUID, String assetManagerName, @@ -1528,9 +1448,11 @@ public void updateSchemaAttribute(String userId, invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateGUID(schemaAttributeGUID, schemaAttributeGUIDParameterName, methodName); invalidParameterHandler.validateObject(schemaAttributeProperties, propertiesParameterName, methodName); - invalidParameterHandler.validateName(schemaAttributeProperties.getQualifiedName(), qualifiedNameParameterName, methodName); - SchemaTypeProperties schemaType = schemaAttributeProperties.getSchemaType(); - invalidParameterHandler.validateObject(schemaType,"displayName", methodName); + if (! isMergeUpdate) + { + invalidParameterHandler.validateName(schemaAttributeProperties.getQualifiedName(), qualifiedNameParameterName, methodName); + } + this.validateExternalIdentifier(userId, schemaAttributeGUID, schemaAttributeGUIDParameterName, @@ -2267,14 +2189,16 @@ public SchemaAttributeElement getSchemaAttributeByGUID(String userId, { final String guidParameterName = "schemaAttributeGUID"; - SchemaAttributeElement schemaAttributeElement = schemaAttributeHandler.getBeanFromRepository(userId, - schemaAttributeGUID, - guidParameterName, - OpenMetadataAPIMapper.SCHEMA_ATTRIBUTE_TYPE_NAME, - false, - false, - effectiveTime, - methodName); + SchemaAttributeElement schemaAttributeElement = schemaAttributeHandler.getSchemaAttribute(userId, + schemaAttributeGUID, + guidParameterName, + OpenMetadataAPIMapper.SCHEMA_ATTRIBUTE_TYPE_NAME, + null, + null, + false, + false, + effectiveTime, + methodName); if (schemaAttributeElement != null) { diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/DataAssetExchangeRESTServices.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/DataAssetExchangeRESTServices.java index be71633611c..52a3285ecbc 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/DataAssetExchangeRESTServices.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/DataAssetExchangeRESTServices.java @@ -800,7 +800,7 @@ public VoidResponse clearAssetRelationship(String serverN * @param userId calling user * @param relationshipTypeName type name of relationship to delete * @param fromAssetGUID unique identifier of the asset at end 1 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? @@ -815,7 +815,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd2(String String userId, String relationshipTypeName, String fromAssetGUID, - int startingFrom, + int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, @@ -841,7 +841,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd2(String requestBody.getAssetManagerName(), relationshipTypeName, fromAssetGUID, - startingFrom, + startFrom, pageSize, forLineage, forDuplicateProcessing, @@ -871,7 +871,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd2(String * @param userId calling user * @param relationshipTypeName type name of relationship to delete * @param toAssetGUID unique identifier of the asset at end 2 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? @@ -886,7 +886,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd1(String String userId, String relationshipTypeName, String toAssetGUID, - int startingFrom, + int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, @@ -912,7 +912,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd1(String requestBody.getAssetManagerName(), relationshipTypeName, toAssetGUID, - startingFrom, + startFrom, pageSize, forLineage, forDuplicateProcessing, diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/SchemaExchangeRESTServices.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/SchemaExchangeRESTServices.java index 52404dbc000..54358d0a53d 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/SchemaExchangeRESTServices.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-server/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/SchemaExchangeRESTServices.java @@ -46,12 +46,12 @@ public SchemaExchangeRESTServices() * @param serverName name of the server to route the request to * @param userId calling user * @param assetManagerIsHome ensure that only the asset manager can update this schema element + * @param anchorGUID unique identifier of the intended anchor of the schema type * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? * @param requestBody properties about the schema type to store * - * @return unique identifier of the new schema type - * + * @return unique identifier of the new schema type or * InvalidParameterException one of the parameters is invalid * UserNotAuthorizedException the user is not authorized to issue this request * PropertyServerException there is a problem reported in the open metadata server(s) @@ -59,6 +59,7 @@ public SchemaExchangeRESTServices() public GUIDResponse createSchemaType(String serverName, String userId, boolean assetManagerIsHome, + String anchorGUID, boolean forLineage, boolean forDuplicateProcessing, SchemaTypeRequestBody requestBody) @@ -81,6 +82,7 @@ public GUIDResponse createSchemaType(String serverName, response.setGUID(handler.createSchemaType(userId, requestBody.getMetadataCorrelationProperties(), assetManagerIsHome, + anchorGUID, requestBody.getElementProperties(), forLineage, forDuplicateProcessing, @@ -437,8 +439,8 @@ public VoidResponse setupSchemaElementRelationship(String serve requestBody.getAssetManagerGUID(), requestBody.getAssetManagerName(), assetManagerIsHome, - endTwoGUID, endOneGUID, + endTwoGUID, relationshipTypeName, requestBody.getProperties(), requestBody.getProperties().getEffectiveFrom(), @@ -454,8 +456,8 @@ public VoidResponse setupSchemaElementRelationship(String serve requestBody.getAssetManagerGUID(), requestBody.getAssetManagerName(), assetManagerIsHome, - endTwoGUID, endOneGUID, + endTwoGUID, relationshipTypeName, null, null, diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/DataAssetExchangeResource.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/DataAssetExchangeResource.java index 749a590bfd0..bea87593e7a 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/DataAssetExchangeResource.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/DataAssetExchangeResource.java @@ -426,7 +426,7 @@ public VoidResponse clearAssetRelationship(@PathVariable String * @param userId calling user * @param relationshipTypeName type name of relationship to delete * @param fromAssetGUID unique identifier of the asset at end 1 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? @@ -443,15 +443,15 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd2(@PathVariable String @PathVariable String userId, @PathVariable String relationshipTypeName, @PathVariable String fromAssetGUID, - @RequestParam int startingFrom, + @RequestParam int startFrom, @RequestParam int pageSize, @RequestParam (required = false, defaultValue = "false") - boolean forLineage, + boolean forLineage, @RequestParam (required = false, defaultValue = "false") - boolean forDuplicateProcessing, + boolean forDuplicateProcessing, @RequestBody EffectiveTimeQueryRequestBody requestBody) { - return restAPI.getRelatedAssetsAtEnd2(serverName, userId, relationshipTypeName, fromAssetGUID, startingFrom, pageSize, forLineage, forDuplicateProcessing, requestBody); + return restAPI.getRelatedAssetsAtEnd2(serverName, userId, relationshipTypeName, fromAssetGUID, startFrom, pageSize, forLineage, forDuplicateProcessing, requestBody); } @@ -462,7 +462,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd2(@PathVariable String * @param userId calling user * @param relationshipTypeName type name of relationship to delete * @param toAssetGUID unique identifier of the asset at end 2 of the relationship - * @param startingFrom start position for results + * @param startFrom start position for results * @param pageSize maximum number of results * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? @@ -479,7 +479,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd1(@PathVariable String @PathVariable String userId, @PathVariable String relationshipTypeName, @PathVariable String toAssetGUID, - @RequestParam int startingFrom, + @RequestParam int startFrom, @RequestParam int pageSize, @RequestParam (required = false, defaultValue = "false") boolean forLineage, @@ -487,7 +487,7 @@ public RelationshipElementsResponse getRelatedAssetsAtEnd1(@PathVariable String boolean forDuplicateProcessing, @RequestBody EffectiveTimeQueryRequestBody requestBody) { - return restAPI.getRelatedAssetsAtEnd1(serverName, userId, relationshipTypeName, toAssetGUID, startingFrom, pageSize, forLineage, forDuplicateProcessing, requestBody); + return restAPI.getRelatedAssetsAtEnd1(serverName, userId, relationshipTypeName, toAssetGUID, startFrom, pageSize, forLineage, forDuplicateProcessing, requestBody); } diff --git a/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/SchemaExchangeResource.java b/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/SchemaExchangeResource.java index 55ec465fc5d..485c24b2620 100644 --- a/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/SchemaExchangeResource.java +++ b/open-metadata-implementation/access-services/asset-manager/asset-manager-spring/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/server/spring/SchemaExchangeResource.java @@ -46,12 +46,12 @@ public SchemaExchangeResource() * @param serverName name of the server to route the request to * @param userId calling user * @param assetManagerIsHome ensure that only the asset manager can update this schema element + * @param anchorGUID unique identifier of the intended anchor of the schema type * @param forLineage return elements marked with the Memento classification? * @param forDuplicateProcessing do not merge elements marked as duplicates? * @param requestBody properties about the schema type to store * * @return unique identifier of the new schema type - * * InvalidParameterException one of the parameters is invalid * UserNotAuthorizedException the user is not authorized to issue this request * PropertyServerException there is a problem reported in the open metadata server(s) @@ -61,13 +61,15 @@ public SchemaExchangeResource() public GUIDResponse createSchemaType(@PathVariable String serverName, @PathVariable String userId, @RequestParam boolean assetManagerIsHome, + @RequestParam (required = false, defaultValue = "null") + String anchorGUID, @RequestParam (required = false, defaultValue = "false") - boolean forLineage, + boolean forLineage, @RequestParam (required = false, defaultValue = "false") - boolean forDuplicateProcessing, + boolean forDuplicateProcessing, @RequestBody SchemaTypeRequestBody requestBody) { - return restAPI.createSchemaType(serverName, userId, assetManagerIsHome, forLineage, forDuplicateProcessing, requestBody); + return restAPI.createSchemaType(serverName, userId, assetManagerIsHome, anchorGUID, forLineage, forDuplicateProcessing, requestBody); } @@ -81,7 +83,6 @@ public GUIDResponse createSchemaType(@PathVariable String serverN * @param requestBody properties that override the template * * @return unique identifier of the new schema type - * * InvalidParameterException one of the parameters is invalid * UserNotAuthorizedException the user is not authorized to issue this request * PropertyServerException there is a problem reported in the open metadata server(s) diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/metadataelements/SchemaTypeElement.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/metadataelements/SchemaTypeElement.java index cf923dcf460..d290784af0e 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/metadataelements/SchemaTypeElement.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/metadataelements/SchemaTypeElement.java @@ -6,14 +6,15 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import org.odpi.openmetadata.accessservices.assetowner.properties.DerivedSchemaTypeQueryTargetProperties; import org.odpi.openmetadata.accessservices.assetowner.properties.SchemaTypeProperties; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementHeader; -import java.io.Serializable; +import java.util.List; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementHeader; /** * SchemaTypeElement contains the properties and header for a reference data asset retrieved from the metadata repository. @@ -21,13 +22,38 @@ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) -public class SchemaTypeElement implements MetadataElement, Serializable +public class SchemaTypeElement implements MetadataElement { - private static final long serialVersionUID = 1L; + private SchemaTypeProperties schemaTypeProperties = null; + private ElementHeader elementHeader = null; - private SchemaTypeProperties schemaTypeProperties = null; - private ElementHeader elementHeader = null; + /* + * For complex schema types such as StructSchemaType + */ + private int attributeCount = 0; + /* + * For Map Schema Types + */ + private SchemaTypeElement mapFromElement = null; + private SchemaTypeElement mapToElement = null; + + /* + * For External Schema Types + */ + private SchemaTypeElement externalSchemaType = null; + + /* + * Schema options for SchemaTypeChoice + */ + private List schemaOptions = null; + + /* + * Used when a value, or set of values associated with the schema are derived rather than stored. + */ + private String formula = null; + private String formulaType = null; + private List queries = null; /** * Default constructor @@ -49,6 +75,19 @@ public SchemaTypeElement(SchemaTypeElement template) { elementHeader = template.getElementHeader(); schemaTypeProperties = template.getSchemaTypeProperties(); + + attributeCount = template.getAttributeCount(); + + mapFromElement = template.getMapFromElement(); + mapToElement = template.getMapToElement(); + + externalSchemaType = template.getExternalSchemaType(); + + schemaOptions = template.getSchemaOptions(); + + formula = template.getFormula(); + formulaType = template.getFormulaType(); + queries = template.getQueries(); } } @@ -99,6 +138,193 @@ public void setSchemaTypeProperties(SchemaTypeProperties schemaTypeProperties) } + + /** + * Return the count of attributes in this schema type. + * + * @return String data type name + */ + public int getAttributeCount() { return attributeCount; } + + + /** + * Set up the count of attributes in this schema type + * + * @param attributeCount data type name + */ + public void setAttributeCount(int attributeCount) + { + this.attributeCount = attributeCount; + } + + + + /** + * Return the type of schema element that represents the key or property name for the map. + * This is also called the domain of the map. + * + * @return SchemaElement + */ + public SchemaTypeElement getMapFromElement() + { + return mapFromElement; + } + + + /** + * Set up the type of schema element that represents the key or property name for the map. + * This is also called the domain of the map. + * + * @param mapFromElement SchemaElement + */ + public void setMapFromElement(SchemaTypeElement mapFromElement) + { + this.mapFromElement = mapFromElement; + } + + + /** + * Return the type of schema element that represents the property value for the map. + * This is also called the range of the map. + * + * @return SchemaElement + */ + public SchemaTypeElement getMapToElement() + { + return mapToElement; + } + + + /** + * Set up the type of schema element that represents the property value for the map. + * This is also called the range of the map. + * + * @param mapToElement SchemaType + */ + public void setMapToElement(SchemaTypeElement mapToElement) + { + this.mapToElement = mapToElement; + } + + + /** + * Return the schema type that is reusable amongst assets. + * + * @return bean describing external schema + */ + public SchemaTypeElement getExternalSchemaType() + { + return externalSchemaType; + } + + + /** + * Set up the schema type that is reusable amongst assets. + * + * @param externalSchemaType bean describing external schema + */ + public void setExternalSchemaType(SchemaTypeElement externalSchemaType) + { + this.externalSchemaType = externalSchemaType; + } + + + /** + * Return the list of alternative schema types that this attribute or asset may use. + * + * @return list of schema types + */ + public List getSchemaOptions() + { + if (schemaOptions == null) + { + return null; + } + else if (schemaOptions.isEmpty()) + { + return null; + } + + return schemaOptions; + } + + + /** + * Set up the list of alternative schema types that this attribute or asset may use. + * + * @param schemaOptions list of schema types + */ + public void setSchemaOptions(List schemaOptions) + { + this.schemaOptions = schemaOptions; + } + + + /** + * Return the formula used to combine the values of the queries. Each query is has a identifier and the + * formula has placeholders for these identifiers in it to show how the query results are combined. + * + * @return String formula + */ + public String getFormula() { return formula; } + + + /** + * Set up the formula used to combine the values of the queries. Each query is has a identifier and the + * formula has placeholders for these identifiers in it to show how the query results are combined. + * + * @param formula String formula + */ + public void setFormula(String formula) + { + this.formula = formula; + } + + + /** + * Return the specification language for the formula. + * + * @return string description + */ + public String getFormulaType() + { + return formulaType; + } + + + /** + * Set up the specification language for the formula. + * + * @param formulaType string description + */ + public void setFormulaType(String formulaType) + { + this.formulaType = formulaType; + } + + + /** + * Return the list of individual query targets for a derived column. + * + * @return list of queries and their target element + */ + public List getQueries() + { + return queries; + } + + + /** + * Set up the list of individual query targets for a derived column. + * + * @param queries list of queries and their target element + */ + public void setQueries(List queries) + { + this.queries = queries; + } + + /** * JSON-style toString * @@ -108,9 +334,15 @@ public void setSchemaTypeProperties(SchemaTypeProperties schemaTypeProperties) public String toString() { return "SchemaTypeElement{" + - "elementHeader=" + elementHeader + - ", properties='" + getSchemaTypeProperties() + '\'' + - '}'; + "schemaTypeProperties=" + schemaTypeProperties + + ", elementHeader=" + elementHeader + + ", attributeCount=" + attributeCount + + ", mapFromElement=" + mapFromElement + + ", mapToElement=" + mapToElement + + ", formula='" + formula + '\'' + + ", formulaType='" + formulaType + '\'' + + ", queries=" + queries + + '}'; } @@ -132,8 +364,16 @@ public boolean equals(Object objectToCompare) return false; } SchemaTypeElement that = (SchemaTypeElement) objectToCompare; - return Objects.equals(schemaTypeProperties, that.schemaTypeProperties) && - Objects.equals(elementHeader, that.elementHeader); + return attributeCount == that.attributeCount && + Objects.equals(schemaTypeProperties, that.schemaTypeProperties) && + Objects.equals(elementHeader, that.elementHeader) && + Objects.equals(mapFromElement, that.mapFromElement) && + Objects.equals(mapToElement, that.mapToElement) && + Objects.equals(externalSchemaType, that.externalSchemaType) && + Objects.equals(schemaOptions, that.schemaOptions) && + Objects.equals(formula, that.formula) && + Objects.equals(formulaType, that.formulaType) && + Objects.equals(queries, that.queries); } @@ -145,6 +385,7 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(super.hashCode(), elementHeader, schemaTypeProperties); + return Objects.hash(schemaTypeProperties, elementHeader, attributeCount, mapFromElement, mapToElement, externalSchemaType, schemaOptions, + formula, formulaType, queries); } } diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/ComplexSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/ComplexSchemaTypeProperties.java deleted file mode 100644 index e5c03a56e92..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/ComplexSchemaTypeProperties.java +++ /dev/null @@ -1,138 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - - -import com.fasterxml.jackson.annotation.*; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * ComplexSchemaTypeProperties describes a schema with multiple attributes. Notice it does not contain the attributes, - * just a count of them. This is because a complex schema type may have literally thousands of attributes - * and so the attribute contents are retrieved separated through calls that support paging. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "class") -@JsonSubTypes({ - @JsonSubTypes.Type(value = DocumentSchemaAttributeProperties.class, name = "DocumentSchemaAttributeProperties"), - @JsonSubTypes.Type(value = StructSchemaTypeProperties.class, name = "StructSchemaTypeProperties"), - @JsonSubTypes.Type(value = TabularSchemaTypeProperties.class, name = "TabularSchemaTypeProperties"), -}) -public class ComplexSchemaTypeProperties extends SchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - private int attributeCount = 0; - - - /** - * Default constructor used by subclasses - */ - public ComplexSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public ComplexSchemaTypeProperties(ComplexSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - attributeCount = template.getAttributeCount(); - } - } - - - /** - * Return the count of attributes in this schema type. - * - * @return String data type name - */ - public int getAttributeCount() { return attributeCount; } - - - /** - * Set up the count of attributes in this schema type - * - * @param attributeCount data type name - */ - public void setAttributeCount(int attributeCount) - { - this.attributeCount = attributeCount; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "ComplexSchemaType{" + - "attributeCount='" + attributeCount + '\'' + - ", displayName='" + getDisplayName() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - ComplexSchemaTypeProperties that = (ComplexSchemaTypeProperties) objectToCompare; - return attributeCount == that.attributeCount; - } - - - /** - * Create a hash code for this element type. - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), attributeCount); - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DocumentSchemaAttributeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DocumentSchemaAttributeProperties.java deleted file mode 100644 index 9a69916b522..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DocumentSchemaAttributeProperties.java +++ /dev/null @@ -1,77 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * A DocumentSchemaAttributeProperties defines an attribute in a hierarchical document structure such as an - * XML document. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class DocumentSchemaAttributeProperties extends SchemaAttributeProperties -{ - private static final long serialVersionUID = 1L; - - - /** - * Default constructor - */ - public DocumentSchemaAttributeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public DocumentSchemaAttributeProperties(DocumentSchemaAttributeProperties template) - { - super(template); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "DocumentSchemaAttributeProperties{" + - "elementPosition=" + getElementPosition() + - ", minCardinality=" + getMinCardinality() + - ", maxCardinality=" + getMaxCardinality() + - ", allowsDuplicateValues=" + getAllowsDuplicateValues() + - ", orderedValues=" + getOrderedValues() + - ", sortOrder=" + getSortOrder() + - ", minimumLength=" + getMinimumLength() + - ", length=" + getLength() + - ", significantDigits=" + getPrecision() + - ", nullable=" + getIsNullable() + - ", defaultValueOverride='" + getDefaultValueOverride() + '\'' + - ", attributeType=" + getAttributeType() + - ", attributeRelationships=" + getAttributeRelationships() + - ", nativeJavaClass='" + getNativeJavaClass() + '\'' + - ", aliases=" + getAliases() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DocumentSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DocumentSchemaTypeProperties.java deleted file mode 100644 index 3a7ddd131b3..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DocumentSchemaTypeProperties.java +++ /dev/null @@ -1,95 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * DocumentSchemaTypeProperties is a specific type of bean for a do a top-level hierarchical document structure such - * as an XML document. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class DocumentSchemaTypeProperties extends ComplexSchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - - /** - * Default constructor used by subclasses - */ - public DocumentSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public DocumentSchemaTypeProperties(DocumentSchemaTypeProperties template) - { - super(template); - } - - - /** - * Returns a clone of this object as the abstract SchemaElement class. - * - * @return SchemaElement - */ - public SchemaElementProperties cloneSchemaElement() - { - return new DocumentSchemaTypeProperties(this); - } - - - /** - * Returns a clone of this object as the abstract SchemaType class. - * - * @return SchemaType object - */ - public SchemaTypeProperties cloneSchemaType() - { - return new DocumentSchemaTypeProperties(this); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "DocumentSchemaTypeProperties{" + - "cloneSchemaElement=" + cloneSchemaElement() + - ", cloneSchemaType=" + cloneSchemaType() + - ", attributeCount=" + getAttributeCount() + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/EnumSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/EnumSchemaTypeProperties.java deleted file mode 100644 index 1d3481c6ffb..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/EnumSchemaTypeProperties.java +++ /dev/null @@ -1,133 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * EnumSchemaTypeProperties carries the specialized parameters for creating or updating enum schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class EnumSchemaTypeProperties extends SimpleSchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - private String validValueSetGUID = null; - - /** - * Default constructor - */ - public EnumSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - * - * @param template template object to copy. - */ - public EnumSchemaTypeProperties(EnumSchemaTypeProperties template) - { - super(template); - } - - - /** - * Return the unique identifier of the valid value set that describes the enum values for this schema element. - * - * @return string guid - */ - public String getValidValueSetGUID() - { - return validValueSetGUID; - } - - - /** - * Set up the unique identifier of the value set that describes the enum values for this schema element. - * - * @param validValueSetGUID string guid - */ - public void setValidValueSetGUID(String validValueSetGUID) - { - this.validValueSetGUID = validValueSetGUID; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "EnumSchemaTypeProperties{" + - "validValueSet='" + validValueSetGUID + '\'' + - ", dataType='" + getDataType() + '\'' + - ", defaultValue='" + getDefaultValue() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - EnumSchemaTypeProperties that = (EnumSchemaTypeProperties) objectToCompare; - return Objects.equals(validValueSetGUID, that.validValueSetGUID); - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), validValueSetGUID); - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/ExternalSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/ExternalSchemaTypeProperties.java deleted file mode 100644 index e8791663a4c..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/ExternalSchemaTypeProperties.java +++ /dev/null @@ -1,166 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * ExternalSchemaTypeProperties carries the unique identifier and properties of a reusable schema type. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class ExternalSchemaTypeProperties extends SimpleSchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - private String externalSchemaTypeGUID = null; - private SchemaTypeProperties externalSchemaType = null; - - /** - * Default constructor - */ - public ExternalSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - * - * @param template template object to copy. - */ - public ExternalSchemaTypeProperties(ExternalSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - externalSchemaTypeGUID = template.getExternalSchemaTypeGUID(); - externalSchemaType = template.getExternalSchemaType(); - } - } - - - /** - * Return the unique identifier of the external schema type. - * - * @return string guid - */ - public String getExternalSchemaTypeGUID() - { - return externalSchemaTypeGUID; - } - - - /** - * Set up the unique identifier of the external schema type. - * - * @param externalSchemaTypeGUID string guid - */ - public void setExternalSchemaTypeGUID(String externalSchemaTypeGUID) - { - this.externalSchemaTypeGUID = externalSchemaTypeGUID; - } - - - /** - * Return the schema type that is reusable amongst assets. - * - * @return bean describing external schema - */ - public SchemaTypeProperties getExternalSchemaType() - { - return externalSchemaType; - } - - - /** - * Set up the schema type that is reusable amongst assets. - * - * @param externalSchemaType bean describing external schema - */ - public void setExternalSchemaType(SchemaTypeProperties externalSchemaType) - { - this.externalSchemaType = externalSchemaType; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "ExternalSchemaTypeProperties{" + - "externalSchemaTypeGUID=" + externalSchemaTypeGUID + - ", externalSchemaType=" + externalSchemaType + - ", dataType='" + getDataType() + '\'' + - ", defaultValue='" + getDefaultValue() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - ExternalSchemaTypeProperties that = (ExternalSchemaTypeProperties) objectToCompare; - return Objects.equals(externalSchemaTypeGUID, that.externalSchemaTypeGUID) && - Objects.equals(externalSchemaType, that.externalSchemaType); - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), externalSchemaTypeGUID, externalSchemaType); - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/LiteralSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/LiteralSchemaTypeProperties.java deleted file mode 100644 index 6340c92688c..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/LiteralSchemaTypeProperties.java +++ /dev/null @@ -1,157 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * LiteralSchemaTypeProperties carries the specialized parameters for creating or updating literal schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class LiteralSchemaTypeProperties extends SchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - private String dataType = null; - private String fixedValue = null; - - /** - * Default constructor - */ - public LiteralSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also - * likely to be being cloned in the same operation and we want the definitions clone to point to the - * asset clone and not the original asset. - * - * @param template template object to copy. - */ - public LiteralSchemaTypeProperties(LiteralSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - dataType = template.getDataType(); - fixedValue = template.getFixedValue(); - } - } - - - /** - * Return the data type for this element. Null means unknown data type. - * - * @return String data type name - */ - public String getDataType() { return dataType; } - - - /** - * Set up the data type for this element. Null means unknown data type. - * - * @param dataType data type name - */ - public void setDataType(String dataType) - { - this.dataType = dataType; - } - - - /** - * Return the fixed value for the element. Null means fixed value is null. - * - * @return String containing fixed value - */ - public String getFixedValue() { return fixedValue; } - - - /** - * Set up the fixed value for the element. Null means fixed value is null. - * - * @param fixedValue String containing fixed value - */ - public void setFixedValue(String fixedValue) - { - this.fixedValue = fixedValue; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "LiteralSchemaTypeProperties{" + - "dataType='" + dataType + '\'' + - ", fixedValue='" + fixedValue + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - LiteralSchemaTypeProperties that = (LiteralSchemaTypeProperties) objectToCompare; - return Objects.equals(dataType, that.dataType) && - Objects.equals(fixedValue, that.fixedValue); - } - - - /** - * Create a hash code for this element type. - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), dataType, fixedValue); - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/MapSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/MapSchemaTypeProperties.java deleted file mode 100644 index f07aa1b25b1..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/MapSchemaTypeProperties.java +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * MapSchemaTypeProperties describes a schema element of type map. It stores the type of schema element for the domain - * (eg property name) for the map and the schema element for the range (eg property value) for the map. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class MapSchemaTypeProperties extends SchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - private SchemaTypeProperties mapFromElement = null; - private SchemaTypeProperties mapToElement = null; - - - /** - * Default constructor - */ - public MapSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public MapSchemaTypeProperties(MapSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - mapFromElement = template.getMapFromElement(); - mapToElement = template.getMapToElement(); - } - } - - - /** - * Return the type of schema element that represents the key or property name for the map. - * This is also called the domain of the map. - * - * @return SchemaElement - */ - public SchemaTypeProperties getMapFromElement() - { - return mapFromElement; - } - - - /** - * Set up the type of schema element that represents the key or property name for the map. - * This is also called the domain of the map. - * - * @param mapFromElement SchemaElement - */ - public void setMapFromElement(SchemaTypeProperties mapFromElement) - { - this.mapFromElement = mapFromElement; - } - - - /** - * Return the type of schema element that represents the property value for the map. - * This is also called the range of the map. - * - * @return SchemaElement - */ - public SchemaTypeProperties getMapToElement() - { - return mapToElement; - } - - - /** - * Set up the type of schema element that represents the property value for the map. - * This is also called the range of the map. - * - * @param mapToElement SchemaType - */ - public void setMapToElement(SchemaTypeProperties mapToElement) - { - this.mapToElement = mapToElement; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "MapSchemaTypeProperties{" + - "mapFromElement=" + mapFromElement + - ", mapToElement=" + mapToElement + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (!(objectToCompare instanceof MapSchemaTypeProperties)) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - MapSchemaTypeProperties that = (MapSchemaTypeProperties) objectToCompare; - return Objects.equals(getMapFromElement(), that.getMapFromElement()) && - Objects.equals(getMapToElement(), that.getMapToElement()); - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), mapFromElement, mapToElement); - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/PrimitiveSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/PrimitiveSchemaTypeProperties.java deleted file mode 100644 index fef36c37243..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/PrimitiveSchemaTypeProperties.java +++ /dev/null @@ -1,71 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * PrimitiveSchemaTypeProperties carries the specialized parameters for creating or updating primitive schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) - -public class PrimitiveSchemaTypeProperties extends SimpleSchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - /** - * Default constructor - */ - public PrimitiveSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - * - * @param template template object to copy. - */ - public PrimitiveSchemaTypeProperties(PrimitiveSchemaTypeProperties template) - { - super(template); - } - - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "PrimitiveSchemaTypeProperties{" + - "dataType='" + getDataType() + '\'' + - ", defaultValue='" + getDefaultValue() + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaAttributeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaAttributeProperties.java index d0f0a6a9a72..e56c250fbc6 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaAttributeProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaAttributeProperties.java @@ -24,7 +24,6 @@ property = "class") @JsonSubTypes({ @JsonSubTypes.Type(value = SchemaAttributeElement.class, name = "SchemaAttributeElement"), - @JsonSubTypes.Type(value = TabularColumnProperties.class, name = "TabularColumnProperties") }) public class SchemaAttributeProperties extends SchemaElementProperties { diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaTypeChoiceProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaTypeChoiceProperties.java deleted file mode 100644 index a76b30255ee..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaTypeChoiceProperties.java +++ /dev/null @@ -1,147 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * SchemaTypeChoiceProperties carries the specialized parameters for creating or updating a choice of schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class SchemaTypeChoiceProperties extends SchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - private List schemaOptions = null; - - - /** - * Default constructor - */ - public SchemaTypeChoiceProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also - * likely to be being cloned in the same operation and we want the definitions clone to point to the - * asset clone and not the original asset. - * - * @param template template object to copy. - */ - public SchemaTypeChoiceProperties(SchemaTypeChoiceProperties template) - { - super(template); - - if (template != null) - { - schemaOptions = template.getSchemaOptions(); - } - } - - - /** - * Return the list of alternative schema types that this attribute or asset may use. - * - * @return list of schema types - */ - public List getSchemaOptions() - { - if (schemaOptions == null) - { - return null; - } - else if (schemaOptions.isEmpty()) - { - return null; - } - - return schemaOptions; - } - - - /** - * Set up the list of alternative schema types that this attribute or asset may use. - * - * @param schemaOptions list of schema types - */ - public void setSchemaOptions(List schemaOptions) - { - this.schemaOptions = schemaOptions; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - SchemaTypeChoiceProperties that = (SchemaTypeChoiceProperties) objectToCompare; - return Objects.equals(getSchemaOptions(), that.getSchemaOptions()); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaTypeChoiceProperties{" + - "versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), schemaOptions); - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaTypeProperties.java index 795d546db74..68de02ff799 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaTypeProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaTypeProperties.java @@ -17,17 +17,6 @@ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "class") -@JsonSubTypes({ - @JsonSubTypes.Type(value = ComplexSchemaTypeProperties.class, name = "ComplexSchemaTypeProperties"), - @JsonSubTypes.Type(value = LiteralSchemaTypeProperties.class, name = "LiteralSchemaTypeProperties"), - @JsonSubTypes.Type(value = SimpleSchemaTypeProperties.class, name = "SimpleSchemaTypeProperties"), - @JsonSubTypes.Type(value = SchemaTypeChoiceProperties.class, name = "SchemaTypeChoiceProperties"), - @JsonSubTypes.Type(value = MapSchemaTypeProperties.class, name = "MapSchemaTypeProperties"), - }) public class SchemaTypeProperties extends SchemaElementProperties { private static final long serialVersionUID = 1L; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SecurityTagsProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SecurityTagsProperties.java index a0e57caea84..ea5d161f628 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SecurityTagsProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SecurityTagsProperties.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import java.io.Serializable; import java.util.*; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; @@ -20,7 +19,7 @@ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) -public class SecurityTagsProperties implements Serializable +public class SecurityTagsProperties { private List securityLabels = null; private Map securityProperties = null; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SimpleSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SimpleSchemaTypeProperties.java deleted file mode 100644 index 44d9be1d818..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SimpleSchemaTypeProperties.java +++ /dev/null @@ -1,163 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.*; - -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * SimpleSchemaTypeProperties carries the common parameters for creating or updating primitive and enum schema types. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "class") -@JsonSubTypes({ - @JsonSubTypes.Type(value = PrimitiveSchemaTypeProperties.class, name = "PrimitiveSchemaTypeProperties"), - @JsonSubTypes.Type(value = EnumSchemaTypeProperties.class, name = "EnumSchemaTypeProperties"), - @JsonSubTypes.Type(value = ExternalSchemaTypeProperties.class, name = "ExternalSchemaTypeProperties"), -}) -public class SimpleSchemaTypeProperties extends SchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - private String dataType = null; - private String defaultValue = null; - - /** - * Default constructor - */ - public SimpleSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also - * likely to be being cloned in the same operation and we want the definitions clone to point to the - * asset clone and not the original asset. - * - * @param template template object to copy. - */ - public SimpleSchemaTypeProperties(SimpleSchemaTypeProperties template) - { - super(template); - - if (template != null) - { - dataType = template.getDataType(); - defaultValue = template.getDefaultValue(); - } - } - - - /** - * Return the data type for this element. Null means unknown data type. - * - * @return String data type name - */ - public String getDataType() { return dataType; } - - - /** - * Set up the data type for this element. Null means unknown data type. - * - * @param dataType data type name - */ - public void setDataType(String dataType) - { - this.dataType = dataType; - } - - - /** - * Return the default value for the element. Null means no default value set up. - * - * @return String containing default value - */ - public String getDefaultValue() { return defaultValue; } - - - /** - * Set up the default value for the element. Null means no default value set up. - * - * @param defaultValue String containing default value - */ - public void setDefaultValue(String defaultValue) - { - this.defaultValue = defaultValue; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - SimpleSchemaTypeProperties that = (SimpleSchemaTypeProperties) objectToCompare; - return Objects.equals(dataType, that.dataType) && - Objects.equals(defaultValue, that.defaultValue); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SimpleSchemaTypeProperties{" + - "dataType='" + dataType + '\'' + - ", defaultValue='" + defaultValue + '\'' + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } - - - /** - * Return hash code for this object - * - * @return int hash code - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), dataType, defaultValue); - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructDocumentTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructDocumentTypeProperties.java deleted file mode 100644 index 1353071cba2..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructDocumentTypeProperties.java +++ /dev/null @@ -1,70 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * StructDocumentTypeProperties is a specific type of bean for a do a nested structure in a hierarchical document structure such - * as an XML document. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class StructDocumentTypeProperties extends StructSchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - - /** - * Default constructor used by subclasses - */ - public StructDocumentTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public StructDocumentTypeProperties(StructDocumentTypeProperties template) - { - super(template); - } - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "StructDocumentTypeProperties{" + - "attributeCount=" + getAttributeCount() + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructSchemaTypeProperties.java deleted file mode 100644 index a79106559ac..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructSchemaTypeProperties.java +++ /dev/null @@ -1,75 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.*; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * StructSchemaTypeProperties is a specific type of bean for a structure. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "class") -@JsonSubTypes({ - @JsonSubTypes.Type(value = StructDocumentTypeProperties.class, name = "StructDocumentTypeProperties") - }) -public class StructSchemaTypeProperties extends ComplexSchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - - /** - * Default constructor used by subclasses - */ - public StructSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public StructSchemaTypeProperties(StructSchemaTypeProperties template) - { - super(template); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "StructSchemaTypeProperties{" + - "attributeCount=" + getAttributeCount() + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularColumnProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularColumnProperties.java deleted file mode 100644 index 1b5f2834b29..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularColumnProperties.java +++ /dev/null @@ -1,75 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * A TabularColumnProperties defines a column in a simple table. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class TabularColumnProperties extends SchemaAttributeProperties -{ - private static final long serialVersionUID = 1L; - - - /** - * Default constructor - */ - public TabularColumnProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public TabularColumnProperties(TabularColumnProperties template) - { - super(template); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "TabularColumnProperties{" + - ", elementPosition=" + getElementPosition() + - ", minCardinality=" + getMinCardinality() + - ", maxCardinality=" + getMaxCardinality() + - ", allowsDuplicateValues=" + getAllowsDuplicateValues() + - ", orderedValues=" + getOrderedValues() + - ", sortOrder=" + getSortOrder() + - ", minimumLength=" + getMinimumLength() + - ", length=" + getLength() + - ", significantDigits=" + getPrecision() + - ", nullable=" + getIsNullable() + - ", defaultValueOverride='" + getDefaultValueOverride() + '\'' + - ", attributeType=" + getAttributeType() + - ", attributeRelationships=" + getAttributeRelationships() + - ", nativeJavaClass='" + getNativeJavaClass() + '\'' + - ", aliases=" + getAliases() + - ", deprecated=" + getIsDeprecated() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularSchemaTypeProperties.java deleted file mode 100644 index f3f47ca4764..00000000000 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularSchemaTypeProperties.java +++ /dev/null @@ -1,70 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.assetowner.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * TabularSchemaTypeProperties is a specific type of bean for a simple table. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class TabularSchemaTypeProperties extends ComplexSchemaTypeProperties -{ - private static final long serialVersionUID = 1L; - - - /** - * Default constructor used by subclasses - */ - public TabularSchemaTypeProperties() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public TabularSchemaTypeProperties(TabularSchemaTypeProperties template) - { - super(template); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "TabularSchemaTypeProperties{" + - "attributeCount=" + getAttributeCount() + - ", versionNumber='" + getVersionNumber() + '\'' + - ", author='" + getAuthor() + '\'' + - ", usage='" + getUsage() + '\'' + - ", encodingStandard='" + getEncodingStandard() + '\'' + - ", namespace='" + getNamespace() + '\'' + - ", formula='" + getFormula() + '\'' + - ", queries=" + getQueries() + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", deprecated=" + getIsDeprecated() + - ", typeName='" + getTypeName() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - ", extendedProperties=" + getExtendedProperties() + - '}'; - } -} diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/converters/SchemaTypeConverter.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/converters/SchemaTypeConverter.java index 4a80361a612..0309b8024d3 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/converters/SchemaTypeConverter.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/converters/SchemaTypeConverter.java @@ -44,7 +44,7 @@ public SchemaTypeConverter(OMRSRepositoryHelper repositoryHelper, * @param beanClass name of the class to create * @param schemaRootHeader header of the schema element that holds the root information * @param schemaTypeTypeName name of type of the schema type to create - * @param instanceProperties properties describing the schema type + * @param schemaRootProperties properties describing the schema type * @param schemaRootClassifications classifications from the schema root entity * @param attributeCount number of attributes (for a complex schema type) * @param validValueSetGUID unique identifier of the set of valid values (for an enum schema type) @@ -56,7 +56,7 @@ public SchemaTypeConverter(OMRSRepositoryHelper repositoryHelper, * @param mapToSchemaType bean containing the properties of the schema type that is part of a map definition * @param schemaTypeOptionGUIDs list of unique identifiers for schema types that could be the type for this attribute * @param schemaTypeOptions list of schema types that could be the type for this attribute - * @param queryTargets list of relationships to schema types that contain data values used to derive the schema type value(s) + * @param queryTargetRelationships list of relationships to schema types that contain data values used to derive the schema type value(s) * @param methodName calling method * @return bean populated with properties from the instances supplied * @throws PropertyServerException there is a problem instantiating the bean @@ -65,7 +65,7 @@ public SchemaTypeConverter(OMRSRepositoryHelper repositoryHelper, public B getNewSchemaTypeBean(Class beanClass, InstanceHeader schemaRootHeader, String schemaTypeTypeName, - InstanceProperties instanceProperties, + InstanceProperties schemaRootProperties, List schemaRootClassifications, int attributeCount, String validValueSetGUID, @@ -77,7 +77,7 @@ public B getNewSchemaTypeBean(Class beanClass, B mapToSchemaType, List schemaTypeOptionGUIDs, List schemaTypeOptions, - List queryTargets, + List queryTargetRelationships, String methodName) throws PropertyServerException { try @@ -89,27 +89,93 @@ public B getNewSchemaTypeBean(Class beanClass, if (returnBean instanceof SchemaTypeElement) { - if ((schemaRootHeader != null) && (instanceProperties != null)) + if ((schemaRootHeader != null) && (schemaRootProperties != null)) { - /* - * The schema type has different subtypes. - * This next piece of logic sorts out which type of schema bean to create. - */ SchemaTypeElement bean = (SchemaTypeElement)returnBean; bean.setElementHeader(this.getMetadataElementHeader(beanClass, schemaRootHeader, schemaRootClassifications, methodName)); - bean.setSchemaTypeProperties(this.getSchemaTypeProperties(beanClass, - schemaTypeTypeName, - instanceProperties, - schemaRootClassifications, - attributeCount, - validValueSetGUID, - externalSchemaTypeGUID, - externalSchemaType, - mapFromSchemaType, - mapToSchemaType, - schemaTypeOptions, - methodName)); + + /* + * Set up schema properties to create. + */ + InstanceProperties instanceProperties = new InstanceProperties(schemaRootProperties); + SchemaTypeProperties schemaTypeProperties = new SchemaTypeProperties(); + + schemaTypeProperties.setQualifiedName(this.removeQualifiedName(instanceProperties)); + schemaTypeProperties.setDisplayName(this.removeDisplayName(instanceProperties)); + schemaTypeProperties.setDescription(this.removeDescription(instanceProperties)); + schemaTypeProperties.setIsDeprecated(this.removeIsDeprecated(instanceProperties)); + schemaTypeProperties.setVersionNumber(this.removeVersionNumber(instanceProperties)); + schemaTypeProperties.setAuthor(this.removeAuthor(instanceProperties)); + schemaTypeProperties.setUsage(this.removeUsage(instanceProperties)); + schemaTypeProperties.setEncodingStandard(this.removeEncodingStandard(instanceProperties)); + schemaTypeProperties.setNamespace(this.removeNamespace(instanceProperties)); + schemaTypeProperties.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties)); + + /* + * Any remaining properties are returned in the extended properties. They are + * assumed to be defined in a subtype. + */ + schemaTypeProperties.setExtendedProperties(this.getRemainingExtendedProperties(instanceProperties)); + + bean.setSchemaTypeProperties(schemaTypeProperties); + + bean.setAttributeCount(attributeCount); + bean.setMapFromElement((SchemaTypeElement)mapFromSchemaType); + bean.setMapToElement((SchemaTypeElement)mapToSchemaType); + bean.setExternalSchemaType((SchemaTypeElement)externalSchemaType); + + if ((schemaTypeOptions != null) && (! schemaTypeOptions.isEmpty())) + { + List schemaTypeOptionBeans = new ArrayList<>(); + + for (B optionBean : schemaTypeOptions) + { + if (optionBean != null) + { + schemaTypeOptionBeans.add((SchemaTypeElement) optionBean); + } + } + + if (! schemaTypeOptionBeans.isEmpty()) + { + bean.setSchemaOptions(schemaTypeOptionBeans); + } + } + + InstanceProperties classificationProperties = + super.getClassificationProperties(OpenMetadataAPIMapper.CALCULATED_VALUE_CLASSIFICATION_TYPE_NAME, + schemaRootClassifications); + + bean.setFormula(this.getFormula(classificationProperties)); + bean.setFormulaType(this.getFormulaType(classificationProperties)); + + if (queryTargetRelationships != null) + { + List queryTargets = new ArrayList<>(); + + for (Relationship relationship : queryTargetRelationships) + { + if ((relationship != null) && (relationship.getEntityTwoProxy() != null)) + { + DerivedSchemaTypeQueryTargetProperties queryTargetProperties = new DerivedSchemaTypeQueryTargetProperties(); + + queryTargetProperties.setQueryId(this.getQueryId(relationship.getProperties())); + queryTargetProperties.setQuery(this.getQuery(relationship.getProperties())); + queryTargetProperties.setQueryTargetGUID(relationship.getEntityTwoProxy().getGUID()); + + queryTargets.add(queryTargetProperties); + } + else + { + handleBadRelationship(beanClass.getName(), relationship, methodName); + } + } + if (! queryTargets.isEmpty()) + { + bean.setQueries(queryTargets); + } + } return returnBean; } @@ -126,348 +192,4 @@ public B getNewSchemaTypeBean(Class beanClass, return null; } - - - /** - * Return the converted bean. This is a special method used for schema types since they are stored - * as a collection of instances. - * - * @param beanClass name of the class to create - * @param schemaTypeTypeName name of type of the schema type to create - * @param instanceProperties properties describing the schema type - * @param attributeCount number of attributes (for a complex schema type) - * @param validValueSetGUID unique identifier of the set of valid values (for an enum schema type) - * @param externalSchemaTypeGUID unique identifier of the external schema type - * @param externalSchemaType bean containing the properties of the schema type that is shared by multiple attributes/assets - * @param mapFromSchemaType bean containing the properties of the schema type that is part of a map definition - * @param mapToSchemaType bean containing the properties of the schema type that is part of a map definition - * @param schemaTypeOptions list of schema types that could be the type for this attribute - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - private SchemaTypeProperties getSchemaTypeProperties(Class beanClass, - String schemaTypeTypeName, - InstanceProperties instanceProperties, - List schemaRootClassifications, - int attributeCount, - String validValueSetGUID, - String externalSchemaTypeGUID, - B externalSchemaType, - B mapFromSchemaType, - B mapToSchemaType, - List schemaTypeOptions, - String methodName) throws PropertyServerException - { - SchemaTypeProperties returnBean = null; - - /* - * The schema type has different subtypes. - * This next piece of logic sorts out which type of schema bean to create. - */ - - if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.PRIMITIVE_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getPrimitiveSchemaType(instanceProperties); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.LITERAL_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getLiteralSchemaType(instanceProperties); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.COMPLEX_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getComplexSchemaType(instanceProperties, attributeCount); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.LITERAL_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getEnumSchemaType(instanceProperties, validValueSetGUID); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.MAP_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getMapSchemaType(instanceProperties, mapFromSchemaType, mapToSchemaType); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_NAME)) - { - returnBean = this.getSchemaTypeChoice(instanceProperties, schemaTypeOptions); - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeTypeName, OpenMetadataAPIMapper.EXTERNAL_SCHEMA_TYPE_TYPE_NAME)) - { - returnBean = this.getExternalSchemaType(instanceProperties, externalSchemaTypeGUID, externalSchemaType); - } - else - { - /* - * This will throw an exception - */ - super.validateInstanceType(OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, - beanClass.getName(), - schemaTypeTypeName, - methodName); - } - - if (returnBean != null) - { - InstanceProperties classificationProperties = - super.getClassificationProperties(OpenMetadataAPIMapper.CALCULATED_VALUE_CLASSIFICATION_TYPE_NAME, - schemaRootClassifications); - - returnBean.setFormula(this.getFormula(classificationProperties)); - returnBean.setFormulaType(this.getFormulaType(classificationProperties)); - } - - return returnBean; - } - - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getLiteralSchemaType(InstanceProperties instanceProperties) - { - LiteralSchemaTypeProperties schemaType = new LiteralSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setDataType(this.removeDataType(propertiesCopy)); - schemaType.setFixedValue(this.removeFixedValue(propertiesCopy)); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getPrimitiveSchemaType(InstanceProperties instanceProperties) - { - PrimitiveSchemaTypeProperties schemaType = new PrimitiveSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setDataType(this.removeDataType(propertiesCopy)); - schemaType.setDefaultValue(this.removeDefaultValue(propertiesCopy)); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param attributeCount number of attributes (for a complex schema type) - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getComplexSchemaType(InstanceProperties instanceProperties, - int attributeCount) - { - ComplexSchemaTypeProperties schemaType = new ComplexSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setAttributeCount(attributeCount); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param validValueSetGUID unique identifier of the set of valid values (for an enum schema type) - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getEnumSchemaType(InstanceProperties instanceProperties, - String validValueSetGUID) - { - EnumSchemaTypeProperties schemaType = new EnumSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - schemaType.setDataType(this.removeDataType(propertiesCopy)); - schemaType.setDefaultValue(this.removeDefaultValue(propertiesCopy)); - schemaType.setValidValueSetGUID(validValueSetGUID); - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param schemaTypeOptions list of schema types that could be the type for this attribute - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getSchemaTypeChoice(InstanceProperties instanceProperties, - List schemaTypeOptions) - { - SchemaTypeChoiceProperties schemaType = new SchemaTypeChoiceProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - if ((schemaTypeOptions != null) && (! schemaTypeOptions.isEmpty())) - { - List schemaTypeOptionBeans = new ArrayList<>(); - - for (B optionBean : schemaTypeOptions) - { - if (optionBean != null) - { - schemaTypeOptionBeans.add((SchemaTypeProperties) optionBean); - } - } - - if (! schemaTypeOptionBeans.isEmpty()) - { - schemaType.setSchemaOptions(schemaTypeOptionBeans); - } - - } - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param externalSchemaTypeGUID unique identifier of the external schema type - * @param externalSchemaType bean containing the properties of the schema type that is shared by multiple attributes/assets - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getExternalSchemaType(InstanceProperties instanceProperties, - String externalSchemaTypeGUID, - B externalSchemaType) - { - ExternalSchemaTypeProperties schemaType = new ExternalSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - if (externalSchemaType != null) - { - schemaType.setExternalSchemaTypeGUID(externalSchemaTypeGUID); - schemaType.setExternalSchemaType((SchemaTypeProperties)externalSchemaType); - } - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Return the converted bean. - * - * @param instanceProperties properties describing the schema type - * @param mapFromSchemaType bean containing the properties of the schema type that is part of a map definition - * @param mapToSchemaType bean containing the properties of the schema type that is part of a map definition - * @return bean populated with properties from the instance properties supplied - */ - private SchemaTypeProperties getMapSchemaType(InstanceProperties instanceProperties, - B mapFromSchemaType, - B mapToSchemaType) - { - MapSchemaTypeProperties schemaType = new MapSchemaTypeProperties(); - - InstanceProperties propertiesCopy = new InstanceProperties(instanceProperties); - - updateBasicSchemaTypeProperties(schemaType, propertiesCopy); - - if (mapFromSchemaType != null) - { - schemaType.setMapFromElement((SchemaTypeProperties) mapFromSchemaType); - } - - if (mapToSchemaType != null) - { - schemaType.setMapFromElement((SchemaTypeProperties) mapFromSchemaType); - } - - /* - * Any remaining properties are returned in the extended properties. They are - * assumed to be defined in a subtype. - */ - schemaType.setExtendedProperties(this.getRemainingExtendedProperties(propertiesCopy)); - - return schemaType; - } - - - /** - * Set up the properties found in every schema type. - * - * @param bean bean to fill - * @param instanceProperties properties from the entity - */ - private void updateBasicSchemaTypeProperties(SchemaTypeProperties bean, - InstanceProperties instanceProperties) - { - bean.setQualifiedName(this.removeQualifiedName(instanceProperties)); - bean.setDisplayName(this.removeDisplayName(instanceProperties)); - bean.setDescription(this.removeDescription(instanceProperties)); - bean.setIsDeprecated(this.removeIsDeprecated(instanceProperties)); - bean.setVersionNumber(this.removeVersionNumber(instanceProperties)); - bean.setAuthor(this.removeAuthor(instanceProperties)); - bean.setUsage(this.removeUsage(instanceProperties)); - bean.setEncodingStandard(this.removeEncodingStandard(instanceProperties)); - bean.setNamespace(this.removeNamespace(instanceProperties)); - bean.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties)); - } } diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/server/AssetOwnerRESTServices.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/server/AssetOwnerRESTServices.java index aea5b77184d..6cf5d250909 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/server/AssetOwnerRESTServices.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-server/src/main/java/org/odpi/openmetadata/accessservices/assetowner/server/AssetOwnerRESTServices.java @@ -714,87 +714,6 @@ private SchemaTypeBuilder getSchemaTypeBuilder(SchemaTypeProperties schemaType, serviceName, serverName); - if (schemaType instanceof LiteralSchemaTypeProperties) - { - LiteralSchemaTypeProperties literalSchemaTypeProperties = (LiteralSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setDataType(literalSchemaTypeProperties.getDataType()); - schemaTypeBuilder.setFixedValue(literalSchemaTypeProperties.getFixedValue()); - } - else if (schemaType instanceof SimpleSchemaTypeProperties) - { - SimpleSchemaTypeProperties simpleSchemaTypeProperties = (SimpleSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setDataType(simpleSchemaTypeProperties.getDataType()); - schemaTypeBuilder.setDefaultValue(simpleSchemaTypeProperties.getDefaultValue()); - - if (schemaType instanceof EnumSchemaTypeProperties) - { - EnumSchemaTypeProperties enumSchemaTypeProperties = (EnumSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setValidValuesSetGUID(enumSchemaTypeProperties.getValidValueSetGUID()); - } - else if (schemaType instanceof ExternalSchemaTypeProperties) - { - ExternalSchemaTypeProperties externalSchemaTypeProperties = (ExternalSchemaTypeProperties)schemaType; - - schemaTypeBuilder.setExternalSchemaTypeGUID(externalSchemaTypeProperties.getExternalSchemaTypeGUID()); - } - } - else if (schemaType instanceof SchemaTypeChoiceProperties) - { - SchemaTypeChoiceProperties schemaTypeChoiceProperties = (SchemaTypeChoiceProperties)schemaType; - - if (schemaTypeChoiceProperties.getSchemaOptions() != null) - { - List schemaOptionBuilders = new ArrayList<>(); - - for (SchemaTypeProperties schemaOption : schemaTypeChoiceProperties.getSchemaOptions()) - { - if (schemaOption != null) - { - schemaOptionBuilders.add(this.getSchemaTypeBuilder(schemaOption, - repositoryHelper, - serviceName, - serverName, - methodName)); - } - } - - if (! schemaOptionBuilders.isEmpty()) - { - schemaTypeBuilder.setSchemaOptions(schemaOptionBuilders); - } - } - } - else if (schemaType instanceof MapSchemaTypeProperties) - { - MapSchemaTypeProperties mapSchemaTypeProperties = (MapSchemaTypeProperties)schemaType; - - SchemaTypeBuilder mapFromBuilder = null; - SchemaTypeBuilder mapToBuilder = null; - - if (mapSchemaTypeProperties.getMapFromElement() != null) - { - mapFromBuilder = this.getSchemaTypeBuilder(mapSchemaTypeProperties.getMapFromElement(), - repositoryHelper, - serviceName, - serverName, - methodName); - } - - if (mapSchemaTypeProperties.getMapToElement() != null) - { - mapToBuilder = this.getSchemaTypeBuilder(mapSchemaTypeProperties.getMapToElement(), - repositoryHelper, - serviceName, - serverName, - methodName); - } - - schemaTypeBuilder.setMapTypes(mapFromBuilder, mapToBuilder); - } - return schemaTypeBuilder; } diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/SchemaTypeElement.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/SchemaTypeElement.java index 8403c3fdec4..8a455dc0ce6 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/SchemaTypeElement.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/SchemaTypeElement.java @@ -9,7 +9,6 @@ import org.odpi.openmetadata.accessservices.datamanager.properties.DerivedSchemaTypeQueryTargetProperties; import org.odpi.openmetadata.accessservices.datamanager.properties.SchemaTypeProperties; -import java.io.Serializable; import java.util.List; import java.util.Objects; @@ -23,10 +22,8 @@ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) -public class SchemaTypeElement implements MetadataElement, Serializable +public class SchemaTypeElement implements MetadataElement { - private static final long serialVersionUID = 1L; - private SchemaTypeProperties schemaTypeProperties = null; private ElementHeader elementHeader = null; diff --git a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigStoreResource.java b/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigStoreResource.java index 0c5ce67c3a0..b2ed333572c 100644 --- a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigStoreResource.java +++ b/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigStoreResource.java @@ -18,10 +18,10 @@ @RestController @RequestMapping("/open-metadata/admin-services/users/{userId}/stores") -@Tag(name="Administration Services - Platform Configuration", description="The platform configuration administration services support the " + - "configuration of the security and configuration store connectors for an OMAG Server Platform.", +@Tag(name="Administration Services - Configuration Document Store Configuration", + description="Dynamically change the connector that accesses the configuration document store. This overrides the value set in the application.properties (which overrides the default Encrypted File Configuration Document Store).", externalDocs=@ExternalDocumentation(description="Further information", - url="https://egeria-project.org/guides/admin/servers/")) + url="https://egeria-project.org/services/admin-services/overview/#dynamically-configuring-the-configuration-document-store-connector")) public class ConfigStoreResource { diff --git a/open-metadata-implementation/common-services/ffdc-services/src/main/java/org/odpi/openmetadata/commonservices/ffdc/rest/FFDCRESTClient.java b/open-metadata-implementation/common-services/ffdc-services/src/main/java/org/odpi/openmetadata/commonservices/ffdc/rest/FFDCRESTClient.java index f0cd4019bcf..0dca5cb7990 100644 --- a/open-metadata-implementation/common-services/ffdc-services/src/main/java/org/odpi/openmetadata/commonservices/ffdc/rest/FFDCRESTClient.java +++ b/open-metadata-implementation/common-services/ffdc-services/src/main/java/org/odpi/openmetadata/commonservices/ffdc/rest/FFDCRESTClient.java @@ -280,6 +280,35 @@ public VoidResponse callVoidGetRESTCall(String methodName, } + /** + * Issue a POST REST call that returns a BooleanResponse object. + * + * @param methodName name of the method being called. + * @param urlTemplate template of the URL for the REST API with place-holders for the parameters. + * @param params a list of parameters that are slotted into the url template. + * + * @return response object + * @throws InvalidParameterException one of the parameters is invalid. + * @throws UserNotAuthorizedException the user is not authorized to make this request. + * @throws PropertyServerException something went wrong with the REST call stack. + */ + public BooleanResponse callBooleanGetRESTCall(String methodName, + String urlTemplate, + Object... params) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + BooleanResponse restResult = this.callGetRESTCall(methodName, + BooleanResponse.class, + urlTemplate, + params); + + exceptionHandler.detectAndThrowStandardExceptions(methodName, restResult); + + return restResult; + } + + /** * Issue a POST REST call that returns a VoidResponse object. This is typically a create * diff --git a/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/OpenMetadataAPIGenericHandler.java b/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/OpenMetadataAPIGenericHandler.java index 702a1930642..4fb31e10f23 100644 --- a/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/OpenMetadataAPIGenericHandler.java +++ b/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/OpenMetadataAPIGenericHandler.java @@ -7835,6 +7835,23 @@ public void deleteBeanInRepository(String userId, serviceName, methodName); } + else if (repositoryHelper.isTypeOf(serviceName, startingEntity.getType().getTypeDefName(), OpenMetadataAPIMapper.GLOSSARY_TYPE_NAME)) + { + securityVerifier.validateUserForGlossaryDelete(userId, + startingEntity, + repositoryHelper, + serviceName, + methodName); + } + else if ((repositoryHelper.isTypeOf(serviceName, startingEntity.getType().getTypeDefName(), OpenMetadataAPIMapper.GLOSSARY_TERM_TYPE_NAME)) || + (repositoryHelper.isTypeOf(serviceName, startingEntity.getType().getTypeDefName(), OpenMetadataAPIMapper.GLOSSARY_CATEGORY_TYPE_NAME))) + { + securityVerifier.validateUserForGlossaryMemberUpdate(userId, + startingEntity, + repositoryHelper, + serviceName, + methodName); + } /* * Retrieve the entities attached to this element. Any entity that is anchored, directly or indirectly, to the anchor entity is deleted. diff --git a/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/SchemaElementHandler.java b/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/SchemaElementHandler.java index 3d4c2815fe0..7700ca41bce 100644 --- a/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/SchemaElementHandler.java +++ b/open-metadata-implementation/common-services/generic-handlers/src/main/java/org/odpi/openmetadata/commonservices/generichandlers/SchemaElementHandler.java @@ -255,162 +255,165 @@ void addEmbeddedTypes(String userId, final String externalParameterName = "externalSchemaType"; final String optionParameterName = "optionSchemaType"; - if (repositoryHelper.isTypeOf(serviceName, schemaTypeBuilder.getTypeName(), OpenMetadataAPIMapper.EXTERNAL_SCHEMA_TYPE_TYPE_NAME)) + if (schemaTypeBuilder != null) { - String externalSchemaGUID = schemaTypeBuilder.getExternalSchemaTypeGUID(); - - if (externalSchemaGUID != null) + if (repositoryHelper.isTypeOf(serviceName, schemaTypeBuilder.getTypeName(), OpenMetadataAPIMapper.EXTERNAL_SCHEMA_TYPE_TYPE_NAME)) { - this.linkElementToElement(userId, - externalSourceGUID, - externalSourceName, - schemaTypeGUID, - schemaTypeGUIDParameterName, - schemaTypeTypeName, - externalSchemaGUID, - externalParameterName, - OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, - forLineage, - forDuplicateProcessing, - supportedZones, - OpenMetadataAPIMapper.LINKED_EXTERNAL_SCHEMA_TYPE_RELATIONSHIP_TYPE_GUID, - OpenMetadataAPIMapper.LINKED_EXTERNAL_SCHEMA_TYPE_RELATIONSHIP_TYPE_NAME, - null, - effectiveFrom, - effectiveTo, - effectiveTime, - methodName); - } - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeBuilder.getTypeName(), OpenMetadataAPIMapper.MAP_SCHEMA_TYPE_TYPE_NAME)) - { - /* - * The caller may have set up the maps as builders (requiring the schema type to be created first) or as GUIDs. - */ - SchemaTypeBuilder mapFromBuilder = schemaTypeBuilder.getMapFrom(); - SchemaTypeBuilder mapToBuilder = schemaTypeBuilder.getMapTo(); - String mapFromGUID = schemaTypeBuilder.getMapFromGUID(); - String mapToGUID = schemaTypeBuilder.getMapToGUID(); + String externalSchemaGUID = schemaTypeBuilder.getExternalSchemaTypeGUID(); - if (mapFromBuilder != null) - { - mapFromGUID = addSchemaType(userId, - externalSourceGUID, - externalSourceName, - mapFromBuilder.qualifiedName, - mapFromBuilder, - effectiveFrom, - effectiveTo, - forLineage, - forDuplicateProcessing, - effectiveTime, - methodName); + if (externalSchemaGUID != null) + { + this.linkElementToElement(userId, + externalSourceGUID, + externalSourceName, + schemaTypeGUID, + schemaTypeGUIDParameterName, + schemaTypeTypeName, + externalSchemaGUID, + externalParameterName, + OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, + forLineage, + forDuplicateProcessing, + supportedZones, + OpenMetadataAPIMapper.LINKED_EXTERNAL_SCHEMA_TYPE_RELATIONSHIP_TYPE_GUID, + OpenMetadataAPIMapper.LINKED_EXTERNAL_SCHEMA_TYPE_RELATIONSHIP_TYPE_NAME, + null, + effectiveFrom, + effectiveTo, + effectiveTime, + methodName); + } } - - if (mapFromGUID != null) + else if (repositoryHelper.isTypeOf(serviceName, schemaTypeBuilder.getTypeName(), OpenMetadataAPIMapper.MAP_SCHEMA_TYPE_TYPE_NAME)) { - this.linkElementToElement(userId, - externalSourceGUID, - externalSourceName, - schemaTypeGUID, - schemaTypeGUIDParameterName, - schemaTypeTypeName, - mapFromGUID, - mapFromParameterName, - OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, - forLineage, - forDuplicateProcessing, - supportedZones, - OpenMetadataAPIMapper.MAP_FROM_RELATIONSHIP_TYPE_GUID, - OpenMetadataAPIMapper.MAP_FROM_RELATIONSHIP_TYPE_NAME, - null, - effectiveFrom, - effectiveTo, - effectiveTime, - methodName); - } + /* + * The caller may have set up the maps as builders (requiring the schema type to be created first) or as GUIDs. + */ + SchemaTypeBuilder mapFromBuilder = schemaTypeBuilder.getMapFrom(); + SchemaTypeBuilder mapToBuilder = schemaTypeBuilder.getMapTo(); + String mapFromGUID = schemaTypeBuilder.getMapFromGUID(); + String mapToGUID = schemaTypeBuilder.getMapToGUID(); + + if (mapFromBuilder != null) + { + mapFromGUID = addSchemaType(userId, + externalSourceGUID, + externalSourceName, + mapFromBuilder.qualifiedName, + mapFromBuilder, + effectiveFrom, + effectiveTo, + forLineage, + forDuplicateProcessing, + effectiveTime, + methodName); + } - if (mapToBuilder != null) - { - mapToGUID = addSchemaType(userId, - externalSourceGUID, - externalSourceName, - mapToBuilder.qualifiedName, - mapToBuilder, - effectiveFrom, - effectiveTo, - forLineage, - forDuplicateProcessing, - effectiveTime, - methodName); - } + if (mapFromGUID != null) + { + this.linkElementToElement(userId, + externalSourceGUID, + externalSourceName, + schemaTypeGUID, + schemaTypeGUIDParameterName, + schemaTypeTypeName, + mapFromGUID, + mapFromParameterName, + OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, + forLineage, + forDuplicateProcessing, + supportedZones, + OpenMetadataAPIMapper.MAP_FROM_RELATIONSHIP_TYPE_GUID, + OpenMetadataAPIMapper.MAP_FROM_RELATIONSHIP_TYPE_NAME, + null, + effectiveFrom, + effectiveTo, + effectiveTime, + methodName); + } - if (mapToGUID != null) - { - this.linkElementToElement(userId, - externalSourceGUID, - externalSourceName, - schemaTypeGUID, - schemaTypeGUIDParameterName, - schemaTypeTypeName, - mapToGUID, - mapToParameterName, - OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, - forLineage, - forDuplicateProcessing, - supportedZones, - OpenMetadataAPIMapper.MAP_TO_RELATIONSHIP_TYPE_GUID, - OpenMetadataAPIMapper.MAP_TO_RELATIONSHIP_TYPE_NAME, - null, - effectiveFrom, - effectiveTo, - effectiveTime, - methodName); - } - } - else if (repositoryHelper.isTypeOf(serviceName, schemaTypeBuilder.getTypeName(), OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_NAME)) - { - List schemaOptionBuilders = schemaTypeBuilder.getSchemaOptions(); + if (mapToBuilder != null) + { + mapToGUID = addSchemaType(userId, + externalSourceGUID, + externalSourceName, + mapToBuilder.qualifiedName, + mapToBuilder, + effectiveFrom, + effectiveTo, + forLineage, + forDuplicateProcessing, + effectiveTime, + methodName); + } - if (schemaOptionBuilders != null) + if (mapToGUID != null) + { + this.linkElementToElement(userId, + externalSourceGUID, + externalSourceName, + schemaTypeGUID, + schemaTypeGUIDParameterName, + schemaTypeTypeName, + mapToGUID, + mapToParameterName, + OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, + forLineage, + forDuplicateProcessing, + supportedZones, + OpenMetadataAPIMapper.MAP_TO_RELATIONSHIP_TYPE_GUID, + OpenMetadataAPIMapper.MAP_TO_RELATIONSHIP_TYPE_NAME, + null, + effectiveFrom, + effectiveTo, + effectiveTime, + methodName); + } + } + else if (repositoryHelper.isTypeOf(serviceName, schemaTypeBuilder.getTypeName(), OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_NAME)) { - for (SchemaTypeBuilder schemaOptionBuilder : schemaOptionBuilders) + List schemaOptionBuilders = schemaTypeBuilder.getSchemaOptions(); + + if (schemaOptionBuilders != null) { - if (schemaOptionBuilder != null) + for (SchemaTypeBuilder schemaOptionBuilder : schemaOptionBuilders) { - String optionGUID = addSchemaType(userId, + if (schemaOptionBuilder != null) + { + String optionGUID = addSchemaType(userId, + externalSourceGUID, + externalSourceName, + schemaOptionBuilder.qualifiedName, + schemaOptionBuilder, + effectiveFrom, + effectiveTo, + forLineage, + forDuplicateProcessing, + effectiveTime, + methodName); + + if (optionGUID != null) + { + this.linkElementToElement(userId, externalSourceGUID, externalSourceName, - schemaOptionBuilder.qualifiedName, - schemaOptionBuilder, - effectiveFrom, - effectiveTo, + schemaTypeGUID, + schemaTypeGUIDParameterName, + schemaTypeTypeName, + optionGUID, + optionParameterName, + OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, forLineage, forDuplicateProcessing, + supportedZones, + OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_GUID, + OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_NAME, + null, + effectiveFrom, + effectiveTo, effectiveTime, methodName); - - if (optionGUID != null) - { - this.linkElementToElement(userId, - externalSourceGUID, - externalSourceName, - schemaTypeGUID, - schemaTypeGUIDParameterName, - schemaTypeTypeName, - optionGUID, - optionParameterName, - OpenMetadataAPIMapper.SCHEMA_TYPE_TYPE_NAME, - forLineage, - forDuplicateProcessing, - supportedZones, - OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_GUID, - OpenMetadataAPIMapper.SCHEMA_TYPE_CHOICE_TYPE_NAME, - null, - effectiveFrom, - effectiveTo, - effectiveTime, - methodName); + } } } } diff --git a/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceAuditCode.java b/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceAuditCode.java index 735ceddb1ec..40b1e20cce1 100644 --- a/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceAuditCode.java +++ b/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceAuditCode.java @@ -22,6 +22,9 @@ */ public enum OMAGServerInstanceAuditCode implements AuditLogMessageSet { + /** + * OMAG-MULTI-TENANT-0001 - Method {0} called on behalf of the {1} service detected a {2} exception when creating an open metadata topic connection because the connector provider is incorrect. The error message was {3} + */ BAD_TOPIC_CONNECTOR_PROVIDER("OMAG-MULTI-TENANT-0001", OMRSAuditLogRecordSeverity.EXCEPTION, "Method {0} called on behalf of the {1} service detected a {2} exception when creating an open " + @@ -29,6 +32,9 @@ public enum OMAGServerInstanceAuditCode implements AuditLogMessageSet "This is an internal error. The access service is not using a valid connector provider.", "Raise an issue on Egeria's GitHub and work with the Egeria community to resolve."), + /** + * OMAG-MULTI-TENANT-0002 - Method {0} called on behalf of the {1} service is unable to create a client-side open metadata topic connection because the topic name is not configured in the configuration for this service. + */ NO_TOPIC_INFORMATION("OMAG-MULTI-TENANT-0002", OMRSAuditLogRecordSeverity.ERROR, "Method {0} called on behalf of the {1} service is unable to create a client-side open " + diff --git a/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceErrorCode.java b/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceErrorCode.java index 74460f4440a..ed8c80b5f19 100644 --- a/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceErrorCode.java +++ b/open-metadata-implementation/common-services/multi-tenant/src/main/java/org/odpi/openmetadata/commonservices/multitenant/ffdc/OMAGServerInstanceErrorCode.java @@ -9,7 +9,7 @@ * The OMAGServerInstanceErrorCode is used to define first failure data capture (FFDC) for errors that occur when * working with OMAG Server instances within the OMAG Server Platform * It is used in conjunction with all multi-tenant exceptions, both Checked and Runtime (unchecked). - * + *

* The 5 fields in the enum are: *
    *
  • HTTP Error Code - for translating between REST and JAVA Typically the numbers used are:
  • @@ -27,57 +27,88 @@ */ public enum OMAGServerInstanceErrorCode implements ExceptionMessageSet { + /** + * OMAG-MULTI-TENANT-400-001 - The OMAG server {0} has been configured with a bad connection to its security connector. Error message is {1}. Connection is {2} + */ BAD_SERVER_SECURITY_CONNECTION(400, "OMAG-MULTI-TENANT-400-001", "The OMAG server {0} has been configured with a bad connection to its security connector. Error message is {1}. Connection is {2}", "The system is unable to validate the users issuing requests to this server.", "Review the error message to determine the cause of the problem."), + + /** + * OMAG-MULTI-TENANT-400-002 - The OMAG server {0} has been requested to shut down but the following services are still running: {1} + */ SERVICES_NOT_SHUTDOWN(400, "OMAG-MULTI-TENANT-400-002", "The OMAG server {0} has been requested to shutdown but the following services are still running: {1}", "The system is unable to shutdown the server correctly.", "Review other error messages to determine the cause of the problem. This is likely to be a logic error in the services listed in the message"), + /** + * OMAG-MULTI-TENANT-400-003 - Method {0} called on behalf of the {1} service is unable to create a client-side open metadata topic connection because the topic name is not configured in the configuration for this service. + */ NO_TOPIC_INFORMATION(400,"OMAG-MULTI-TENANT-400-003", "Method {0} called on behalf of the {1} service is unable to create a client-side open " + "metadata topic connection because the topic name is not configured in the configuration for this service.", "This is a configuration error and an exception is sent to the requester.", "Correct the configuration of the access service to include the name of the topic."), + /** + * OMAG-MULTI-TENANT-400-004 - The connector provider class name {0} does not create a connector of class {1} which is required for the {2} + */ NOT_CORRECT_CONNECTOR_PROVIDER(400,"OMAG-MULTI-TENANT-400-004", "The connector provider class name {0} does not create a connector of class {1} which is required for the {2}", "An invalid parameter exception is returned to the caller.", "Either change the connector or the hosting environment because the current combination is not compatible."), + /** + * OMAG-MULTI-TENANT-404-001 - The OMAG Server {0} is not available to service a request from user {1} + */ SERVER_NOT_AVAILABLE(404, "OMAG-MULTI-TENANT-404-001", "The OMAG Server {0} is not available to service a request from user {1}", "The system is unable to process the request because the server is not running on the called platform.", "Verify that the correct server is being called on the correct platform and that this server is running. " + "Retry the request when the server is available."), + /** + * OMAG-MULTI-TENANT-404-002 - The {0} service is not available on OMAG Server {1} to handle a request from user {2} + */ SERVICE_NOT_AVAILABLE(404, "OMAG-MULTI-TENANT-404-002", "The {0} service is not available on OMAG Server {1} to handle a request from user {2}", "The system is unable to process the request because the service is not available.", "Verify that the correct server is being called on the correct platform and that the requested service is configured to run there. " + "Once the correct environment is in place, retry the request."), + /** + * OMAG-MULTI-TENANT-404-003 - The server name is not available for the {0} operation + */ SERVER_NAME_NOT_AVAILABLE(404, "OMAG-MULTI-TENANT-404-003", "The server name is not available for the {0} operation", "The system is unable to return the server name because it is not available.", "Check that the server where the access service is running initialized correctly. " + "Correct any errors discovered and retry the request when the open metadata services are available."), + /** + * OMAG-MULTI-TENANT-404-004 - The open metadata repository services are not initialized for the {0} operation + */ OMRS_NOT_INITIALIZED(404, "OMAG-MULTI-TENANT-404-004", "The open metadata repository services are not initialized for the {0} operation", "The system is unable to connect to the open metadata repository services because they are not running in this server.", "Check that the server where the called service is running initialized correctly. " + "Correct any errors discovered and retry the request when the open metadata services are available."), + /** + * OMAG-MULTI-TENANT-404-005 - The open metadata repository services are not available for the {0} operation + */ OMRS_NOT_AVAILABLE(404, "OMAG-MULTI-TENANT-404-005", "The open metadata repository services are not available for the {0} operation", "The system is unable to connect to the open metadata repository services because they are not in the correct state to be called.", "Check that the server where the called service is running initialized correctly and is not in the process of shutting down. " + "Correct any errors discovered and retry the request when the open metadata repository services are available."), + /** + * OMAG-MULTI-TENANT-500-003 - Method {0} called on behalf of the {1} service detected a {2} exception when creating an open metadata topic connection because the connector provider is incorrect. The error message was {3} + */ BAD_TOPIC_CONNECTOR_PROVIDER(500, "OMAG-MULTI-TENANT-500-003", "Method {0} called on behalf of the {1} service detected a {2} exception when creating an open " + "metadata topic connection because the connector provider is incorrect. The error message was {3}", @@ -85,19 +116,19 @@ public enum OMAGServerInstanceErrorCode implements ExceptionMessageSet "Raise an issue on Egeria's GitHub and work with the Egeria community to resolve."), ; - private ExceptionMessageDefinition messageDefinition; + private final ExceptionMessageDefinition messageDefinition; /** * The constructor for RepositoryHandlerErrorCode expects to be passed one of the enumeration rows defined in * DiscoveryEngineErrorCode above. For example: - * + *

    * RepositoryHandlerErrorCode errorCode = RepositoryHandlerErrorCode.ASSET_NOT_FOUND; - * + *

    * This will expand out to the 5 parameters shown below. * * @param httpErrorCode error code to use over REST calls - * @param errorMessageId unique Id for the message + * @param errorMessageId unique id for the message * @param errorMessage text for the message * @param systemAction description of the action taken by the system when the error condition happened * @param userAction instructions for resolving the error diff --git a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandler.java b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandler.java index 41795bdcf6a..d1cfdae0076 100644 --- a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandler.java +++ b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandler.java @@ -2202,6 +2202,8 @@ private void isolateAndRemoveEntity(String userId, null, methodName); + auditLog.logMessage(methodName, RepositoryHandlerAuditCode.ENTITY_DELETED.getMessageDefinition(obsoleteEntityGUID, entityTypeName, entityTypeGUID, methodName)); + try { metadataCollection.deleteEntity(userId, entityTypeGUID, entityTypeName, obsoleteEntityGUID); @@ -2238,6 +2240,8 @@ public void simpleDeleteEntity(String userId, { final String localMethodName = "simpleDeleteEntity"; + auditLog.logMessage(methodName, RepositoryHandlerAuditCode.ENTITY_DELETED.getMessageDefinition(obsoleteEntityGUID, entityTypeName, entityTypeGUID, methodName)); + try { metadataCollection.deleteEntity(userId, entityTypeGUID, entityTypeName, obsoleteEntityGUID); @@ -5533,6 +5537,17 @@ public void removeRelationship(String userId, { final String localMethodName = "removeRelationship"; + auditLog.logMessage(methodName, RepositoryHandlerAuditCode.RELATIONSHIP_DELETED.getMessageDefinition(relationship.getGUID(), + relationship.getType().getTypeDefName(), + relationship.getType().getTypeDefGUID(), + relationship.getEntityOneProxy().getGUID(), + relationship.getEntityOneProxy().getType().getTypeDefName(), + relationship.getEntityOneProxy().getType().getTypeDefGUID(), + relationship.getEntityTwoProxy().getGUID(), + relationship.getEntityTwoProxy().getType().getTypeDefName(), + relationship.getEntityTwoProxy().getType().getTypeDefGUID(), + methodName)); + try { errorHandler.validateProvenance(userId, diff --git a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandlerAuditCode.java b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandlerAuditCode.java index bcb6573bfcf..8f1f809adfc 100644 --- a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandlerAuditCode.java +++ b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/RepositoryHandlerAuditCode.java @@ -96,6 +96,18 @@ public enum RepositoryHandlerAuditCode implements AuditLogMessageSet "The system is unable to process the request because none of the members of the connected cohort(s) support this function.", "Add an Egeria native metadata repository to one of the connected cohorts. This will provide the support that you need."), + ENTITY_DELETED("OMAG-REPOSITORY-HANDLER-0011", + OMRSAuditLogRecordSeverity.INFO, + "The Open Metadata Service has soft-deleted entity {0} of type {1} ({2}) during method {3}", + "The entity has been put into DELETED status. If is no longer available for normal queries.", + "No specific action is required. This message is to highlight that the entity can no longer be retrieved until it is restored."), + + RELATIONSHIP_DELETED("OMAG-REPOSITORY-HANDLER-0012", + OMRSAuditLogRecordSeverity.INFO, + "The Open Metadata Service has soft-deleted relationship {0} of type {1} ({2}) between entity {3} of type {4} ({5}) and entity {6} of type {7} ({8}) during method {9}", + "The relationship has been put into DELETED status. If is no longer available for normal queries.", + "No specific action is required. This message is to highlight that the relationship can no longer be retrieved until it is restored."), + ; private final String logMessageId; diff --git a/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java b/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java index a799082da3c..a1d671f898a 100644 --- a/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java +++ b/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java @@ -8,6 +8,7 @@ import org.odpi.openmetadata.adminservices.rest.OMAGServerConfigResponse; import org.odpi.openmetadata.adminservices.rest.PlatformSecurityRequestBody; import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; +import org.odpi.openmetadata.commonservices.ffdc.rest.BooleanResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectionResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectorTypeResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.RegisteredOMAGService; @@ -256,127 +257,6 @@ public ConnectorType getConnectorType(String userId, } - /** - * Retrieve the server status - * - * @param userId calling user - * @param serverName the name of the server - * - * @return The server status - * - * @throws InvalidParameterException one of the parameters is invalid - * @throws UserNotAuthorizedException the user is not authorized to issue this request - * @throws PropertyServerException there is a problem reported in the open metadata server(s) - */ - public ServerStatus getServerStatus(String userId, - String serverName) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException - { - final String methodName = "getServerStatus"; - - invalidParameterHandler.validateUserId(userId, methodName); - - final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/"+serverName+"/status"; - - ServerStatusResponse restResult = restClient.callServerStatusGetRESTCall(methodName, urlTemplate, userId); - - ServerStatus serverStatus = new ServerStatus(); - serverStatus.setServerName(restResult.getServerName()); - serverStatus.setIsActive(restResult.isActive()); - serverStatus.setServerStartTime(restResult.getServerStartTime()); - serverStatus.setServerEndTime(restResult.getServerEndTime()); - serverStatus.setServerHistory(restResult.getServerHistory()); - - return serverStatus; - } - - - /** - * Retrieve a list of the active services on a server - * - * @param userId calling user - * @param serverName name of the server - * - * @return List of service names - * - * @throws InvalidParameterException one of the parameters is invalid - * @throws UserNotAuthorizedException the user is not authorized to issue this request - * @throws PropertyServerException there is a problem reported in the open metadata server(s) - */ - public List getActiveServices(String userId, - String serverName) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException - { - final String methodName = "getActiveServices"; - final String serverNameParameter = "serverName"; - - invalidParameterHandler.validateUserId(userId, methodName); - invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); - - final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/"+serverName+"/services"; - - ServerServicesListResponse restResult = restClient.callServiceListGetRESTCall(methodName, urlTemplate, userId); - - return restResult.getServerServicesList(); - } - - - /** - * Retrieve a list of the active servers on the platform - * - * @param userId calling user - * - * @return List of server names - * - * @throws InvalidParameterException one of the parameters is invalid - * @throws UserNotAuthorizedException the user is not authorized to issue this request - * @throws PropertyServerException there is a problem reported in the open metadata server(s) - */ - public List getActiveServers(String userId) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException - { - final String methodName = "getActiveServers"; - - invalidParameterHandler.validateUserId(userId, methodName); - - final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/active"; - - ServerListResponse restResult = restClient.callServerListGetRESTCall(methodName, urlTemplate, userId); - - return restResult.getServerList(); - } - - - /** - * Retrieve a list of the known servers on the platform - * - * @param userId calling user - * - * @return List of server names - * - * @throws InvalidParameterException one of the parameters is invalid - * @throws UserNotAuthorizedException the user is not authorized to issue this request - * @throws PropertyServerException there is a problem reported in the open metadata server(s) - */ - public List getKnownServers(String userId) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException - { - final String methodName = "getKnownServers"; - - invalidParameterHandler.validateUserId(userId, methodName); - - final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers"; - - ServerListResponse restResult = restClient.callServerListGetRESTCall(methodName, urlTemplate, userId); - - return restResult.getServerList(); - } - - /** * Retrieve a list of the access services registered on the platform * @@ -432,7 +312,7 @@ public List getEngineServices(String userId) throws Inv /** - * Retrieve a list of the access services registered on the platform + * Retrieve a list of the view services registered on the platform * * @param userId calling user * @@ -459,7 +339,7 @@ public List getViewServices(String userId) throws Inval /** - * Retrieve a list of the governance services registered on the platform + * Retrieve a list of the governance services supported on the platform * * @param userId calling user * @@ -484,6 +364,7 @@ public List getGovernanceServices(String userId) throws return restResult.getServices(); } + /** * Retrieve a list of the integration services registered on the platform * @@ -512,7 +393,7 @@ public List getIntegrationServices(String userId) throw /** - * Retrieve a list of the common services registered on the platform + * Retrieve a list of the common services supported on the platform * * @param userId calling user * @@ -538,6 +419,31 @@ public List getCommonServices(String userId) throws Inv } + /** + * Retrieve a list of the services known on the platform + * + * @param userId calling user + * + * @return List of common services + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + public List getAllServices(String userId) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + final String methodName = "getAllServices"; + + invalidParameterHandler.validateUserId(userId, methodName); + + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/registered-services"; + + RegisteredOMAGServicesResponse restResult = restClient.callRegisteredOMAGServicesGetRESTCall(methodName, urlTemplate, userId); + + return restResult.getServices(); + } /* @@ -728,6 +634,125 @@ public void shutdownPlatform(String userId) throws UserNotAuthorizedException, * Operational status and control */ + /** + * Retrieve a list of the known servers on the platform + * + * @param userId calling user + * + * @return List of server names + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + public List getKnownServers(String userId) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + final String methodName = "getKnownServers"; + + invalidParameterHandler.validateUserId(userId, methodName); + + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers"; + + ServerListResponse restResult = restClient.callServerListGetRESTCall(methodName, urlTemplate, userId); + + return restResult.getServerList(); + } + + + /** + * Return a flag to indicate if this server has ever run on this OMAG Server Platform instance. + * + * @param userId calling user + * @param serverName server of interest + * + * @return flag + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + public boolean isServerKnown(String userId, + String serverName) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + final String methodName = "isServerKnown"; + + invalidParameterHandler.validateUserId(userId, methodName); + + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/is-known"; + + BooleanResponse restResult = restClient.callBooleanGetRESTCall(methodName, urlTemplate, userId); + + return restResult.getFlag(); + } + + + /** + * Retrieve a list of the active servers on the platform + * + * @param userId calling user + * + * @return List of server names + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + public List getActiveServers(String userId) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + final String methodName = "getActiveServers"; + + invalidParameterHandler.validateUserId(userId, methodName); + + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/active"; + + ServerListResponse restResult = restClient.callServerListGetRESTCall(methodName, urlTemplate, userId); + + return restResult.getServerList(); + } + + + /** + * Retrieve the server status + * + * @param userId calling user + * @param serverName the name of the server + * + * @return The server status + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + public ServerStatus getServerStatus(String userId, + String serverName) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + final String methodName = "getServerStatus"; + + invalidParameterHandler.validateUserId(userId, methodName); + + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/"+serverName+"/status"; + + ServerStatusResponse restResult = restClient.callServerStatusGetRESTCall(methodName, urlTemplate, userId); + + ServerStatus serverStatus = new ServerStatus(); + serverStatus.setServerName(restResult.getServerName()); + serverStatus.setIsActive(restResult.isActive()); + serverStatus.setServerStartTime(restResult.getServerStartTime()); + serverStatus.setServerEndTime(restResult.getServerEndTime()); + serverStatus.setServerHistory(restResult.getServerHistory()); + + return serverStatus; + } + + /** * Return the configuration used for the current active instance of the server. Null is returned if * the server instance is not running. @@ -757,6 +782,7 @@ public OMAGServerConfig getActiveConfiguration(String userId, } + /** * Return the status of a running server (use platform services to find out if the server is running). * @@ -767,12 +793,12 @@ public OMAGServerConfig getActiveConfiguration(String userId, * @throws InvalidParameterException invalid parameter. * @throws PropertyServerException unusual state in the platform. */ - public ServerServicesStatus getServerServicesStatus(String userId, - String serverName) throws UserNotAuthorizedException, - InvalidParameterException, - PropertyServerException + public ServerServicesStatus getActiveServerStatus(String userId, + String serverName) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException { - final String methodName = "getServerStatus"; + final String methodName = "getActiveServerStatus"; final String serverNameParameter = "serverName"; final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance/status"; @@ -785,6 +811,37 @@ public ServerServicesStatus getServerServicesStatus(String userId, } + /** + * Retrieve a list of the active services on a server + * + * @param userId calling user + * @param serverName name of the server + * + * @return List of service names + * + * @throws InvalidParameterException one of the parameters is invalid + * @throws UserNotAuthorizedException the user is not authorized to issue this request + * @throws PropertyServerException there is a problem reported in the open metadata server(s) + */ + public List getActiveServices(String userId, + String serverName) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + final String methodName = "getActiveServices"; + final String serverNameParameter = "serverName"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/"+serverName+"/services"; + + ServerServicesListResponse restResult = restClient.callServiceListGetRESTCall(methodName, urlTemplate, userId); + + return restResult.getServerServicesList(); + } + + /** * Add a new open metadata archive to running repository. * diff --git a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java index b84094dcc05..cc4a28e14d3 100644 --- a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java @@ -252,7 +252,7 @@ public ConnectorTypeResponse getConnectorType(@Parameter(description="calling us /** - * Return a flag to indicate if this server has ever run on this OMAG Server Platform. + * Return a flag to indicate if this server has ever run on this OMAG Server Platform instance. * * @param userId calling user * @param serverName server of interest @@ -260,7 +260,7 @@ public ConnectorTypeResponse getConnectorType(@Parameter(description="calling us */ @GetMapping(path = "/servers/{serverName}/is-known") @Operation( summary = "isServerKnown", - description="Return a boolean indication if this server has ever run on this platform", + description="Return a boolean indication if this server has ever run on this platform instance", responses = { @ApiResponse(responseCode = "200",description="boolean flag", content = @Content( diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle index 9dbb5c4c215..e1e5acbef5f 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle @@ -54,13 +54,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: [':open-metadata-distribution:open-metadata-assemblies:unzip','cleanData','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: [':open-metadata-distribution:open-metadata-assemblies:unzip','cleanData','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10443", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspringdoc.api-docs.enabled=false", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", @@ -76,7 +76,7 @@ task startServer(dependsOn: [':open-metadata-distribution:open-metadata-assembli } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/fvt/AssetOwnerFactory.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/fvt/AssetOwnerFactory.java index 4de6865b401..4c1e5893a34 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/fvt/AssetOwnerFactory.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/fvt/AssetOwnerFactory.java @@ -6,7 +6,7 @@ import org.odpi.openmetadata.accessservices.assetowner.client.AssetOwner; import org.odpi.openmetadata.accessservices.assetowner.client.rest.AssetOwnerRESTClient; import org.odpi.openmetadata.accessservices.assetowner.properties.AssetProperties; -import org.odpi.openmetadata.accessservices.assetowner.properties.PrimitiveSchemaTypeProperties; +import org.odpi.openmetadata.accessservices.assetowner.properties.SchemaTypeProperties; import org.odpi.openmetadata.accessservices.assetowner.properties.TemplateProperties; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; @@ -192,15 +192,20 @@ public String getSchemaType(String userId, try { - PrimitiveSchemaTypeProperties properties = new PrimitiveSchemaTypeProperties(); + SchemaTypeProperties properties = new SchemaTypeProperties(); properties.setQualifiedName(testCaseName + ":" + schemaTypeName); properties.setDisplayName(schemaTypeDisplayName); properties.setDescription(schemaTypeDescription); - properties.setDataType(schemaTypeType); - properties.setDefaultValue(schemaTypeDefaultValue); properties.setTypeName("PrimitiveSchemaType"); + Map extendedProperties = new HashMap<>(); + + extendedProperties.put("dataType", schemaTypeType); + extendedProperties.put("defaultValue", schemaTypeDefaultValue); + + properties.setExtendedProperties(extendedProperties); + String schemaTypeGUID = client.addSchemaTypeToAsset(userId, assetGUID, properties); if (schemaTypeGUID == null) diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy index 9ac011063fb..e59e791cdbe 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy @@ -115,7 +115,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/build.gradle index 3accefb38c7..2f2b2ae98a1 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/build.gradle @@ -53,13 +53,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10444", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspringdoc.api-docs.enabled=false", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", @@ -75,7 +75,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/AssetManagerOMASFVTSuite.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/AssetManagerOMASFVTSuite.java index b2f6c83ca3b..86340766c43 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/AssetManagerOMASFVTSuite.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/AssetManagerOMASFVTSuite.java @@ -4,6 +4,8 @@ import org.odpi.openmetadata.accessservices.assetmanager.fvt.clientconstructors.ClientConstructorTest; import org.odpi.openmetadata.accessservices.assetmanager.fvt.connections.CreateConnectionTest; +import org.odpi.openmetadata.accessservices.assetmanager.fvt.dataassets.CreateDatabaseTest; +import org.odpi.openmetadata.accessservices.assetmanager.fvt.dataassets.CreateSchemasTest; import org.odpi.openmetadata.accessservices.assetmanager.fvt.externalidentifiers.ManageExternalIdsTest; import org.odpi.openmetadata.accessservices.assetmanager.fvt.glossaries.CreateExchangeGlossaryTest; import org.odpi.openmetadata.accessservices.assetmanager.fvt.errorhandling.InvalidParameterTest; @@ -107,6 +109,20 @@ public int performFVT(String serverName, } results.printResults(serverName); + results = CreateDatabaseTest.performFVT(serverName, serverPlatformRootURL, userId); + if (! results.isSuccessful()) + { + returnCode --; + } + results.printResults(serverName); + + results = CreateSchemasTest.performFVT(serverName, serverPlatformRootURL, userId); + if (! results.isSuccessful()) + { + returnCode --; + } + results.printResults(serverName); + return returnCode; } } diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/connections/CreateConnectionTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/connections/CreateConnectionTest.java index 77f03c4d888..3604d39b206 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/connections/CreateConnectionTest.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/connections/CreateConnectionTest.java @@ -328,7 +328,7 @@ private String getAssetManager(String serverName, /** * Check a connection is gone. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param connectionGUID unique id of the connection to test * @param activityName name of calling activity * @param userId calling user @@ -370,7 +370,7 @@ private void checkConnectionGone(ConnectionExchangeClient client, /** * Check connection is ok. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param connectionGUID unique id of the connection * @param activityName name of calling activity * @param userId calling user @@ -472,7 +472,7 @@ else if (connectionList.size() != 1) /** * Create a connection and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param assetManagerGUID unique id of the connection manager * @param userId calling user * @return GUID of connection @@ -521,7 +521,7 @@ private String getConnection(ConnectionExchangeClient client, /** * Check a connection endpoint is gone. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param endpointGUID unique id of the connection endpoint to test * @param connectionGUID unique id of the connection to test * @param activityName name of calling activity @@ -591,7 +591,7 @@ private void checkEndpointGone(ConnectionExchangeClient client, /** * Check a connection endpoint is stored OK. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param endpointGUID unique id of the connection * @param connectionGUID unique id of the connection * @param activityName name of calling activity @@ -742,7 +742,7 @@ else if (endpointList.size() != 1) /** * Create a connection endpoint and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param assetManagerGUID unique id of the connection manager * @param connectionGUID unique id of the connection * @param userId calling user @@ -796,7 +796,7 @@ private String createEndpoint(ConnectionExchangeClient client, /** * Check a connection connectorType is gone. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param connectorTypeGUID unique id of the connection connectorType to test * @param connectionGUID unique id of the connection endpoint to test * @param activityName name of calling activity @@ -864,7 +864,7 @@ private void checkConnectorTypeGone(ConnectionExchangeClient client, /** * Create a connection connectorType and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param connectorTypeGUID unique id of the connection connectorType to test * @param connectionGUID unique id of the connection endpoint to test * @param activityName name of calling activity diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateDatabaseTest.java.inprogress b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateDatabaseTest.java similarity index 70% rename from open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateDatabaseTest.java.inprogress rename to open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateDatabaseTest.java index 57a209fa816..f8a9ac55b25 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateDatabaseTest.java.inprogress +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateDatabaseTest.java @@ -7,14 +7,17 @@ import org.odpi.openmetadata.accessservices.assetmanager.client.exchange.ExternalAssetManagerClient; import org.odpi.openmetadata.accessservices.assetmanager.client.rest.AssetManagerRESTClient; import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.DataAssetElement; +import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.MetadataElement; +import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.RelationshipElement; import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaAttributeElement; import org.odpi.openmetadata.accessservices.assetmanager.properties.AssetManagerProperties; import org.odpi.openmetadata.accessservices.assetmanager.properties.DataAssetProperties; -import org.odpi.openmetadata.accessservices.assetmanager.properties.KeyPattern; import org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaAttributeProperties; +import org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties; import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementClassification; import org.odpi.openmetadata.fvt.utilities.FVTResults; import org.odpi.openmetadata.fvt.utilities.auditlog.FVTAuditLogDestination; import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; @@ -33,11 +36,6 @@ public class CreateDatabaseTest private final static int maxPageSize = 100; - private final static String externalIdName = "ExternalId Name"; - private final static String externalIdUsage = "ExternalId Usage"; - private final static KeyPattern externalIdKeyPattern = KeyPattern.STABLE_KEY; - private final static Map externalIdMappingProperties = new HashMap<>(); - /* * The asset manager name is constant - the guid is created as part of the test. */ @@ -52,7 +50,6 @@ public class CreateDatabaseTest private final static String databaseDescription = "Database description"; private final static String databaseType = "Database type"; private final static String databaseVersion = "Database version"; - private final static String databaseExternalId = "Database ExternalId"; private final static String databaseSchemaName = "TestDatabaseSchema"; private final static String databaseSchemaDisplayName = "DatabaseSchema displayName"; @@ -134,17 +131,32 @@ private static void runIt(String serverPlatformRootURL, String databaseTableGUID = thisTest.createDatabaseTable(client, assetManagerGUID, databaseSchemaGUID, userId); String databaseColumnGUID = thisTest.createDatabaseColumn(client, assetManagerGUID, databaseTableGUID, userId); + String activityName = "cascadedDelete - remove Database"; + + System.out.println("activityName = " + activityName); + System.out.println("databaseGUID = " + databaseGUID); + System.out.println("databaseSchemaGUID = " + databaseSchemaGUID); + System.out.println("databaseTableGUID = " + databaseTableGUID); + System.out.println("databaseColumnGUID = " + databaseColumnGUID); + /* * Check that all elements are deleted when the database is deleted. */ - String activityName = "cascadedDelete"; try { - client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, databaseName); + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, null, null, false, false); thisTest.checkDatabaseGone(client, assetManagerGUID, databaseGUID, activityName, userId); + thisTest.checkDatabaseColumnOK(client, assetManagerGUID, databaseColumnGUID, databaseTableGUID, activityName, userId); + thisTest.checkDatabaseTableOK(client, assetManagerGUID, databaseTableGUID, activityName, userId); + thisTest.checkDatabaseSchemaOK(client, assetManagerGUID, databaseSchemaGUID, null, activityName, userId); + + activityName = "cascadedDelete - remove DatabaseSchema"; + + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, null, null, false, false); + thisTest.checkDatabaseSchemaGone(client, assetManagerGUID, databaseSchemaGUID, null, activityName, userId); - thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, null, activityName, userId); + thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, activityName, userId); thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnGUID, null, activityName, userId); } catch (Exception unexpectedError) @@ -158,11 +170,17 @@ private static void runIt(String serverPlatformRootURL, */ activityName= "deleteOneByOne"; + System.out.println("activityName = " + activityName); databaseGUID = thisTest.getDatabase(client, assetManagerGUID, userId); databaseSchemaGUID = thisTest.getDatabaseSchema(client, assetManagerGUID, databaseGUID, userId); databaseTableGUID = thisTest.createDatabaseTable(client, assetManagerGUID, databaseSchemaGUID, userId); databaseColumnGUID = thisTest.createDatabaseColumn(client, assetManagerGUID, databaseTableGUID, userId); + System.out.println("databaseGUID = " + databaseGUID); + System.out.println("databaseSchemaGUID = " + databaseSchemaGUID); + System.out.println("databaseTableGUID = " + databaseTableGUID); + System.out.println("databaseColumnGUID = " + databaseColumnGUID); + /* * Check that elements can be deleted one by one @@ -172,43 +190,47 @@ private static void runIt(String serverPlatformRootURL, { activityName = "deleteOneByOne - prevalidate"; thisTest.checkDatabaseColumnOK(client, assetManagerGUID, databaseColumnGUID, databaseTableGUID, activityName, userId); - thisTest.checkDatabaseTableOK(client, assetManagerGUID, databaseTableGUID, databaseSchemaGUID, activityName, userId); + thisTest.checkDatabaseTableOK(client, assetManagerGUID, databaseTableGUID, activityName, userId); thisTest.checkDatabaseSchemaOK(client, assetManagerGUID, databaseSchemaGUID, databaseGUID, activityName, userId); thisTest.checkDatabaseOK(client, assetManagerGUID, databaseGUID, activityName, userId); - client.removeSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnGUID, databaseColumnName); + client.removeSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnGUID, null, null, false, false); activityName = "deleteOneByOne - column gone"; thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnGUID, databaseTableGUID, activityName, userId); - thisTest.checkDatabaseTableOK(client, assetManagerGUID, databaseTableGUID, databaseSchemaGUID, activityName, userId); + + activityName = "deleteOneByOne - column gone - check table: " + databaseTableGUID; + + thisTest.checkDatabaseTableOK(client, assetManagerGUID, databaseTableGUID, activityName, userId); + + activityName = "deleteOneByOne - column gone - check schema"; + thisTest.checkDatabaseSchemaOK(client, assetManagerGUID, databaseSchemaGUID, databaseGUID, activityName, userId); + + activityName = "deleteOneByOne - column gone - check DB"; + thisTest.checkDatabaseOK(client, assetManagerGUID, databaseGUID, activityName, userId); - client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseTableGUID, databaseTableName); + activityName = "deleteOneByOne - remove table"; + + client.removeSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseTableGUID, null, null, false, false); activityName = "deleteOneByOne - table gone"; - thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnGUID, null, activityName, userId); - thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, databaseSchemaGUID, activityName, userId); + thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, activityName, userId); thisTest.checkDatabaseSchemaOK(client, assetManagerGUID, databaseSchemaGUID, databaseGUID, activityName, userId); thisTest.checkDatabaseOK(client, assetManagerGUID, databaseGUID, activityName, userId); - client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, databaseSchemaName); + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, null, null, false, false); activityName = "deleteOneByOne - schema gone"; - thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnGUID, null, activityName, userId); - thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, null, activityName, userId); thisTest.checkDatabaseSchemaGone(client, assetManagerGUID, databaseSchemaGUID, databaseGUID, activityName, userId); thisTest.checkDatabaseOK(client, assetManagerGUID, databaseGUID, activityName, userId); - client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, databaseName); + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, null, null, false, false); activityName = "deleteOneByOne - database gone"; - thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnGUID, null, activityName, userId); - thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, null, activityName, userId); - thisTest.checkDatabaseSchemaGone(client, assetManagerGUID, databaseSchemaGUID, null, activityName, userId); thisTest.checkDatabaseGone(client, assetManagerGUID, databaseGUID, activityName, userId); - /* * Recreate database */ @@ -219,6 +241,11 @@ private static void runIt(String serverPlatformRootURL, databaseTableGUID = thisTest.createDatabaseTable(client, assetManagerGUID, databaseSchemaGUID, userId); databaseColumnGUID = thisTest.createDatabaseColumn(client, assetManagerGUID, databaseTableGUID, userId); + System.out.println("databaseGUID = " + databaseGUID); + System.out.println("databaseSchemaGUID = " + databaseSchemaGUID); + System.out.println("databaseTableGUID = " + databaseTableGUID); + System.out.println("databaseColumnGUID = " + databaseColumnGUID); + /* * Update tests */ @@ -229,12 +256,11 @@ private static void runIt(String serverPlatformRootURL, databaseColumnTwoProperties.setQualifiedName(databaseColumnTwoName); databaseColumnTwoProperties.setDisplayName(databaseColumnDisplayName); // Note wrong value databaseColumnTwoProperties.setDescription(databaseColumnTwoDescription); - databaseColumnTwoProperties.setDataType(databaseColumnType); // Note wrong value try { - client.updateSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, databaseColumnTwoProperties); + client.updateSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, null, true, databaseColumnTwoProperties, null, false ,false); throw new FVTUnexpectedCondition(testCaseName, activityName); } catch (InvalidParameterException expectedError) @@ -244,13 +270,13 @@ private static void runIt(String serverPlatformRootURL, activityName = "updateColumnWithSameProperties"; - databaseColumnTwoGUID = client.createDatabaseColumn(userId, assetManagerGUID, assetManagerName, databaseTableGUID, databaseColumnTwoProperties); + databaseColumnTwoGUID = client.createSchemaAttribute(userId, assetManagerGUID, assetManagerName, true, databaseTableGUID, null, databaseColumnTwoProperties, null, false, false); - SchemaAttributeElement beforeElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID); + SchemaAttributeElement beforeElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, null, false, false); - client.updateSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, databaseColumnTwoProperties); + client.updateSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, null, true, databaseColumnTwoProperties,null, false, false); - SchemaAttributeElement afterElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID); + SchemaAttributeElement afterElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, null, false, false); /* * No change should occur in the version number because the properties are not different. @@ -265,11 +291,17 @@ private static void runIt(String serverPlatformRootURL, /* * This change effects the classification of the column */ - databaseColumnTwoProperties.setDataType(databaseColumnTwoType); + SchemaTypeProperties schemaType = new SchemaTypeProperties(); + + Map extendedProperties = new HashMap<>(); + + extendedProperties.put("dataType", databaseColumnTwoType); - client.updateDatabaseColumn(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, databaseColumnTwoProperties); + schemaType.setExtendedProperties(extendedProperties); + databaseColumnTwoProperties.setSchemaType(schemaType); + client.updateSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, null, true, databaseColumnTwoProperties, null, false, false); - afterElement = client.getDatabaseColumnByGUID(userId, databaseColumnTwoGUID); + afterElement = client.getSchemaAttributeByGUID(userId, null, null, databaseColumnTwoGUID, null, false, false); /* * No change should occur in the version number because the entity properties are not different. @@ -279,9 +311,10 @@ private static void runIt(String serverPlatformRootURL, throw new FVTUnexpectedCondition(testCaseName, activityName + "(version changed from " + beforeElement.getElementHeader().getVersions() + " to " + afterElement.getElementHeader().getVersions() + ")"); } - if (! databaseColumnTwoType.equals(afterElement.getDatabaseColumnProperties().getDataType())) + Object dataType = afterElement.getSchemaAttributeProperties().getSchemaType().getExtendedProperties().get("dataType"); + if (! databaseColumnTwoType.equals(dataType)) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(data type should be " + databaseColumnTwoType + " rather than " + afterElement.getDatabaseColumnProperties().getDataType() + ")"); + throw new FVTUnexpectedCondition(testCaseName, activityName + "(data type should be " + databaseColumnTwoType + " rather than " + dataType + "). Returned element: " + afterElement); } /* @@ -291,9 +324,9 @@ private static void runIt(String serverPlatformRootURL, databaseColumnTwoProperties.setDisplayName(databaseColumnTwoDisplayName); - client.updateDatabaseColumn(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, databaseColumnTwoProperties); + client.updateSchemaAttribute(userId, assetManagerGUID, assetManagerName, databaseColumnTwoGUID, null, true, databaseColumnTwoProperties, null, false, false); - afterElement = client.getDatabaseColumnByGUID(userId, databaseColumnTwoGUID); + afterElement = client.getSchemaAttributeByGUID(userId, null, null, databaseColumnTwoGUID, null, false, false); /* * The change should have taken effect. @@ -303,9 +336,9 @@ private static void runIt(String serverPlatformRootURL, throw new FVTUnexpectedCondition(testCaseName, activityName + "(version did not change from " + beforeElement.getElementHeader().getVersions() + ")"); } - if (! databaseColumnTwoDisplayName.equals(afterElement.getDatabaseColumnProperties().getDisplayName())) + if (! databaseColumnTwoDisplayName.equals(afterElement.getSchemaAttributeProperties().getDisplayName())) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(display name should be " + databaseColumnTwoDisplayName + " rather than " + afterElement.getDatabaseColumnProperties().getDisplayName() + ")"); + throw new FVTUnexpectedCondition(testCaseName, activityName + "(display name should be " + databaseColumnTwoDisplayName + " rather than " + afterElement.getSchemaAttributeProperties().getDisplayName() + ")"); } /* @@ -314,49 +347,16 @@ private static void runIt(String serverPlatformRootURL, activityName = "cascadedDelete"; try { - client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, databaseExternalId); + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, null, null, false, false); thisTest.checkDatabaseGone(client, assetManagerGUID, databaseGUID, activityName, userId); - thisTest.checkDatabaseSchemaGone(client, assetManagerGUID, databaseSchemaGUID, null, activityName, userId); - thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, null, activityName, userId); - thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnGUID, null, activityName, userId); - thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnTwoGUID, null, activityName, userId); - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); - } - - - /* - * Working with database schema types - - * Recreate database - */ - activityName= "schemaType test"; - - databaseGUID = thisTest.getDatabase(client, assetManagerGUID, userId); - databaseSchemaGUID = thisTest.getDatabaseSchema(client, assetManagerGUID, databaseGUID, userId); - - String databaseSchemaTypeGUID = client.createDatabaseSchemaType(userId, assetManagerGUID, assetManagerName, "SchemaOf:" + databaseSchemaName); - - databaseTableGUID = thisTest.createDatabaseTableForSchemaType(client, assetManagerGUID, databaseSchemaTypeGUID, userId); - databaseColumnGUID = thisTest.createDatabaseColumn(client, assetManagerGUID, databaseTableGUID, userId); - - client.attachSchemaTypeToDatabaseAsset(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, databaseSchemaTypeGUID); - /* - * Check that all elements are deleted when the database is deleted. - */ - activityName = "cascadedDelete for SchemaType"; - try - { - client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, databaseName); + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, null, null, false, false); - thisTest.checkDatabaseGone(client, assetManagerGUID, databaseGUID, activityName, userId); thisTest.checkDatabaseSchemaGone(client, assetManagerGUID, databaseSchemaGUID, null, activityName, userId); - thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, null, activityName, userId); + thisTest.checkDatabaseTableGone(client, assetManagerGUID, databaseTableGUID, activityName, userId); thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnGUID, null, activityName, userId); + thisTest.checkDatabaseColumnGone(client, assetManagerGUID, databaseColumnTwoGUID, null, activityName, userId); } catch (Exception unexpectedError) { @@ -367,7 +367,6 @@ private static void runIt(String serverPlatformRootURL, { throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); } - } @@ -463,7 +462,7 @@ private String getAssetManager(String serverName, /** * Check a database is gone. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseGUID unique id of the database to test * @param activityName name of calling activity * @param userId calling user @@ -477,7 +476,7 @@ private void checkDatabaseGone(DataAssetExchangeClient client, { try { - DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseGUID); + DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseGUID, null, false, false); if (retrievedElement != null) { @@ -505,7 +504,7 @@ private void checkDatabaseGone(DataAssetExchangeClient client, /** * Check database is ok. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseGUID unique id of the database * @param activityName name of calling activity * @param userId calling user @@ -519,7 +518,7 @@ private void checkDatabaseOK(DataAssetExchangeClient client, { try { - DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseGUID); + DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseGUID, null, false, false); if (retrievedElement == null) { @@ -545,16 +544,19 @@ private void checkDatabaseOK(DataAssetExchangeClient client, { throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from Retrieve)"); } - if (! databaseType.equals(retrievedDatabase.getDatabaseType())) + + Map databaseExtendedProperties = retrievedDatabase.getExtendedProperties(); + + if (! databaseType.equals(databaseExtendedProperties.get("deployedImplementationType"))) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseType from Retrieve " + retrievedDatabase.getDatabaseType() + ")"); + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseType from Retrieve). Retrieve Element: " + retrievedDatabase); } - if (! databaseVersion.equals(retrievedDatabase.getDatabaseVersion())) + if (! databaseVersion.equals(databaseExtendedProperties.get("databaseVersion"))) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseVersion from Retrieve)"); + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseVersion from Retrieve). Retrieve Element: " + retrievedDatabase); } - List databaseList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, databaseName, 0, maxPageSize); + List databaseList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, databaseName, 0, maxPageSize, null, false, false); if (databaseList == null) { @@ -586,16 +588,19 @@ else if (databaseList.size() != 1) { throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from RetrieveByName)"); } - if (! databaseType.equals(retrievedDatabase.getDatabaseType())) + + databaseExtendedProperties = retrievedDatabase.getExtendedProperties(); + + if (! databaseType.equals(databaseExtendedProperties.get("deployedImplementationType"))) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseType from RetrieveByName)"); + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseType from RetrieveByName). Retrieve Element: " + retrievedDatabase); } - if (! databaseVersion.equals(retrievedDatabase.getDatabaseVersion())) + if (! databaseVersion.equals(databaseExtendedProperties.get("databaseVersion"))) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseVersion from RetrieveByName)"); + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad databaseVersion from RetrieveByName). Retrieve Element: " + retrievedDatabase); } - databaseList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, databaseName, 1, maxPageSize); + databaseList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, databaseName, 1, maxPageSize, null, false, false); if (databaseList != null) { @@ -616,7 +621,7 @@ else if (databaseList.size() != 1) /** * Create a database and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param assetManagerGUID unique id of the database manager * @param userId calling user * @return GUID of database @@ -635,10 +640,15 @@ private String getDatabase(DataAssetExchangeClient client, properties.setQualifiedName(databaseName); properties.setDisplayName(databaseDisplayName); properties.setDescription(databaseDescription); - properties.setDatabaseType(databaseType); - properties.setDatabaseVersion(databaseVersion); - String databaseGUID = client.createDataAsset(userId, assetManagerGUID, assetManagerName, true, null, null, null, null, null, null, properties); + properties.setTypeName("Database"); + + Map extendedProperties = new HashMap<>(); + extendedProperties.put("deployedImplementationType", databaseType); + extendedProperties.put("databaseVersion" , databaseVersion); + properties.setExtendedProperties(extendedProperties); + + String databaseGUID = client.createDataAsset(userId, assetManagerGUID, assetManagerName, true, null, properties); if (databaseGUID == null) { @@ -646,7 +656,7 @@ private String getDatabase(DataAssetExchangeClient client, } else { - checkDatabaseOK(client, databaseGUID, activityName, userId); + checkDatabaseOK(client, assetManagerGUID, databaseGUID, activityName, userId); } return databaseGUID; @@ -665,7 +675,7 @@ private String getDatabase(DataAssetExchangeClient client, /** * Check a database column is gone. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseSchemaGUID unique id of the database schema to test * @param databaseGUID unique id of the database to test * @param activityName name of calling activity @@ -681,7 +691,7 @@ private void checkDatabaseSchemaGone(DataAssetExchangeClient client, { try { - DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID); + DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, null, false, false); if (retrievedElement != null) { @@ -710,11 +720,11 @@ private void checkDatabaseSchemaGone(DataAssetExchangeClient client, /* * Only one schema created so nothing should be tied to the database. */ - List databaseSchemaList = client.getSchemasForDatabase(userId, databaseGUID, 0, maxPageSize); + List relationshipList = client.getRelatedAssetsAtEnd2(userId, assetManagerGUID, assetManagerName, "DataContentForDataSet", databaseGUID, 0, maxPageSize, null, false, false); - if (databaseSchemaList != null) + if (relationshipList != null) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(DatabaseSchema returned for getSchemasForDatabase)"); + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No DatabaseSchema returned for getSchemasForDatabase)"); } } catch(FVTUnexpectedCondition testCaseError) @@ -732,7 +742,7 @@ private void checkDatabaseSchemaGone(DataAssetExchangeClient client, /** * Check a database schema is correctly stored. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseSchemaGUID unique id of the database schema * @param databaseGUID unique id of the database * @param activityName name of calling activity @@ -748,13 +758,16 @@ private void checkDatabaseSchemaOK(DataAssetExchangeClient client, { try { - DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID); + DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, null, false, + false); if (retrievedElement == null) { throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseSchemaElement from Retrieve)"); } + validateAnchorGUID(activityName, retrievedElement); + DataAssetProperties retrievedSchema = retrievedElement.getDataAssetProperties(); if (retrievedSchema == null) @@ -776,7 +789,8 @@ private void checkDatabaseSchemaOK(DataAssetExchangeClient client, } - List databaseSchemaList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, databaseSchemaName, 0, maxPageSize); + List databaseSchemaList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, databaseSchemaName, 0, + maxPageSize, null, false, false); if (databaseSchemaList == null) { @@ -809,21 +823,26 @@ else if (databaseSchemaList.size() != 1) throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from RetrieveByName)"); } - databaseSchemaList = client.getSchemasForDatabase(userId, databaseGUID, 0, maxPageSize); - - if (databaseSchemaList == null) + if (databaseGUID != null) { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseSchema for getSchemasForDatabase)"); - } - else if (databaseSchemaList.isEmpty()) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty DatabaseSchema list for getSchemasForDatabase)"); - } - else if (databaseSchemaList.size() != 1) - { - throw new FVTUnexpectedCondition(testCaseName, - activityName + "(DatabaseSchema list for getSchemasForDatabase contains" + databaseSchemaList.size() + - " elements)"); + List relationshipElements = client.getRelatedAssetsAtEnd2(userId, assetManagerGUID, assetManagerName, + "DataContentForDataSet", databaseGUID, 0, maxPageSize, + null, false, false); + + if (relationshipElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseSchema for getSchemasForDatabase)"); + } + else if (databaseSchemaList.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty DatabaseSchema list for getSchemasForDatabase)"); + } + else if (databaseSchemaList.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + "(DatabaseSchema list for getSchemasForDatabase contains" + databaseSchemaList.size() + + " elements)"); + } } } catch (FVTUnexpectedCondition testCaseError) @@ -840,7 +859,7 @@ else if (databaseSchemaList.size() != 1) /** * Create a database schema and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param assetManagerGUID unique id of the database manager * @param databaseGUID unique id of the database * @param userId calling user @@ -861,8 +880,11 @@ private String getDatabaseSchema(DataAssetExchangeClient client, properties.setQualifiedName(databaseSchemaName); properties.setDisplayName(databaseSchemaDisplayName); properties.setDescription(databaseSchemaDescription); + properties.setTypeName("DeployedDatabaseSchema"); + + String databaseSchemaGUID = client.createDataAsset(userId, assetManagerGUID, assetManagerName, true, null, properties); - String databaseSchemaGUID = client.createDataAsset(userId, assetManagerGUID, assetManagerName, databaseGUID, properties); + client.setupRelatedDataAsset(userId, assetManagerGUID, assetManagerName, true, "DataContentForDataSet", databaseGUID, databaseSchemaGUID, null, null, false, false); if (databaseSchemaGUID == null) { @@ -889,9 +911,8 @@ private String getDatabaseSchema(DataAssetExchangeClient client, /** * Check a database table is gone. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseTableGUID unique id of the database table to test - * @param databaseSchemaGUID unique id of the database schema to test * @param activityName name of calling activity * @param userId calling user * @throws FVTUnexpectedCondition the test case failed @@ -899,13 +920,12 @@ private String getDatabaseSchema(DataAssetExchangeClient client, private void checkDatabaseTableGone(DataAssetExchangeClient client, String assetManagerGUID, String databaseTableGUID, - String databaseSchemaGUID, String activityName, String userId) throws FVTUnexpectedCondition { try { - DatabaseTableElement retrievedElement = client.getDatabaseTableByGUID(userId, databaseTableGUID); + SchemaAttributeElement retrievedElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseTableGUID, null, false,false); if (retrievedElement != null) { @@ -926,41 +946,14 @@ private void checkDatabaseTableGone(DataAssetExchangeClient client, { throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); } - - if (databaseSchemaGUID != null) - { - try - { - /* - * Only one table created so nothing should be tied to the schema. - */ - List databaseTableList = client.getTablesForDatabaseSchema(userId, databaseSchemaGUID, 0, maxPageSize); - - if (databaseTableList != null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(DatabaseTable returned for getTablesForDatabaseAsset)"); - } - } - catch(FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch(Exception unexpectedError) - { - throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); - } - } } - - /** * Check a database table is stored OK. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseTableGUID unique id of the databaseSchema - * @param databaseSchemaGUID unique id of the databaseSchema * @param activityName name of calling activity * @param userId calling user * @throws FVTUnexpectedCondition the test case failed @@ -968,108 +961,91 @@ private void checkDatabaseTableGone(DataAssetExchangeClient client, private void checkDatabaseTableOK(DataAssetExchangeClient client, String assetManagerGUID, String databaseTableGUID, - String databaseSchemaGUID, String activityName, String userId) throws FVTUnexpectedCondition { try { - DatabaseTableElement retrievedElement = client.getDatabaseTableByGUID(userId, databaseTableGUID); + SchemaAttributeElement retrievedElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseTableGUID, null, false, false); - if (retrievedElement == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseTableElement from Retrieve)"); - } + validateDatabaseTable(activityName + "(getSchemaAttributeByGUID)", retrievedElement); - DatabaseTableProperties retrievedTable = retrievedElement.getDatabaseTableProperties(); + List databaseTableList = client.getSchemaAttributesByName(userId, assetManagerGUID, assetManagerName, databaseTableName, 0, maxPageSize, null, false, false); - if (retrievedTable == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseTableProperties from Retrieve)"); - } + validateDatabaseTableList(activityName + "(getSchemaAttributesByName)", databaseTableList); + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } - if (! databaseTableName.equals(retrievedTable.getQualifiedName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from Retrieve)"); - } - if (! databaseTableDisplayName.equals(retrievedTable.getDisplayName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from Retrieve)"); - } - if (! databaseTableDescription.equals(retrievedTable.getDescription())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from Retrieve)"); - } - List databaseTableList = client.getDatabaseTablesByName(userId, databaseTableName, 0, maxPageSize); + private void validateDatabaseTableList(String activityName, + List databaseTableList) throws FVTUnexpectedCondition + { - if (databaseTableList == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseTable for RetrieveByName)"); - } - else if (databaseTableList.isEmpty()) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty DatabaseTable list for RetrieveByName)"); - } - else if (databaseTableList.size() != 1) - { - throw new FVTUnexpectedCondition(testCaseName, - activityName + "(DatabaseTable list for RetrieveByName contains" + databaseTableList.size() + - " elements)"); - } + if (databaseTableList == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - no DatabaseTable"); + } + else if (databaseTableList.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Empty DatabaseTable list"); + } + else if (databaseTableList.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + " - DatabaseTable list contains " + databaseTableList.size() + " elements)"); + } - retrievedElement = databaseTableList.get(0); - retrievedTable = retrievedElement.getDatabaseTableProperties(); + validateDatabaseTable(activityName, databaseTableList.get(0)); + } - if (! databaseTableName.equals(retrievedTable.getQualifiedName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from RetrieveByName)"); - } - if (! databaseTableDisplayName.equals(retrievedTable.getDisplayName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from RetrieveByName)"); - } - if (! databaseTableDescription.equals(retrievedTable.getDescription())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from RetrieveByName)"); - } - if (databaseSchemaGUID != null) - { - databaseTableList = client.getTablesForDatabaseAsset(userId, databaseSchemaGUID, 0, maxPageSize); + private void validateDatabaseTable(String activityName, + SchemaAttributeElement retrievedElement) throws FVTUnexpectedCondition + { + if (retrievedElement == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - no DatabaseTableElement"); + } - if (databaseTableList == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseTable for getTablesForDatabaseAsset)"); - } - else if (databaseTableList.isEmpty()) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty DatabaseTable list for getTablesForDatabaseAsset)"); - } - else if (databaseTableList.size() != 1) - { - throw new FVTUnexpectedCondition(testCaseName, - activityName + "(DatabaseColumn list for getTablesForDatabaseAsset contains" + databaseTableList.size() + - " elements)"); - } - } + System.out.println("Database Table: " + retrievedElement); + + SchemaAttributeProperties retrievedTable = retrievedElement.getSchemaAttributeProperties(); + + if (retrievedTable == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - no DatabaseTableProperties"); } - catch (FVTUnexpectedCondition testCaseError) + + if (! databaseTableName.equals(retrievedTable.getQualifiedName())) { - throw testCaseError; + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad qualifiedName: " + retrievedTable.getQualifiedName() + " rather than " + databaseTableName); } - catch (Exception unexpectedError) + if (! databaseTableDisplayName.equals(retrievedTable.getDisplayName())) { - throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad displayName: " + retrievedTable.getDisplayName() + " rather than " + databaseTableDisplayName); + } + if (! databaseTableDescription.equals(retrievedTable.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad description: " + retrievedTable.getDescription() + " rather than " + databaseTableDescription); } + + validateAnchorGUID(activityName, retrievedElement); } /** * Create a database table and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param assetManagerGUID unique id of the database manager * @param databaseSchemaGUID unique id of the databaseSchema * @param userId calling user @@ -1085,14 +1061,22 @@ private String createDatabaseTable(DataAssetExchangeClient client, try { - DatabaseTableProperties properties = new DatabaseTableProperties(); + SchemaTypeProperties schemaTypeProperties = new SchemaTypeProperties(); + schemaTypeProperties.setTypeName("RelationalDBSchemaType"); + schemaTypeProperties.setQualifiedName("SchemaOf:" + databaseSchemaName); + + String databaseSchemaTypeGUID = client.createAnchoredSchemaType(userId, assetManagerGUID, assetManagerName, true, databaseSchemaGUID, null,false, false, schemaTypeProperties); + + client.setupSchemaTypeParent(userId, assetManagerGUID, assetManagerName, true, databaseSchemaTypeGUID, databaseSchemaGUID, "Asset", null, false, false, null); + + SchemaAttributeProperties properties = new SchemaAttributeProperties(); properties.setQualifiedName(databaseTableName); properties.setDisplayName(databaseTableDisplayName); properties.setDescription(databaseTableDescription); + properties.setTypeName("RelationalTable"); - - String databaseTableGUID = client.createDatabaseTable(userId, assetManagerGUID, assetManagerName, databaseSchemaGUID, properties); + String databaseTableGUID = client.createSchemaAttribute(userId, assetManagerGUID, assetManagerName, true, databaseSchemaTypeGUID, null, properties, null, false, false); if (databaseTableGUID == null) { @@ -1100,7 +1084,7 @@ private String createDatabaseTable(DataAssetExchangeClient client, } else { - checkDatabaseTableOK(client, databaseTableGUID, databaseSchemaGUID, activityName, userId); + checkDatabaseTableOK(client, assetManagerGUID, databaseTableGUID, activityName, userId); } return databaseTableGUID; @@ -1119,7 +1103,7 @@ private String createDatabaseTable(DataAssetExchangeClient client, /** * Create a database table and attach it to the supplied schema type and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param assetManagerGUID unique id of the database manager * @param databaseSchemaTypeGUID unique id of the databaseSchemaType * @param userId calling user @@ -1135,14 +1119,14 @@ private String createDatabaseTableForSchemaType(DataAssetExchangeClient client, try { - DatabaseTableProperties properties = new DatabaseTableProperties(); + SchemaAttributeProperties properties = new SchemaAttributeProperties(); properties.setQualifiedName(databaseTableName); properties.setDisplayName(databaseTableDisplayName); properties.setDescription(databaseTableDescription); + properties.setTypeName("RelationalTable"); - - String databaseTableGUID = client.createDatabaseTableForSchemaType(userId, assetManagerGUID, assetManagerName, databaseSchemaTypeGUID, properties); + String databaseTableGUID = client.createSchemaAttribute(userId, assetManagerGUID, assetManagerName, true, databaseSchemaTypeGUID, null, properties, null, false, false); if (databaseTableGUID == null) { @@ -1150,7 +1134,7 @@ private String createDatabaseTableForSchemaType(DataAssetExchangeClient client, } else { - checkDatabaseTableOK(client, databaseTableGUID, null, activityName, userId); + checkDatabaseTableOK(client, assetManagerGUID, databaseTableGUID, activityName, userId); } return databaseTableGUID; @@ -1169,7 +1153,7 @@ private String createDatabaseTableForSchemaType(DataAssetExchangeClient client, /** * Check a database column is gone. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseColumnGUID unique id of the database column to test * @param databaseTableGUID unique id of the database table to test * @param activityName name of calling activity @@ -1185,7 +1169,7 @@ private void checkDatabaseColumnGone(DataAssetExchangeClient client, { try { - DatabaseColumnElement retrievedElement = client.getDatabaseColumnByGUID(userId, databaseColumnGUID); + SchemaAttributeElement retrievedElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseColumnGUID, null, false, false); if (retrievedElement != null) { @@ -1214,18 +1198,18 @@ private void checkDatabaseColumnGone(DataAssetExchangeClient client, /* * Only one column created so nothing should be tied to the table. */ - List databaseColumnList = client.getColumnsForDatabaseTable(userId, databaseTableGUID, 0, maxPageSize); + List databaseColumnList = client.getNestedSchemaAttributes(userId, assetManagerGUID, assetManagerName, databaseTableGUID, 0, maxPageSize, null, false,false); if (databaseColumnList != null) { throw new FVTUnexpectedCondition(testCaseName, activityName + "(DatabaseColumn returned for getColumnsForDatabaseTable)"); } } - catch(FVTUnexpectedCondition testCaseError) + catch (FVTUnexpectedCondition testCaseError) { throw testCaseError; } - catch(Exception unexpectedError) + catch (Exception unexpectedError) { throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); } @@ -1234,9 +1218,9 @@ private void checkDatabaseColumnGone(DataAssetExchangeClient client, /** - * Create a database column and return its GUID. + * Check that the database column is ok. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param databaseColumnGUID unique id of the database column to test * @param databaseTableGUID unique id of the database table to test * @param activityName name of calling activity @@ -1252,114 +1236,87 @@ private void checkDatabaseColumnOK(DataAssetExchangeClient client, { try { - DatabaseColumnElement retrievedElement = client.getDatabaseColumnByGUID(userId, databaseColumnGUID); - - if (retrievedElement == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseColumnElement from Retrieve)"); - } - - DatabaseColumnProperties retrievedColumn = retrievedElement.getDatabaseColumnProperties(); + SchemaAttributeElement retrievedElement = client.getSchemaAttributeByGUID(userId, assetManagerGUID, assetManagerName, databaseColumnGUID, null, false, false); - if (retrievedColumn == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseColumnProperties from Retrieve)"); - } + validateColumn(activityName + "(getSchemaAttributeByGUID)", retrievedElement); - if (! databaseColumnName.equals(retrievedColumn.getQualifiedName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from Retrieve)"); - } - if (! databaseColumnDisplayName.equals(retrievedColumn.getDisplayName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from Retrieve)"); - } - if (! databaseColumnDescription.equals(retrievedColumn.getDescription())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from Retrieve)"); - } + List databaseColumnList = client.getSchemaAttributesByName(userId, null, null, databaseColumnName, 0, maxPageSize, null, false, false); - List databaseColumnList = client.getDatabaseColumnsByName(userId, databaseColumnName, 0, maxPageSize); + validateColumnList(activityName + "(getSchemaAttributesByName)", databaseColumnList); - if (databaseColumnList == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseColumn for RetrieveByName)"); - } - else if (databaseColumnList.isEmpty()) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty DatabaseColumn list for RetrieveByName)"); - } - else if (databaseColumnList.size() != 1) - { - throw new FVTUnexpectedCondition(testCaseName, - activityName + "(DatabaseColumn list for RetrieveByName contains" + databaseColumnList.size() + - " elements)"); - } + databaseColumnList = client.getNestedSchemaAttributes(userId, null, null, databaseTableGUID, 0, maxPageSize, null, false, false); + + validateColumnList(activityName + "(getColumnsForDatabaseTable)", databaseColumnList); + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } - retrievedElement = databaseColumnList.get(0); - retrievedColumn = retrievedElement.getDatabaseColumnProperties(); - if (! databaseColumnName.equals(retrievedColumn.getQualifiedName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from RetrieveByName)"); - } - if (! databaseColumnDisplayName.equals(retrievedColumn.getDisplayName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from RetrieveByName)"); - } - if (! databaseColumnDescription.equals(retrievedColumn.getDescription())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from RetrieveByName)"); - } + private void validateColumnList(String activityName, + List databaseColumnList) throws FVTUnexpectedCondition + { + if (databaseColumnList == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "- no DatabaseColumn List"); + } + else if (databaseColumnList.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Empty DatabaseColumn list"); + } + else if (databaseColumnList.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(DatabaseColumn list contains" + databaseColumnList.size() + " elements)"); + } - databaseColumnList = client.getColumnsForDatabaseTable(userId, databaseTableGUID, 0, maxPageSize); + this.validateColumn(activityName, databaseColumnList.get(0)); + } - if (databaseColumnList == null) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(no DatabaseColumn for getColumnsForDatabaseTable)"); - } - else if (databaseColumnList.isEmpty()) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty DatabaseColumn list for getColumnsForDatabaseTable)"); - } - else if (databaseColumnList.size() != 1) - { - throw new FVTUnexpectedCondition(testCaseName, - activityName + "(DatabaseColumn list for getColumnsForDatabaseTable contains" + databaseColumnList.size() + - " elements)"); - } - retrievedElement = databaseColumnList.get(0); - retrievedColumn = retrievedElement.getDatabaseColumnProperties(); + private void validateColumn(String activityName, + SchemaAttributeElement retrievedElement) throws FVTUnexpectedCondition + { + if (retrievedElement == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "- no DatabaseColumnElement"); + } - if (! databaseColumnName.equals(retrievedColumn.getQualifiedName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from getColumnsForDatabaseTable)"); - } - if (! databaseColumnDisplayName.equals(retrievedColumn.getDisplayName())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from getColumnsForDatabaseTable)"); - } - if (! databaseColumnDescription.equals(retrievedColumn.getDescription())) - { - throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from getColumnsForDatabaseTable)"); - } + System.out.println("Database Column: " + retrievedElement); + + SchemaAttributeProperties retrievedColumn = retrievedElement.getSchemaAttributeProperties(); + + if (retrievedColumn == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "- no DatabaseColumnProperties"); } - catch (FVTUnexpectedCondition testCaseError) + + if (! databaseColumnName.equals(retrievedColumn.getQualifiedName())) { - throw testCaseError; + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad qualifiedName: " + retrievedColumn.getQualifiedName() + " rather than " + databaseColumnName); } - catch (Exception unexpectedError) + if (! databaseColumnDisplayName.equals(retrievedColumn.getDisplayName())) { - throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad displayName: " + retrievedColumn.getDisplayName() + " rather than " + databaseColumnDisplayName); + } + if (! databaseColumnDescription.equals(retrievedColumn.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad description: " + retrievedColumn.getDescription() + " rather than " + databaseColumnDescription); } + + validateAnchorGUID(activityName, retrievedElement); } - + /** * Create a database column and return its GUID. * - * @param client interface to Data Manager OMAS + * @param client interface to Asset Manager OMAS * @param assetManagerGUID unique id of the database manager * @param databaseTableGUID unique id of the database table to connect the column to * @param userId calling user @@ -1375,14 +1332,25 @@ private String createDatabaseColumn(DataAssetExchangeClient client, try { - DatabaseColumnProperties properties = new DatabaseColumnProperties(); + SchemaAttributeProperties properties = new SchemaAttributeProperties(); properties.setQualifiedName(databaseColumnName); properties.setDisplayName(databaseColumnDisplayName); properties.setDescription(databaseColumnDescription); - properties.setDataType(databaseColumnType); + properties.setTypeName("RelationalColumn"); + + SchemaTypeProperties schemaTypeProperties = new SchemaTypeProperties(); + + Map extendedProperties = new HashMap<>(); - String databaseColumnGUID = client.createDatabaseColumn(userId, assetManagerGUID, databaseTableGUID, properties); + extendedProperties.put("dataType", databaseColumnType); + + schemaTypeProperties.setTypeName("PrimitiveSchemaType"); + schemaTypeProperties.setQualifiedName("SchemaType:" + databaseColumnName); + schemaTypeProperties.setExtendedProperties(extendedProperties); + + properties.setSchemaType(schemaTypeProperties); + String databaseColumnGUID = client.createSchemaAttribute(userId, assetManagerGUID, assetManagerName, true, databaseTableGUID, null, properties, null, false, false); if (databaseColumnGUID == null) { @@ -1404,4 +1372,23 @@ private String createDatabaseColumn(DataAssetExchangeClient client, throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); } } + + + private void validateAnchorGUID(String activityName, + MetadataElement metadataElement) + { + if (metadataElement.getElementHeader() != null) + { + if (metadataElement.getElementHeader().getClassifications() != null) + { + for (ElementClassification classification : metadataElement.getElementHeader().getClassifications()) + { + if ("Anchors".equals(classification.getClassificationName())) + { + System.out.println(metadataElement.getElementHeader().getType().getTypeName() + " element " + metadataElement.getElementHeader().getGUID() + " has anchor of " + classification.getClassificationProperties() + " in activity " + activityName); + } + } + } + } + } } diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateSchemasTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateSchemasTest.java new file mode 100644 index 00000000000..13bb02329cd --- /dev/null +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/dataassets/CreateSchemasTest.java @@ -0,0 +1,1254 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.accessservices.assetmanager.fvt.dataassets; + +import org.odpi.openmetadata.accessservices.assetmanager.client.exchange.DataAssetExchangeClient; +import org.odpi.openmetadata.accessservices.assetmanager.client.exchange.ExternalAssetManagerClient; +import org.odpi.openmetadata.accessservices.assetmanager.client.rest.AssetManagerRESTClient; +import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.DataAssetElement; +import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.MetadataElement; +import org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement; +import org.odpi.openmetadata.accessservices.assetmanager.properties.AssetManagerProperties; +import org.odpi.openmetadata.accessservices.assetmanager.properties.DataAssetProperties; +import org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties; +import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; +import org.odpi.openmetadata.frameworks.auditlog.AuditLog; +import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.ElementClassification; +import org.odpi.openmetadata.fvt.utilities.FVTResults; +import org.odpi.openmetadata.fvt.utilities.auditlog.FVTAuditLogDestination; +import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * CreateSchemasTest builds complex schema structures. + */ +public class CreateSchemasTest +{ + private final static String testCaseName = "CreateSchemaTest"; + + private final static int maxPageSize = 100; + + /* + * The asset manager name is constant - the guid is created as part of the test. + */ + private final static String assetManagerName = "TestSchemaManager"; + private final static String assetManagerDisplayName = "SchemaManager displayName"; + private final static String assetManagerDescription = "SchemaManager description"; + private final static String assetManagerTypeDescription = "SchemaManager type"; + private final static String assetManagerVersion = "SchemaManager version"; + + private final static String assetName = "TestAsset"; + private final static String assetDisplayName = "Asset displayName"; + private final static String assetDescription = "Asset description"; + + private final static String optionSchemaName = "TestSchemaTypeOption"; + private final static String optionSchemaDisplayName = "TestSchemaTypeOption displayName"; + private final static String optionSchemaDescription = "TestSchemaTypeOption description"; + + private final static String primitive1Name = "TestPrimitive1"; + private final static String primitive1DisplayName = "TestPrimitive1 displayName"; + private final static String primitive1Description = "TestPrimitive1 description"; + private final static String primitive1DataType = "int"; + + + private final static String primitive2Name = "TestPrimitive2"; + private final static String primitive2DisplayName = "TestPrimitive2 displayName"; + private final static String primitive2Description = "TestPrimitive2 description"; + private final static String primitive2DataType = "string"; + + + private final static String mapName = "TestMap"; + private final static String mapDisplayName = "TestMap displayName"; + private final static String mapDescription = "TestMap description"; + + private final static String primitiveFromName = "TestPrimitiveFrom"; + private final static String primitiveFromDisplayName = "TestPrimitiveFrom displayName"; + private final static String primitiveFromDescription = "TestPrimitiveFrom description"; + private final static String primitiveFromType = "date"; + + private final static String primitiveToName = "TestPrimitiveTo"; + private final static String primitiveToDisplayName = "TestPrimitiveTo displayName"; + private final static String primitiveToDescription = "TestPrimitiveTo description"; + private final static String primitiveToType = "long"; + + + /** + * Run all of the defined tests and capture the results. + * + * @param serverName name of the server to connect to + * @param serverPlatformRootURL the network address of the server running the OMAS REST servers + * @param userId calling user + * @return results of running test + */ + public static FVTResults performFVT(String serverName, + String serverPlatformRootURL, + String userId) + { + FVTResults results = new FVTResults(testCaseName); + + results.incrementNumberOfTests(); + try + { + CreateSchemasTest.runIt(serverPlatformRootURL, serverName, userId, results.getAuditLogDestination()); + results.incrementNumberOfSuccesses(); + } + catch (Exception error) + { + results.addCapturedError(error); + } + + return results; + } + + + /** + * Run all the tests in this class. + * + * @param serverPlatformRootURL root url of the server + * @param serverName name of the server + * @param userId calling user + * @param auditLogDestination logging destination + * @throws FVTUnexpectedCondition the test case failed + */ + private static void runIt(String serverPlatformRootURL, + String serverName, + String userId, + FVTAuditLogDestination auditLogDestination) throws FVTUnexpectedCondition + { + CreateSchemasTest thisTest = new CreateSchemasTest(); + + AuditLog auditLog = new AuditLog(auditLogDestination, + AccessServiceDescription.ASSET_MANAGER_OMAS.getAccessServiceCode(), + AccessServiceDescription.ASSET_MANAGER_OMAS.getAccessServiceDevelopmentStatus(), + AccessServiceDescription.ASSET_MANAGER_OMAS.getAccessServiceName(), + AccessServiceDescription.ASSET_MANAGER_OMAS.getAccessServiceDescription(), + AccessServiceDescription.ASSET_MANAGER_OMAS.getAccessServiceWiki()); + + DataAssetExchangeClient client = thisTest.getDataAssetExchangeClient(serverName, serverPlatformRootURL, auditLog); + + String assetManagerGUID = thisTest.getAssetManager(serverName, serverPlatformRootURL, userId, auditLog); + String assetGUID = thisTest.getAsset(client, assetManagerGUID, userId); + String primitive1GUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitive1Name, primitive1DisplayName, primitive1Description, primitive1DataType); + String primitive2GUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitive2Name, primitive2DisplayName, primitive2Description, primitive2DataType); + String primitiveFromGUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitiveFromName, primitiveFromDisplayName, primitiveFromDescription, primitiveFromType); + String primitiveToGUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitiveToName, primitiveToDisplayName, primitiveToDescription, primitiveToType); + String mapGUID = thisTest.createMap(client, assetManagerGUID, assetGUID, userId, primitiveFromGUID, primitiveToGUID); + + List optionGUIDs = new ArrayList<>(); + + optionGUIDs.add(primitive1GUID); + optionGUIDs.add(primitive2GUID); + optionGUIDs.add(mapGUID); + + String schemaOptionGUID = thisTest.getSchemaOption(client, assetManagerGUID, assetGUID, userId, optionGUIDs); + + String activityName = "cascadedDelete"; + + System.out.println("activityName: " + activityName); + System.out.println("assetGUID: " + assetGUID); + System.out.println("schemaOptionGUID: " + schemaOptionGUID); + System.out.println("mapGUID: " + mapGUID); + System.out.println("primitive1GUID: " + primitive1GUID); + System.out.println("primitive2GUID: " + primitive2GUID); + System.out.println("primitiveFromGUID: " + primitiveFromGUID); + System.out.println("primitiveToGUID: " + primitiveToGUID); + + /* + * Check that all elements are deleted when the asset is deleted. + */ + try + { + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, assetGUID, null, null, false, false); + + thisTest.checkAssetGone(client, assetManagerGUID, assetGUID, activityName, userId); + thisTest.checkSchemaOptionGone(client, assetManagerGUID, schemaOptionGUID, null, activityName, userId); + thisTest.checkMapGone(client, assetManagerGUID, mapGUID, activityName, userId); + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitive1GUID, activityName, userId); + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitive2GUID, activityName, userId); + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitiveFromGUID, activityName, userId); + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitiveToGUID, activityName, userId); + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + + + /* + * Recreate asset with schema + */ + activityName= "deleteOneByOne"; + + assetGUID = thisTest.getAsset(client, assetManagerGUID, userId); + primitive1GUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitive1Name, primitive1DisplayName, primitive1Description, primitive1DataType); + primitive2GUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitive2Name, primitive2DisplayName, primitive2Description, primitive2DataType); + primitiveFromGUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitiveFromName, primitiveFromDisplayName, primitiveFromDescription, primitiveFromType); + primitiveToGUID = thisTest.createPrimitive(client, assetManagerGUID, assetGUID, userId, primitiveToName, primitiveToDisplayName, primitiveToDescription, primitiveToType); + mapGUID = thisTest.createMap(client, assetManagerGUID, assetGUID, userId, primitiveFromGUID, primitiveToGUID); + + optionGUIDs = new ArrayList<>(); + + optionGUIDs.add(primitive1GUID); + optionGUIDs.add(primitive2GUID); + optionGUIDs.add(mapGUID); + + schemaOptionGUID = thisTest.getSchemaOption(client, assetManagerGUID, assetGUID, userId, optionGUIDs); + + System.out.println("activityName: " + activityName); + System.out.println("assetGUID: " + assetGUID); + System.out.println("schemaOptionGUID: " + schemaOptionGUID); + System.out.println("mapGUID: " + mapGUID); + System.out.println("primitive1GUID: " + primitive1GUID); + System.out.println("primitive2GUID: " + primitive2GUID); + System.out.println("primitiveFromGUID: " + primitiveFromGUID); + System.out.println("primitiveToGUID: " + primitiveToGUID); + + /* + * Check that elements can be deleted one by one + */ + + try + { + client.removeSchemaType(userId, assetManagerGUID, assetManagerName, primitive1GUID, null, null, false, false); + + activityName = "deleteOneByOne - primitive 1 gone"; + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitive1GUID, activityName, userId); + thisTest.checkPrimitiveOK(client, assetManagerGUID, primitive2GUID, activityName, userId, primitive2Name, primitive2DisplayName, primitive2Description, primitive2DataType); + thisTest.checkPrimitiveOK(client, assetManagerGUID, primitiveFromGUID, activityName, userId, primitiveFromName, primitiveFromDisplayName, primitiveFromDescription, primitiveFromType); + thisTest.checkPrimitiveOK(client, assetManagerGUID, primitiveToGUID, activityName, userId, primitiveToName, primitiveToDisplayName, primitiveToDescription, primitiveToType); + thisTest.checkMapOK(client, assetManagerGUID, mapGUID, activityName, userId, primitiveFromGUID, primitiveToGUID); + optionGUIDs = new ArrayList<>(); + optionGUIDs.add(primitive2GUID); + optionGUIDs.add(mapGUID); + thisTest.checkSchemaOptionOK(client, assetManagerGUID, schemaOptionGUID, activityName, userId, assetGUID, optionGUIDs); + thisTest.checkAssetOK(client, assetManagerGUID, assetGUID, activityName, userId); + + client.removeSchemaType(userId, assetManagerGUID, assetManagerName, primitive2GUID, null, null, false, false); + + activityName = "deleteOneByOne - primitive 2 gone"; + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitive2GUID, activityName, userId); + thisTest.checkMapOK(client, assetManagerGUID, mapGUID, activityName, userId, primitiveFromGUID, primitiveToGUID); + optionGUIDs = new ArrayList<>(); + optionGUIDs.add(mapGUID); + thisTest.checkSchemaOptionOK(client, assetManagerGUID, schemaOptionGUID, activityName, userId, assetGUID, optionGUIDs); + thisTest.checkAssetOK(client, assetManagerGUID, assetGUID, activityName, userId); + + client.removeSchemaType(userId, assetManagerGUID, assetManagerName, primitiveFromGUID, null, null, false, false); + + activityName = "deleteOneByOne - primitive From gone - " + primitiveFromGUID; + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitiveFromGUID, activityName, userId); + thisTest.checkMapOK(client, assetManagerGUID, mapGUID, activityName, userId, null, primitiveToGUID); + thisTest.checkSchemaOptionOK(client, assetManagerGUID, schemaOptionGUID, activityName, userId, assetGUID, optionGUIDs); + thisTest.checkAssetOK(client, assetManagerGUID, assetGUID, activityName, userId); + + client.removeSchemaType(userId, assetManagerGUID, assetManagerName, primitiveToGUID, null, null, false, false); + + activityName = "deleteOneByOne - primitive To gone" + primitiveToGUID; + thisTest.checkPrimitiveGone(client, assetManagerGUID, primitiveToGUID, activityName, userId); + thisTest.checkMapOK(client, assetManagerGUID, mapGUID, activityName, userId, null, null); + thisTest.checkSchemaOptionOK(client, assetManagerGUID, schemaOptionGUID, activityName, userId, assetGUID, optionGUIDs); + thisTest.checkAssetOK(client, assetManagerGUID, assetGUID, activityName, userId); + + client.removeSchemaType(userId, assetManagerGUID, assetManagerName, mapGUID, null, null, false, false); + + activityName = "deleteOneByOne - map gone"; + thisTest.checkMapGone(client, assetManagerGUID, mapGUID, activityName, userId); + thisTest.checkSchemaOptionOK(client, assetManagerGUID, schemaOptionGUID, activityName, userId, assetGUID, null); + thisTest.checkAssetOK(client, assetManagerGUID, assetGUID, activityName, userId); + + client.removeSchemaType(userId, assetManagerGUID, assetManagerName, schemaOptionGUID, null, null, false, false); + + activityName = "deleteOneByOne - schema option gone"; + thisTest.checkSchemaOptionGone(client, assetManagerGUID, schemaOptionGUID, assetGUID, activityName, userId); + thisTest.checkAssetOK(client, assetManagerGUID, assetGUID, activityName, userId); + + client.removeDataAsset(userId, assetManagerGUID, assetManagerName, assetGUID, null, null, false, false); + + activityName = "deleteOneByOne - asset gone"; + thisTest.checkAssetGone(client, assetManagerGUID, assetGUID, activityName, userId); + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create and return a client. + * + * @param serverName name of the server to connect to + * @param serverPlatformRootURL the network address of the server running the OMAS REST servers + * @param auditLog logging destination + * @return client + * @throws FVTUnexpectedCondition the test case failed + */ + private DataAssetExchangeClient getDataAssetExchangeClient(String serverName, + String serverPlatformRootURL, + AuditLog auditLog) throws FVTUnexpectedCondition + { + final String activityName = "getSchemaManagerClient"; + + try + { + AssetManagerRESTClient restClient = new AssetManagerRESTClient(serverName, serverPlatformRootURL); + + return new DataAssetExchangeClient(serverName, serverPlatformRootURL, restClient, maxPageSize, auditLog); + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create a schema manager entity and return its GUID. + * + * @param serverName name of the server to connect to + * @param serverPlatformRootURL the network address of the server running the OMAS REST servers + * @param userId calling user + * @param auditLog logging destination + * @return unique identifier of the schema manager entity + * @throws FVTUnexpectedCondition the test case failed + */ + private String getAssetManager(String serverName, + String serverPlatformRootURL, + String userId, + AuditLog auditLog) throws FVTUnexpectedCondition + { + final String activityName = "getAssetManager"; + + try + { + AssetManagerRESTClient restClient = new AssetManagerRESTClient(serverName, serverPlatformRootURL); + ExternalAssetManagerClient client = new ExternalAssetManagerClient(serverName, serverPlatformRootURL, restClient, maxPageSize, auditLog); + + AssetManagerProperties properties = new AssetManagerProperties(); + properties.setQualifiedName(assetManagerName); + properties.setDisplayName(assetManagerDisplayName); + properties.setDescription(assetManagerDescription); + properties.setTypeDescription(assetManagerTypeDescription); + properties.setVersion(assetManagerVersion); + + String assetManagerGUID = client.createExternalAssetManager(userId, properties); + + if (assetManagerGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no GUID for Create)"); + } + + String retrievedAssetManagerGUID = client.getExternalAssetManagerGUID(userId, assetManagerName); + + if (retrievedAssetManagerGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no GUID for Retrieve)"); + } + + if (! retrievedAssetManagerGUID.equals(assetManagerGUID)) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Inconsistent GUIDs)"); + } + + return assetManagerGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check the asset is gone. + * + * @param client interface to Asset Manager OMAS + * @param assetGUID unique id of the asset to test + * @param activityName name of calling activity + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkAssetGone(DataAssetExchangeClient client, + String assetManagerGUID, + String assetGUID, + String activityName, + String userId) throws FVTUnexpectedCondition + { + try + { + DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, assetGUID, null, false, false); + + if (retrievedElement != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Asset returned from Retrieve)"); + } + + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Retrieve returned)"); + } + catch (InvalidParameterException expectedException) + { + // all ok + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + + /** + * Check asset is ok. + * + * @param client interface to Asset Manager OMAS + * @param assetGUID unique id of the asset + * @param activityName name of calling activity + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkAssetOK(DataAssetExchangeClient client, + String assetManagerGUID, + String assetGUID, + String activityName, + String userId) throws FVTUnexpectedCondition + { + try + { + DataAssetElement retrievedElement = client.getDataAssetByGUID(userId, assetManagerGUID, assetManagerName, assetGUID, null, false, false); + + if (retrievedElement == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no AssetElement from Retrieve)"); + } + + System.out.println("Asset Element: " + retrievedElement); + validateAnchorGUID(activityName, retrievedElement); + + DataAssetProperties retrievedAsset = retrievedElement.getDataAssetProperties(); + + if (retrievedAsset == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no assetProperties from Retrieve)"); + } + + if (! assetName.equals(retrievedAsset.getQualifiedName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from Retrieve)"); + } + if (! assetDisplayName.equals(retrievedAsset.getDisplayName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from Retrieve)"); + } + if (! assetDescription.equals(retrievedAsset.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from Retrieve)"); + } + + List assetList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, assetName, 0, maxPageSize, null, false, false); + + if (assetList == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no Asset for RetrieveByName)"); + } + else if (assetList.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty Asset list for RetrieveByName)"); + } + else if (assetList.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + "(Asset list for RetrieveByName contains" + assetList.size() + + " elements)"); + } + + retrievedElement = assetList.get(0); + retrievedAsset = retrievedElement.getDataAssetProperties(); + + if (! assetName.equals(retrievedAsset.getQualifiedName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from RetrieveByName)"); + } + if (! assetDisplayName.equals(retrievedAsset.getDisplayName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from RetrieveByName)"); + } + if (! assetDescription.equals(retrievedAsset.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from RetrieveByName)"); + } + + assetList = client.getDataAssetsByName(userId, assetManagerGUID, assetManagerName, assetName, 1, maxPageSize, null, false, false); + + if (assetList != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no Asset for RetrieveByName)"); + } + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create an asset and return its GUID. + * + * @param client interface to Asset Manager OMAS + * @param assetManagerGUID unique id of the schema manager + * @param userId calling user + * @return GUID of asset + * @throws FVTUnexpectedCondition the test case failed + */ + private String getAsset(DataAssetExchangeClient client, + String assetManagerGUID, + String userId) throws FVTUnexpectedCondition + { + final String activityName = "getAsset"; + + try + { + DataAssetProperties properties = new DataAssetProperties(); + + properties.setQualifiedName(assetName); + properties.setDisplayName(assetDisplayName); + properties.setDescription(assetDescription); + + properties.setTypeName("AvroFile"); + + String assetGUID = client.createDataAsset(userId, assetManagerGUID, assetManagerName, true, null, properties); + + if (assetGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no GUID for Create)"); + } + else + { + checkAssetOK(client, assetManagerGUID, assetGUID, activityName, userId); + } + + return assetGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check a schema option is gone. + * + * @param client interface to Asset Manager OMAS + * @param schemaOptionGUID unique id of the schema to test + * @param assetGUID unique id of the asset to test + * @param activityName name of calling activity + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkSchemaOptionGone(DataAssetExchangeClient client, + String assetManagerGUID, + String schemaOptionGUID, + String assetGUID, + String activityName, + String userId) throws FVTUnexpectedCondition + { + try + { + SchemaTypeElement retrievedElement = client.getSchemaTypeByGUID(userId, assetManagerGUID, assetManagerName, schemaOptionGUID, null, false, false); + + if (retrievedElement != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(SchemaOption returned from Retrieve)"); + } + + throw new FVTUnexpectedCondition(testCaseName, activityName + "(getSchemaOptionByGUID returned"); + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (InvalidParameterException expectedError) + { + // all ok + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + + if (assetGUID != null) + { + try + { + /* + * Only one schema created so nothing should be tied to the asset. + */ + SchemaTypeElement assetSchemaType = client.getSchemaTypeForElement(userId, assetManagerGUID, assetManagerName, assetGUID,"Asset", null, false, false); + + if (assetSchemaType != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(No SchemaOption returned for getSchemaTypeForElement)"); + } + } + catch(FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch(Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + } + + + /** + * Check a schema choice is correctly stored. + * + * @param client interface to Asset Manager OMAS + * @param schemaOptionGUID unique id of the schema + * @param activityName name of calling activity + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkSchemaOptionOK(DataAssetExchangeClient client, + String assetManagerGUID, + String schemaOptionGUID, + String activityName, + String userId, + String assetGUID, + List optionGUIDs) throws FVTUnexpectedCondition + { + try + { + SchemaTypeElement retrievedElement = client.getSchemaTypeByGUID(userId, assetManagerGUID, assetManagerName, schemaOptionGUID, null, false, false); + + this.validateSchemaOption(activityName + "(getSchemaTypeByGUID)", retrievedElement); + + List schemaOptionList = client.getSchemaTypeByName(userId, assetManagerGUID, assetManagerName, optionSchemaName, 0, maxPageSize, null, false, false); + + if (schemaOptionList == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no SchemaOption for RetrieveByName)"); + } + else if (schemaOptionList.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty SchemaOption list for RetrieveByName)"); + } + else if (schemaOptionList.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + "(SchemaOption list for RetrieveByName contains" + schemaOptionList.size() + + " elements)"); + } + + validateSchemaOption(activityName, schemaOptionList.get(0)); + + if (assetGUID != null) + { + retrievedElement = client.getSchemaTypeForElement(userId, + assetManagerGUID, + assetManagerName, + assetGUID, + "Asset", + null, + false, + false); + + this.validateSchemaOption(activityName + "(getSchemaTypeForElement)", retrievedElement); + } + + if (optionGUIDs != null) + { + List optionElements = retrievedElement.getSchemaOptions(); + + if (optionElements == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no attached SchemaOption Elements)"); + } + else if (optionElements.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty attached SchemaOption Elements)"); + } + else if (optionElements.size() != optionGUIDs.size()) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + "(Attached SchemaOption Elements contains" + optionElements.size() + + " elements)"); + } + + for (SchemaTypeElement optionElement : optionElements) + { + if (! optionGUIDs.contains(optionElement.getElementHeader().getGUID())) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + "(Bad SchemaOption Element: " + optionElement + " not in " + optionGUIDs + ")"); + } + } + } + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + private void validateSchemaOption(String activityName, + SchemaTypeElement retrievedElement) throws FVTUnexpectedCondition + { + if (retrievedElement == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - no SchemaOptionElement)"); + } + + System.out.println("Schema Option Element: " + retrievedElement); + validateAnchorGUID(activityName, retrievedElement); + + SchemaTypeProperties retrievedSchema = retrievedElement.getSchemaTypeProperties(); + + if (retrievedSchema == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "- no SchemaOptionProperties"); + } + + if (! optionSchemaName.equals(retrievedSchema.getQualifiedName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad qualifiedName"); + } + if (! optionSchemaDisplayName.equals(retrievedSchema.getDisplayName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad displayName"); + } + if (! optionSchemaDescription.equals(retrievedSchema.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " - Bad description"); + } + } + + + /** + * Create a schema type choice and return its GUID. + * + * @param client interface to Asset Manager OMAS + * @param assetManagerGUID unique id of the schema manager + * @param assetGUID unique id of the asset + * @param userId calling user + * @return GUID of schema option + * @throws FVTUnexpectedCondition the test case failed + */ + private String getSchemaOption(DataAssetExchangeClient client, + String assetManagerGUID, + String assetGUID, + String userId, + List optionGUIDs) throws FVTUnexpectedCondition + { + final String activityName = "getSchemaOption"; + + try + { + SchemaTypeProperties properties = new SchemaTypeProperties(); + + properties.setQualifiedName(optionSchemaName); + properties.setDisplayName(optionSchemaDisplayName); + properties.setDescription(optionSchemaDescription); + properties.setTypeName("SchemaTypeChoice"); + + String schemaOptionGUID = client.createAnchoredSchemaType(userId, assetManagerGUID, assetManagerName, true, assetGUID,null, false, false, properties); + + if (schemaOptionGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no GUID for schemaCreate)"); + } + else + { + client.setupSchemaTypeParent(userId, assetManagerGUID, assetManagerName, true, schemaOptionGUID, assetGUID, "Asset", null, false, false, null); + + if (optionGUIDs != null) + { + for (String optionGUID : optionGUIDs) + { + client.setupSchemaElementRelationship(userId, assetManagerGUID, assetManagerName, true, schemaOptionGUID, optionGUID, "SchemaTypeOption", null, false, false, null); + } + } + + checkSchemaOptionOK(client, assetManagerGUID, schemaOptionGUID, activityName, userId, assetGUID, optionGUIDs); + } + + return schemaOptionGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check a map is gone. + * + * @param client interface to Asset Manager OMAS + * @param assetManagerGUID unique id of the schema manager + * @param mapGUID unique id of the map to test + * @param activityName name of calling activity + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkMapGone(DataAssetExchangeClient client, + String assetManagerGUID, + String mapGUID, + String activityName, + String userId) throws FVTUnexpectedCondition + { + try + { + SchemaTypeElement retrievedElement = client.getSchemaTypeByGUID(userId, assetManagerGUID, assetManagerName, mapGUID, null, false,false); + + if (retrievedElement != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Map returned from Retrieve)"); + } + + throw new FVTUnexpectedCondition(testCaseName, activityName + "(getMapByGUID returned"); + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (InvalidParameterException expectedError) + { + // all ok + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check a map is stored OK. + * + * @param client interface to Asset Manager OMAS + * @param mapGUID unique id of the schemaOption + * @param activityName name of calling activity + * @param userId calling user + * @param mapFromGUID schema type to map from + * @param mapToGUID schema type to map to + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkMapOK(DataAssetExchangeClient client, + String assetManagerGUID, + String mapGUID, + String activityName, + String userId, + String mapFromGUID, + String mapToGUID) throws FVTUnexpectedCondition + { + + try + { + SchemaTypeElement retrievedElement = client.getSchemaTypeByGUID(userId, assetManagerGUID, assetManagerName, mapGUID, null, false, false); + + if (retrievedElement == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no MapElement from Retrieve)"); + } + + System.out.println("Map Element: " + retrievedElement); + validateAnchorGUID(activityName, retrievedElement); + + SchemaTypeProperties retrievedMap = retrievedElement.getSchemaTypeProperties(); + + if (retrievedMap == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no MapProperties from Retrieve)"); + } + + if (! mapName.equals(retrievedMap.getQualifiedName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from Retrieve)"); + } + if (! mapDisplayName.equals(retrievedMap.getDisplayName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from Retrieve)"); + } + if (! mapDescription.equals(retrievedMap.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from Retrieve)"); + } + + List mapList = client.getSchemaTypeByName(userId, assetManagerGUID, assetManagerName, mapName, 0, maxPageSize, null, false, false); + + if (mapList == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no Map for RetrieveByName)"); + } + else if (mapList.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Empty Map list for RetrieveByName)"); + } + else if (mapList.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + "(Map list for RetrieveByName contains" + mapList.size() + + " elements)"); + } + + retrievedElement = mapList.get(0); + retrievedMap = retrievedElement.getSchemaTypeProperties(); + + if (! mapName.equals(retrievedMap.getQualifiedName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad qualifiedName from RetrieveByName)"); + } + if (! mapDisplayName.equals(retrievedMap.getDisplayName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad displayName from RetrieveByName)"); + } + if (! mapDescription.equals(retrievedMap.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad description from RetrieveByName)"); + } + + if ((mapFromGUID == null) && (retrievedElement.getMapFromElement() != null)) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Unexpected MapFrom from RetrieveByName) Retrieved element is: " + retrievedElement); + } + + if ((mapFromGUID != null) && (! mapFromGUID.equals(retrievedElement.getMapFromElement().getElementHeader().getGUID()))) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad MapFrom from RetrieveByName) Retrieved element is: " + retrievedElement); + } + + if ((mapToGUID == null) && (retrievedElement.getMapToElement() != null)) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Unexpected MapTo from RetrieveByName) Retrieved element is: " + retrievedElement); + } + + if ((mapToGUID != null) && (! mapToGUID.equals(retrievedElement.getMapToElement().getElementHeader().getGUID()))) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Bad MapTo from RetrieveByName) Retrieved element is: " + retrievedElement); + } + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create a map and return its GUID. + * + * @param client interface to Asset Manager OMAS + * @param assetManagerGUID unique id of the schema manager + * @param assetGUID unique identifier of anchor asset + * @param userId calling user + * @param mapFromGUID schema type to map from + * @param mapToGUID schema type to map to + * @return GUID of map + * @throws FVTUnexpectedCondition the test case failed + */ + private String createMap(DataAssetExchangeClient client, + String assetManagerGUID, + String assetGUID, + String userId, + String mapFromGUID, + String mapToGUID) throws FVTUnexpectedCondition + { + final String activityName = "createMap"; + + try + { + SchemaTypeProperties properties = new SchemaTypeProperties(); + + properties.setQualifiedName(mapName); + properties.setDisplayName(mapDisplayName); + properties.setDescription(mapDescription); + properties.setTypeName("MapSchemaType"); + + String mapGUID = client.createAnchoredSchemaType(userId, assetManagerGUID, assetManagerName, true, assetGUID, null, false, false, properties); + + if (mapGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no GUID for mapCreate)"); + } + + if (mapFromGUID != null) + { + client.setupSchemaElementRelationship(userId, assetManagerGUID, assetManagerName, true, mapGUID, mapFromGUID, "MapFromElementType", null, false, false, null); + } + + if (mapToGUID != null) + { + client.setupSchemaElementRelationship(userId, assetManagerGUID, assetManagerName, true, mapGUID, mapToGUID, "MapToElementType", null, false, false, null); + } + + checkMapOK(client, assetManagerGUID, mapGUID, activityName, userId, mapFromGUID, mapToGUID); + + return mapGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check a primitive is gone. + * + * @param client interface to Asset Manager OMAS + * @param primitiveGUID unique id of the primitive to test + * @param activityName name of calling activity + * @param userId calling user + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkPrimitiveGone(DataAssetExchangeClient client, + String assetManagerGUID, + String primitiveGUID, + String activityName, + String userId) throws FVTUnexpectedCondition + { + try + { + SchemaTypeElement retrievedElement = client.getSchemaTypeByGUID(userId, assetManagerGUID, assetManagerName, primitiveGUID, null, false, false); + + if (retrievedElement != null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(Primitive returned from Retrieve)"); + } + + throw new FVTUnexpectedCondition(testCaseName, activityName + "(getPrimitiveByGUID returned"); + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (InvalidParameterException expectedError) + { + // all ok + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Check a primitive + * + * @param client interface to Asset Manager OMAS + * @param primitiveGUID unique id of the primitive to test + * @param activityName name of calling activity + * @param userId calling user + * @param primitiveName qualified name of primitive + * @param primitiveDisplayName display name of primitive + * @param primitiveDescription description of primitive + * @param primitiveDataType data type of primitive + * @throws FVTUnexpectedCondition the test case failed + */ + private void checkPrimitiveOK(DataAssetExchangeClient client, + String assetManagerGUID, + String primitiveGUID, + String activityName, + String userId, + String primitiveName, + String primitiveDisplayName, + String primitiveDescription, + String primitiveDataType) throws FVTUnexpectedCondition + { + try + { + SchemaTypeElement retrievedElement = client.getSchemaTypeByGUID(userId, assetManagerGUID, assetManagerName, primitiveGUID, null, false, false); + + if (retrievedElement == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (no PrimitiveElement from Retrieve)"); + } + + System.out.println("Primitive: " + retrievedElement); + validateAnchorGUID(activityName, retrievedElement); + + SchemaTypeProperties retrievedType = retrievedElement.getSchemaTypeProperties(); + + if (retrievedType == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (no PrimitiveProperties from Retrieve). Element is " + retrievedElement); + } + + if (! primitiveName.equals(retrievedType.getQualifiedName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (Bad qualifiedName " + primitiveName + " from Retrieve). Element is " + retrievedElement); + } + if (! primitiveDisplayName.equals(retrievedType.getDisplayName())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (Bad displayName from Retrieve). Element is " + retrievedElement); + } + if (! primitiveDescription.equals(retrievedType.getDescription())) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (Bad description from Retrieve). Element is " + retrievedElement); + } + + Map extendedProperties = retrievedType.getExtendedProperties(); + + if (extendedProperties == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (Bad extendedProperties from Retrieve). Element is " + retrievedElement); + } + else if (! primitiveDataType.equals(extendedProperties.get("dataType"))) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (Bad data type from Retrieve). Element is " + retrievedElement); + } + + List primitiveList = client.getSchemaTypeByName(userId, null, null, primitiveName, 0, maxPageSize, null, false, false); + + if (primitiveList == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (no Primitive for RetrieveByName). Element is " + retrievedElement); + } + else if (primitiveList.isEmpty()) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + " (Empty Primitive list for RetrieveByName). Element is \" + retrievedElement"); + } + else if (primitiveList.size() != 1) + { + throw new FVTUnexpectedCondition(testCaseName, + activityName + " (Primitive list for RetrieveByName contains" + primitiveList.size() + + " elements)"); + } + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + /** + * Create a primitive and return its GUID. + * + * @param client interface to Asset Manager OMAS + * @param assetManagerGUID unique id of the schema manager + * @param assetGUID unique id of the map to connect the column to + * @param userId calling user + * @param primitiveName qualified name of primitive + * @param primitiveDisplayName display name of primitive + * @param primitiveDescription description of primitive + * @param primitiveDataType data type of primitive + * @return GUID of schema + * @throws FVTUnexpectedCondition the test case failed + */ + private String createPrimitive(DataAssetExchangeClient client, + String assetManagerGUID, + String assetGUID, + String userId, + String primitiveName, + String primitiveDisplayName, + String primitiveDescription, + String primitiveDataType) throws FVTUnexpectedCondition + { + final String activityName = "createPrimitive"; + + try + { + SchemaTypeProperties properties = new SchemaTypeProperties(); + + properties.setQualifiedName(primitiveName); + properties.setDisplayName(primitiveDisplayName); + properties.setDescription(primitiveDescription); + + Map extendedProperties = new HashMap<>(); + + extendedProperties.put("dataType", primitiveDataType); + + properties.setTypeName("PrimitiveSchemaType"); + properties.setExtendedProperties(extendedProperties); + + String primitiveGUID = client.createAnchoredSchemaType(userId, assetManagerGUID, assetManagerName, true, assetGUID, null, false, false, properties); + + if (primitiveGUID == null) + { + throw new FVTUnexpectedCondition(testCaseName, activityName + "(no GUID for columnCreate)"); + } + else + { + checkPrimitiveOK(client, assetManagerGUID, primitiveGUID, activityName, userId, primitiveName, primitiveDisplayName, primitiveDescription, primitiveDataType); + } + + return primitiveGUID; + } + catch (FVTUnexpectedCondition testCaseError) + { + throw testCaseError; + } + catch (Exception unexpectedError) + { + throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); + } + } + + + private void validateAnchorGUID(String activityName, + MetadataElement metadataElement) + { + if (metadataElement.getElementHeader() != null) + { + if (metadataElement.getElementHeader().getClassifications() != null) + { + for (ElementClassification classification : metadataElement.getElementHeader().getClassifications()) + { + if ("Anchors".equals(classification.getClassificationName())) + { + System.out.println(metadataElement.getElementHeader().getType().getTypeName() + " element " + metadataElement.getElementHeader().getGUID() + " has anchor of " + classification.getClassificationProperties() + " in activity " + activityName); + } + } + } + } + } +} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/execution/AssetManagerOMASCreateDatabaseIT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/execution/AssetManagerOMASCreateDatabaseIT.java new file mode 100644 index 00000000000..7ac5054dab7 --- /dev/null +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/execution/AssetManagerOMASCreateDatabaseIT.java @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.accessservices.assetmanager.fvt.execution; + +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.odpi.openmetadata.accessservices.assetmanager.fvt.dataassets.CreateDatabaseTest; +import org.odpi.openmetadata.fvt.utilities.FVTConstants; +import org.odpi.openmetadata.fvt.utilities.FVTResults; +import org.odpi.openmetadata.http.HttpHelper; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * AssetManagerOMASCreateDatabaseIT is the failsafe wrapper for CreateDatabaseTest. + */ +public class AssetManagerOMASCreateDatabaseIT +{ + @BeforeAll + public static void disableStrictSSL(){ + HttpHelper.noStrictSSL(); + } + + @ParameterizedTest + @ValueSource(strings = {FVTConstants.IN_MEMORY_SERVER}) + public void testDatabase(String serverName) + { + FVTResults results = CreateDatabaseTest.performFVT(serverName, StringUtils.defaultIfEmpty(System.getProperty("fvt.url"), FVTConstants.SERVER_PLATFORM_URL_ROOT), FVTConstants.USERID); + + results.printResults(serverName); + assertTrue(results.isSuccessful()); + } +} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/execution/AssetManagerOMASCreateSchemasIT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/execution/AssetManagerOMASCreateSchemasIT.java new file mode 100644 index 00000000000..1c146342c02 --- /dev/null +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/java/org/odpi/openmetadata/accessservices/assetmanager/fvt/execution/AssetManagerOMASCreateSchemasIT.java @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ + +package org.odpi.openmetadata.accessservices.assetmanager.fvt.execution; + +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.odpi.openmetadata.accessservices.assetmanager.fvt.dataassets.CreateSchemasTest; +import org.odpi.openmetadata.fvt.utilities.FVTConstants; +import org.odpi.openmetadata.fvt.utilities.FVTResults; +import org.odpi.openmetadata.http.HttpHelper; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * AssetManagerOMASCreateSchemasIT is the failsafe wrapper for CreateDatabaseTest and CreateSchemasTest. + */ +public class AssetManagerOMASCreateSchemasIT +{ + @BeforeAll + public static void disableStrictSSL(){ + HttpHelper.noStrictSSL(); + } + + + @ParameterizedTest + @ValueSource(strings = {FVTConstants.IN_MEMORY_SERVER}) + public void testExoticSchemaTypes(String serverName) + { + FVTResults results = CreateSchemasTest.performFVT(serverName, StringUtils.defaultIfEmpty(System.getProperty("fvt.url"), FVTConstants.SERVER_PLATFORM_URL_ROOT), FVTConstants.USERID); + + results.printResults(serverName); + assertTrue(results.isSuccessful()); + } +} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy index 36a62e6687e..3d1ec28d9cb 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy @@ -102,7 +102,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/build.gradle index 449eb862a97..e27d1179510 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/build.gradle @@ -55,13 +55,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10445", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -76,7 +76,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/assets/CreateAssetTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/assets/CreateAssetTest.java index 90d422b6be5..bbd8119f61c 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/assets/CreateAssetTest.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/assets/CreateAssetTest.java @@ -7,7 +7,7 @@ import org.odpi.openmetadata.accessservices.assetowner.client.rest.AssetOwnerRESTClient; import org.odpi.openmetadata.accessservices.assetowner.metadataelements.AssetElement; import org.odpi.openmetadata.accessservices.assetowner.properties.AssetProperties; -import org.odpi.openmetadata.accessservices.assetowner.properties.PrimitiveSchemaTypeProperties; +import org.odpi.openmetadata.accessservices.assetowner.properties.SchemaTypeProperties; import org.odpi.openmetadata.accessservices.assetowner.properties.TemplateProperties; import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; @@ -682,15 +682,20 @@ private String getSchemaType(AssetOwner client, try { - PrimitiveSchemaTypeProperties properties = new PrimitiveSchemaTypeProperties(); + SchemaTypeProperties properties = new SchemaTypeProperties(); properties.setQualifiedName(schemaTypeName); properties.setDisplayName(schemaTypeDisplayName); properties.setDescription(schemaTypeDescription); - properties.setDataType(schemaTypeType); - properties.setDefaultValue(schemaTypeDefaultValue); properties.setTypeName("PrimitiveSchemaType"); + Map extendedProperties = new HashMap<>(); + + extendedProperties.put("dataType", schemaTypeType); + extendedProperties.put("defaultValue", schemaTypeDefaultValue); + + properties.setExtendedProperties(extendedProperties); + String schemaTypeGUID = client.addSchemaTypeToAsset(userId, assetGUID, properties); if (schemaTypeGUID == null) diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/duplicateprocessing/DuplicateAssetTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/duplicateprocessing/DuplicateAssetTest.java index 83799678606..515936e37c5 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/duplicateprocessing/DuplicateAssetTest.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/main/java/org/odpi/openmetadata/accessservices/assetowner/fvt/duplicateprocessing/DuplicateAssetTest.java @@ -7,7 +7,7 @@ import org.odpi.openmetadata.accessservices.assetowner.client.rest.AssetOwnerRESTClient; import org.odpi.openmetadata.accessservices.assetowner.metadataelements.AssetElement; import org.odpi.openmetadata.accessservices.assetowner.properties.AssetProperties; -import org.odpi.openmetadata.accessservices.assetowner.properties.PrimitiveSchemaTypeProperties; +import org.odpi.openmetadata.accessservices.assetowner.properties.SchemaTypeProperties; import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.fvt.utilities.FVTResults; @@ -268,15 +268,20 @@ private String getSchemaType(AssetOwner client, try { - PrimitiveSchemaTypeProperties properties = new PrimitiveSchemaTypeProperties(); + SchemaTypeProperties properties = new SchemaTypeProperties(); properties.setQualifiedName(schemaTypeName); properties.setDisplayName(schemaTypeDisplayName); properties.setDescription(schemaTypeDescription); - properties.setDataType(schemaTypeType); - properties.setDefaultValue(schemaTypeDefaultValue); properties.setTypeName("PrimitiveSchemaType"); + Map extendedProperties = new HashMap<>(); + + extendedProperties.put("dataType", schemaTypeType); + extendedProperties.put("defaultValue", schemaTypeDefaultValue); + + properties.setExtendedProperties(extendedProperties); + String schemaTypeGUID = client.addSchemaTypeToAsset(userId, assetGUID, properties); if (schemaTypeGUID == null) diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy index 555f195f4fe..c3b89b1187e 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy @@ -120,7 +120,7 @@ if(addConnectorTypeArchiveToInMemoryServerResponse.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle index c5012466cd4..6063ecab9d0 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/build.gradle @@ -53,13 +53,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10441", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -74,7 +74,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy index 95b9763da6a..ba7cb233bd1 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy @@ -101,7 +101,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/build.gradle index 9e0166814d6..087ee36f87a 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/build.gradle @@ -60,12 +60,12 @@ sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=" + port, - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -83,7 +83,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/build.gradle index ed00c1d6793..4c84058ad84 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/build.gradle @@ -54,13 +54,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10446", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -76,7 +76,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy index 64e81aaf6ae..cf0a038be38 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy @@ -120,7 +120,7 @@ if(addConnectorTypeArchiveToInMemoryServerResponse.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/build.gradle index c6baa5de678..c38aaa5b476 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/build.gradle @@ -51,13 +51,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10447", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -72,7 +72,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy index 14941903b0f..a7a4678ca9f 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy @@ -101,7 +101,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/build.gradle index b696c6687fc..6d16b6abd9e 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/build.gradle @@ -56,13 +56,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10450", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -77,7 +77,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/main/java/org/odpi/openmetadata/accessservices/discoveryengine/fvt/discovery/CreateDiscoveryReportTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/main/java/org/odpi/openmetadata/accessservices/discoveryengine/fvt/discovery/CreateDiscoveryReportTest.java index 38589673d15..aa2cf8faef4 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/main/java/org/odpi/openmetadata/accessservices/discoveryengine/fvt/discovery/CreateDiscoveryReportTest.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/main/java/org/odpi/openmetadata/accessservices/discoveryengine/fvt/discovery/CreateDiscoveryReportTest.java @@ -6,7 +6,7 @@ import org.odpi.openmetadata.accessservices.assetowner.client.AssetOwner; import org.odpi.openmetadata.accessservices.assetowner.client.rest.AssetOwnerRESTClient; import org.odpi.openmetadata.accessservices.assetowner.properties.AssetProperties; -import org.odpi.openmetadata.accessservices.assetowner.properties.PrimitiveSchemaTypeProperties; +import org.odpi.openmetadata.accessservices.assetowner.properties.SchemaTypeProperties; import org.odpi.openmetadata.accessservices.discoveryengine.client.DiscoveryAnalysisReportClient; import org.odpi.openmetadata.accessservices.discoveryengine.client.DiscoveryEngineClient; import org.odpi.openmetadata.accessservices.discoveryengine.client.rest.ODFRESTClient; @@ -246,15 +246,20 @@ private String getSchemaType(AssetOwner client, try { - PrimitiveSchemaTypeProperties properties = new PrimitiveSchemaTypeProperties(); + SchemaTypeProperties properties = new SchemaTypeProperties(); properties.setQualifiedName(schemaTypeName); properties.setDisplayName(schemaTypeDisplayName); properties.setDescription(schemaTypeDescription); - properties.setDataType(schemaTypeType); - properties.setDefaultValue(schemaTypeDefaultValue); properties.setTypeName("PrimitiveSchemaType"); + Map extendedProperties = new HashMap<>(); + + extendedProperties.put("dataType", schemaTypeType); + extendedProperties.put("defaultValue", schemaTypeDefaultValue); + + properties.setExtendedProperties(extendedProperties); + String schemaTypeGUID = client.addSchemaTypeToAsset(userId, assetGUID, properties); if (schemaTypeGUID == null) diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy index 8f98c1ee689..0b04d68d491 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy @@ -113,7 +113,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/build.gradle index 93387992649..dbbcc4ae7e7 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/build.gradle @@ -56,13 +56,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10451", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -77,7 +77,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy index 6d27c66e665..b06db9803b0 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy @@ -102,7 +102,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/build.gradle index a5c4f0af24b..d88b7c2972c 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/build.gradle @@ -56,13 +56,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10452", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -77,7 +77,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy index b60de1fda87..13f0624de16 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy @@ -126,7 +126,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/build.gradle index 0fb99ea3402..00fbf9c8847 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/build.gradle @@ -55,13 +55,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10455", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -76,7 +76,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad } // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy index 93ef03c9711..c7132a02e6c 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy @@ -113,7 +113,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/build.gradle index 9efb1daefdd..d47f5da2f68 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/build.gradle @@ -49,13 +49,13 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') args = [ "-Dserver.port=10448", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", "-jar", "${distdir}/platform/omag-server-platform-${project.version}.jar" ] @@ -71,7 +71,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy index 9a1bd15da57..4d211d3f255 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy @@ -58,6 +58,7 @@ while (!connected && i>0) System.out.println("=== Checking platform at " + baseURL + " is available (" + i + " attempts remaining) ==="); post0 = new java.net.URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/origin").openConnection(); + post0.setRequestMethod("GET") post0RC = post0.getResponseCode(); println(post0RC); if (post0RC.equals(200)) { @@ -75,7 +76,7 @@ while (!connected && i>0) } } -// -- Inmemory +// -- Graph repository // --- Configure the platform - any errors here and we exit System.out.println("=== Configuring server: " + serverMem + " ==="); @@ -101,7 +102,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") postRC3 = post3.getResponseCode(); diff --git a/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/build.gradle index 074abfd8a9a..e6160f4e682 100644 --- a/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/build.gradle @@ -57,7 +57,7 @@ sourceSets.test.java.srcDirs = [] sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] // Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { +task startPlatform(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { // Start some external service executable = System.properties.'java.home' + '/bin/java' workingDir = layout.buildDirectory.dir('run') @@ -65,7 +65,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad // the keystore is needed as for the FVT the glossary author view is a client for the subject ares service //remove the two -Dlogging args if you dont want debug level of logging args = [ "-Dserver.port=${gaport}", - "-Dloader.path=${distdir}/server/lib", + "-Dloader.path=${distdir}/platform/lib", "-Dspring.config.location=../../../../../../test.application.properties", // "-Dserver.ssl.key-store=${distDir}/keystore.p12", // "-Dserver.ssl.key-store-password=egeria", @@ -91,7 +91,7 @@ task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metad // Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { +task configServer(dependsOn: ['startPlatform','classes'], type: JavaExec) { mainClass = 'configureStartServer' classpath = sourceSets.test.runtimeClasspath //TODO: These parms aren't currently correctly passed. We rely on defaults in the script diff --git a/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy index 498e6516102..5be7efbf919 100755 --- a/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy @@ -107,7 +107,7 @@ if(postRC2.equals(200)) { // --- Launch the server - any errors here and we exit System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() +post3 = new URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/servers/" + serverMem + "/instance" ).openConnection() post3.setRequestMethod("POST") post3.setRequestProperty("Content-Type", "application/json") diff --git a/test.application.properties b/test.application.properties index 5721ac136eb..7087d5a95b5 100644 --- a/test.application.properties +++ b/test.application.properties @@ -2,8 +2,8 @@ # Copyright Contributors to the ODPi Egeria project. # ======================================================================================================== -# The application.properties file is used to configure the OMAG Server Platform which is implemented as -# a spring boot application. +# This application.properties file is for the FVTs. It uses a relative path name to find the +# default certificates. ################################################ ### SSL security. @@ -24,44 +24,17 @@ server.ssl.trust-store-password=egeria # Alternate you can import self signed certificates into java truststore or setup an truststore only for this app # by adding the store into server.ssl.trust-store parameter strict.ssl=false -# Comma separated values of http headers to be added to ThreadLocal -header.name.list= -################################################ -### Which java packages should be scanned to locate the Spring resource definitions that define the REST APIs? -################################################ -scan.packages=org.odpi.openmetadata.* - -################################################ -### startup servers configuration -################################################ -#userId used to start up the list of configured servers default is 'system' -startup.user=system -# Comma separated names of servers to be started. The server names should be unquoted. -startup.server.list= ################################################ ### Logging ################################################ logging.level.root=OFF logging.level.org.springframework=ERROR -#logging.level.org.odpi.openmetadata.commonservices=DEBUG -#logging.level.org.odpi.openmetadata.accessservices.subjectarea.handlers=DEBUG logging.level.org.springframework.boot.web.embedded.tomcat=INFO +logging.level.org.odpi.openmetadata=ERROR logging.level.org.odpi.openmetadata.serverchassis.springboot=INFO -################################################ -### Swagger Docs -################################################ -springdoc.version='@springdoc.version@' -springdoc.api-docs.enabled=false -springdoc.api-docs.path=/v3/api-docs -springdoc.swagger-ui.path=/swagger-ui.html -springdoc.swagger-ui.displayRequestDuration=true -springdoc.swagger-ui.tagsSorter=alpha -springdoc.swagger-ui.operationsSorter=alpha -springdoc.swagger-ui.docExpansion=none - ################################################ ### Spring Boot Actuator ################################################