From 2ed0d12a25ede960ffe75d655c7674cf001091ed Mon Sep 17 00:00:00 2001 From: Mandy Chessell Date: Fri, 16 Dec 2022 09:22:58 +0000 Subject: [PATCH 1/3] Only set qualifiedName if not null Signed-off-by: Mandy Chessell --- .../properties/instances/EntityProxy.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EntityProxy.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EntityProxy.java index 01f24cc632e..46d28f2982b 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EntityProxy.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EntityProxy.java @@ -82,17 +82,20 @@ else if (template instanceof EntityDetail) { InstancePropertyValue qualifiedName = entityDetail.getProperties().getPropertyValue(qualifiedNameProperty); - InstanceProperties properties = new InstanceProperties(); + if (qualifiedName != null) + { + InstanceProperties properties = new InstanceProperties(); - Map propertyValueMap = new HashMap<>(); + Map propertyValueMap = new HashMap<>(); - propertyValueMap.put(qualifiedNameProperty, qualifiedName); + propertyValueMap.put(qualifiedNameProperty, qualifiedName); - properties.setInstanceProperties(propertyValueMap); - properties.setEffectiveFromTime(entityDetail.getProperties().getEffectiveFromTime()); - properties.setEffectiveToTime(entityDetail.getProperties().getEffectiveToTime()); + properties.setInstanceProperties(propertyValueMap); + properties.setEffectiveFromTime(entityDetail.getProperties().getEffectiveFromTime()); + properties.setEffectiveToTime(entityDetail.getProperties().getEffectiveToTime()); - this.uniqueProperties = properties; + this.uniqueProperties = properties; + } } } } From ef9d8770a143a6139e5dbba621cfccdbee4a9545 Mon Sep 17 00:00:00 2001 From: Mandy Chessell Date: Fri, 16 Dec 2022 09:25:27 +0000 Subject: [PATCH 2/3] Fix NPE on dereference of uniqueProperties Signed-off-by: Mandy Chessell --- .../relationships/RelationshipMapper.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/open-metadata-implementation/access-services/subject-area/subject-area-server/src/main/java/org/odpi/openmetadata/accessservices/subjectarea/server/mappers/relationships/RelationshipMapper.java b/open-metadata-implementation/access-services/subject-area/subject-area-server/src/main/java/org/odpi/openmetadata/accessservices/subjectarea/server/mappers/relationships/RelationshipMapper.java index cae2dc20969..65a9e4794b9 100644 --- a/open-metadata-implementation/access-services/subject-area/subject-area-server/src/main/java/org/odpi/openmetadata/accessservices/subjectarea/server/mappers/relationships/RelationshipMapper.java +++ b/open-metadata-implementation/access-services/subject-area/subject-area-server/src/main/java/org/odpi/openmetadata/accessservices/subjectarea/server/mappers/relationships/RelationshipMapper.java @@ -43,12 +43,13 @@ public R map(org.odpi.openmetadata.repositoryservices.connectors.stores.metadata if (guid1 != null) { end1.setNodeGuid(guid1); } - Map map = proxy1.getUniqueProperties().getInstanceProperties(); - PrimitivePropertyValue qualifiedNamePropertyValue = (PrimitivePropertyValue) map.get("qualifiedName"); - if (qualifiedNamePropertyValue != null) { - end1.setNodeQualifiedName(qualifiedNamePropertyValue.getPrimitiveValue().toString()); + if (proxy1.getUniqueProperties() != null) { + Map map = proxy1.getUniqueProperties().getInstanceProperties(); + PrimitivePropertyValue qualifiedNamePropertyValue = (PrimitivePropertyValue) map.get("qualifiedName"); + if (qualifiedNamePropertyValue != null) { + end1.setNodeQualifiedName(qualifiedNamePropertyValue.getPrimitiveValue().toString()); + } } - } EntityProxy proxy2 = omrsRelationship.getEntityTwoProxy(); if (proxy2 != null) { @@ -57,10 +58,12 @@ public R map(org.odpi.openmetadata.repositoryservices.connectors.stores.metadata if (guid2 != null) { end2.setNodeGuid(guid2); } - Map map = proxy2.getUniqueProperties().getInstanceProperties(); - PrimitivePropertyValue qualifiedNamePropertyValue = (PrimitivePropertyValue) map.get("qualifiedName"); - if (qualifiedNamePropertyValue != null) { - end2.setNodeQualifiedName(qualifiedNamePropertyValue.getPrimitiveValue().toString()); + if (proxy2.getUniqueProperties() != null) { + Map map = proxy2.getUniqueProperties().getInstanceProperties(); + PrimitivePropertyValue qualifiedNamePropertyValue = (PrimitivePropertyValue) map.get("qualifiedName"); + if (qualifiedNamePropertyValue != null) { + end2.setNodeQualifiedName(qualifiedNamePropertyValue.getPrimitiveValue().toString()); + } } } // set readonly From 7f460327a5a2bdd2da6722777ddcbc095cc83d92 Mon Sep 17 00:00:00 2001 From: Ljupcho Palashevski Date: Fri, 16 Dec 2022 09:27:57 +0000 Subject: [PATCH 3/3] Set headerVersion Signed-off-by: Mandy Chessell Signed-off-by: Ljupcho Palashevski # Conflicts: # open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/utilities/OMRSRepositoryPropertiesUtilities.java --- .../handlers/MetadataElementHandler.java | 5 + ...asedOpenMetadataArchiveStoreConnector.java | 2 + .../gaf/handlers/MetadataElementHandler.java | 5 + .../properties/RepositoryElementHeader.java | 36 +++++ .../instances/ArrayPropertyValue.java | 31 ++-- .../ClassificationEntityExtension.java | 24 ++- .../instances/EnumPropertyValue.java | 1 - .../instances/InstanceAuditHeader.java | 111 ++++++++++---- .../instances/InstanceElementHeader.java | 2 - .../properties/instances/InstanceGraph.java | 26 +++- .../instances/InstanceProperties.java | 1 + .../instances/InstancePropertyValue.java | 33 ++++- .../properties/instances/InstanceType.java | 74 +++++++--- .../instances/MapPropertyValue.java | 17 ++- .../instances/PrimitivePropertyValue.java | 17 ++- .../instances/StructPropertyValue.java | 16 +- .../properties/typedefs/TypeDefGallery.java | 10 +- .../OMRSRepositoryPropertiesUtilities.java | 138 ++++++++++++++---- .../ClassificationEntityExtensionTest.java | 1 + .../archiveutilities/OMRSArchiveHelper.java | 4 +- .../OMRSRepositoryContentManager.java | 2 + .../OpenMetadataTypesArchiveAccessor.java | 2 + 22 files changed, 422 insertions(+), 136 deletions(-) diff --git a/open-metadata-implementation/access-services/governance-engine/governance-engine-server/src/main/java/org/odpi/openmetadata/accessservices/governanceengine/handlers/MetadataElementHandler.java b/open-metadata-implementation/access-services/governance-engine/governance-engine-server/src/main/java/org/odpi/openmetadata/accessservices/governanceengine/handlers/MetadataElementHandler.java index 24c0776ddcf..a8dbb28db4e 100644 --- a/open-metadata-implementation/access-services/governance-engine/governance-engine-server/src/main/java/org/odpi/openmetadata/accessservices/governanceengine/handlers/MetadataElementHandler.java +++ b/open-metadata-implementation/access-services/governance-engine/governance-engine-server/src/main/java/org/odpi/openmetadata/accessservices/governanceengine/handlers/MetadataElementHandler.java @@ -698,6 +698,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ArrayPropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ArrayPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.ARRAY); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -752,6 +753,7 @@ else if (propertyValue instanceof StructTypePropertyValue) omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EnumPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.ENUM); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -785,6 +787,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.MapPropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.MapPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.MAP); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -828,6 +831,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.PrimitivePropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.PrimitivePropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.PRIMITIVE); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -914,6 +918,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.StructPropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.StructPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.STRUCT); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); diff --git a/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-archive-connectors/open-metadata-archive-directory-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/archiveconnector/directory/DirectoryBasedOpenMetadataArchiveStoreConnector.java b/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-archive-connectors/open-metadata-archive-directory-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/archiveconnector/directory/DirectoryBasedOpenMetadataArchiveStoreConnector.java index fff9ea02ad9..71b7f061154 100644 --- a/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-archive-connectors/open-metadata-archive-directory-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/archiveconnector/directory/DirectoryBasedOpenMetadataArchiveStoreConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-archive-connectors/open-metadata-archive-directory-connector/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/archiveconnector/directory/DirectoryBasedOpenMetadataArchiveStoreConnector.java @@ -815,6 +815,7 @@ public ClassificationEntityExtension getClassification(String entityGUID, dummyClassification.setName(classificationName); dummyEntity.setGUID(entityGUID); + dummyExtension.setHeaderVersion(ClassificationEntityExtension.CURRENT_CLASSIFICATION_EXT_HEADER_VERSION); dummyExtension.setClassification(dummyClassification); dummyExtension.setEntityToClassify(dummyEntity); @@ -850,6 +851,7 @@ public ClassificationEntityExtension queryClassification(String entityGUID, dummyClassification.setName(classificationName); dummyEntity.setGUID(entityGUID); + dummyExtension.setHeaderVersion(ClassificationEntityExtension.CURRENT_CLASSIFICATION_EXT_HEADER_VERSION); dummyExtension.setClassification(dummyClassification); dummyExtension.setEntityToClassify(dummyEntity); diff --git a/open-metadata-implementation/common-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/commonservices/gaf/handlers/MetadataElementHandler.java b/open-metadata-implementation/common-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/commonservices/gaf/handlers/MetadataElementHandler.java index 2b401a44ec1..b4ca2db065c 100644 --- a/open-metadata-implementation/common-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/commonservices/gaf/handlers/MetadataElementHandler.java +++ b/open-metadata-implementation/common-services/gaf-metadata-management/gaf-metadata-server/src/main/java/org/odpi/openmetadata/commonservices/gaf/handlers/MetadataElementHandler.java @@ -711,6 +711,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ArrayPropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ArrayPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.ARRAY); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -765,6 +766,7 @@ else if (propertyValue instanceof StructTypePropertyValue) omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EnumPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.ENUM); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -798,6 +800,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.MapPropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.MapPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.MAP); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -841,6 +844,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.PrimitivePropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.PrimitivePropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.PRIMITIVE); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); @@ -927,6 +931,7 @@ else if (propertyValue instanceof StructTypePropertyValue) org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.StructPropertyValue omrsPropertyValue = new org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.StructPropertyValue(); + omrsPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); omrsPropertyValue.setInstancePropertyCategory(InstancePropertyCategory.STRUCT); omrsPropertyValue.setTypeGUID(typeDef.getGUID()); omrsPropertyValue.setTypeName(typeDef.getName()); diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/RepositoryElementHeader.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/RepositoryElementHeader.java index 28c52c95460..2c5aba5b470 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/RepositoryElementHeader.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/RepositoryElementHeader.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ArrayPropertyValue; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ClassificationEntityExtension; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceAuditHeader; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceElementHeader; @@ -16,6 +17,7 @@ import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefElementHeader; import java.io.Serializable; +import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; @@ -94,4 +96,38 @@ public void setHeaderVersion(long headerVersion) } + /** + * Validate that an object is equal depending on their stored values. + * + * @param objectToCompare object + * @return boolean result + */ + @Override + public boolean equals(Object objectToCompare) + { + if (this == objectToCompare) + { + return true; + } + if (! (objectToCompare instanceof RepositoryElementHeader)) + { + return false; + } + + RepositoryElementHeader that = (RepositoryElementHeader) objectToCompare; + + return headerVersion == that.headerVersion; + } + + + /** + * Return a hash code based on the property values + * + * @return int hash code + */ + @Override + public int hashCode() + { + return (int) (headerVersion ^ (headerVersion >>> 32)); + } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ArrayPropertyValue.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ArrayPropertyValue.java index 22614800815..3faac35b507 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ArrayPropertyValue.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ArrayPropertyValue.java @@ -8,8 +8,6 @@ import org.odpi.openmetadata.repositoryservices.ffdc.OMRSErrorCode; import org.odpi.openmetadata.repositoryservices.ffdc.exception.OMRSRuntimeException; -import java.util.Objects; - import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; @@ -32,7 +30,8 @@ public class ArrayPropertyValue extends InstancePropertyValue /** * Default constructor sets the array to empty. */ - public ArrayPropertyValue() { + public ArrayPropertyValue() + { super(InstancePropertyCategory.ARRAY); } @@ -168,7 +167,8 @@ public void setArrayValues(InstanceProperties arrayValues) { * @return JSON style description of variables. */ @Override - public String toString() { + public String toString() + { return "ArrayPropertyValue{" + "arrayCount=" + arrayCount + ", arrayValues=" + arrayValues + @@ -192,13 +192,22 @@ public boolean equals(Object objectToCompare) { return true; } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) + if (! (objectToCompare instanceof ArrayPropertyValue)) + { + return false; + } + if (! super.equals(objectToCompare)) { return false; } + ArrayPropertyValue that = (ArrayPropertyValue) objectToCompare; - return arrayCount == that.arrayCount && - Objects.equals(arrayValues, that.arrayValues); + + if (arrayCount != that.arrayCount) + { + return false; + } + return arrayValues != null ? arrayValues.equals(that.arrayValues) : that.arrayValues == null; } @@ -208,7 +217,11 @@ public boolean equals(Object objectToCompare) * @return int hash code */ @Override - public int hashCode() { - return Objects.hash(arrayCount, arrayValues); + public int hashCode() + { + int result = super.hashCode(); + result = 31 * result + arrayCount; + result = 31 * result + (arrayValues != null ? arrayValues.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtension.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtension.java index ee5ba25da64..e39c0fb4565 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtension.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtension.java @@ -3,8 +3,6 @@ package org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances; -import java.util.Objects; - /** * ClassificationEntityExtension is used to represent a single classification for an entity. * It includes the details of the classification and an entity proxy to define which entity @@ -18,6 +16,8 @@ public class ClassificationEntityExtension extends InstanceElementHeader private Classification classification = null; private EntityProxy entityToClassify = null; + public static final long CURRENT_CLASSIFICATION_EXT_HEADER_VERSION = 1; + /** * Default constructor @@ -117,13 +117,22 @@ public boolean equals(Object objectToCompare) { return true; } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) + if (! (objectToCompare instanceof ClassificationEntityExtension)) + { + return false; + } + if (! super.equals(objectToCompare)) { return false; } + ClassificationEntityExtension that = (ClassificationEntityExtension) objectToCompare; - return Objects.equals(getClassification(), that.getClassification()) && - Objects.equals(getEntityToClassify(), that.getEntityToClassify()); + + if (classification != null ? ! classification.equals(that.classification) : that.classification != null) + { + return false; + } + return entityToClassify != null ? entityToClassify.equals(that.entityToClassify) : that.entityToClassify == null; } @@ -135,6 +144,9 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(getClassification(), getEntityToClassify()); + int result = super.hashCode(); + result = 31 * result + (classification != null ? classification.hashCode() : 0); + result = 31 * result + (entityToClassify != null ? entityToClassify.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EnumPropertyValue.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EnumPropertyValue.java index c141094682f..12f7b711d08 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EnumPropertyValue.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/EnumPropertyValue.java @@ -189,7 +189,6 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(super.hashCode(), getOrdinal(), getSymbolicName(), getDescription()); } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceAuditHeader.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceAuditHeader.java index 6f008ab5fae..ad52b548a76 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceAuditHeader.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceAuditHeader.java @@ -92,13 +92,6 @@ public abstract class InstanceAuditHeader extends InstanceElementHeader public static final long CURRENT_AUDIT_HEADER_VERSION = 1; - /* - * Version number for this header. This is used to ensure that all the critical header information - * in read in a back-level version of the OMRS. The default is 0 to indicate that the instance came from - * a version of the OMRS that does not have a version number encoded. - */ - private final long headerVersion = 0; - /* * Summary information about this element's type */ @@ -530,7 +523,7 @@ public void setMappingProperties(Map mappingProperties) @Override public String toString() { return "InstanceAuditHeader{" + - "headerVersion=" + headerVersion + + "headerVersion=" + getHeaderVersion() + ", type=" + type + ", instanceProvenanceType=" + instanceProvenanceType + ", metadataCollectionId='" + metadataCollectionId + '\'' + @@ -563,28 +556,75 @@ public boolean equals(Object objectToCompare) { return true; } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) + if (! (objectToCompare instanceof InstanceAuditHeader)) { return false; } + if (! super.equals(objectToCompare)) + { + return false; + } + InstanceAuditHeader that = (InstanceAuditHeader) objectToCompare; - return getVersion() == that.getVersion() && - Objects.equals(getType(), that.getType()) && - getInstanceProvenanceType() == that.getInstanceProvenanceType() && - Objects.equals(getMetadataCollectionId(), that.getMetadataCollectionId()) && - Objects.equals(getMetadataCollectionName(), that.getMetadataCollectionName()) && - Objects.equals(getReplicatedBy(), that.getReplicatedBy()) && - Objects.equals(getInstanceLicense(), that.getInstanceLicense()) && - Objects.equals(getCreatedBy(), that.getCreatedBy()) && - Objects.equals(getUpdatedBy(), that.getUpdatedBy()) && - Objects.equals(getMaintainedBy(), that.getMaintainedBy()) && - Objects.equals(getCreateTime(), that.getCreateTime()) && - Objects.equals(getUpdateTime(), that.getUpdateTime()) && - currentStatus == that.currentStatus && - getStatusOnDelete() == that.getStatusOnDelete() && - Objects.equals(getMappingProperties(), that.getMappingProperties()); - } + if (version != that.version) + { + return false; + } + if (type != null ? ! type.equals(that.type) : that.type != null) + { + return false; + } + if (instanceProvenanceType != that.instanceProvenanceType) + { + return false; + } + if (metadataCollectionId != null ? ! metadataCollectionId.equals(that.metadataCollectionId) : that.metadataCollectionId != null) + { + return false; + } + if (metadataCollectionName != null ? ! metadataCollectionName.equals(that.metadataCollectionName) : that.metadataCollectionName != null) + { + return false; + } + if (replicatedBy != null ? ! replicatedBy.equals(that.replicatedBy) : that.replicatedBy != null) + { + return false; + } + if (instanceLicense != null ? ! instanceLicense.equals(that.instanceLicense) : that.instanceLicense != null) + { + return false; + } + if (createdBy != null ? ! createdBy.equals(that.createdBy) : that.createdBy != null) + { + return false; + } + if (updatedBy != null ? ! updatedBy.equals(that.updatedBy) : that.updatedBy != null) + { + return false; + } + if (maintainedBy != null ? ! maintainedBy.equals(that.maintainedBy) : that.maintainedBy != null) + { + return false; + } + if (createTime != null ? ! createTime.equals(that.createTime) : that.createTime != null) + { + return false; + } + if (updateTime != null ? ! updateTime.equals(that.updateTime) : that.updateTime != null) + { + return false; + } + if (currentStatus != that.currentStatus) + { + return false; + } + if (statusOnDelete != that.statusOnDelete) + { + return false; + } + return mappingProperties != null ? mappingProperties.equals(that.mappingProperties) : that.mappingProperties == null; + } /** @@ -595,9 +635,22 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(getType(), getInstanceProvenanceType(), getMetadataCollectionId(), - getMetadataCollectionName(), - getInstanceLicense(), getCreatedBy(), getUpdatedBy(), getCreateTime(), getMaintainedBy(), getUpdateTime(), - getVersion(), getStatus(), getStatusOnDelete(), getMappingProperties()); + int result = super.hashCode(); + result = 31 * result + (type != null ? type.hashCode() : 0); + result = 31 * result + (instanceProvenanceType != null ? instanceProvenanceType.hashCode() : 0); + result = 31 * result + (metadataCollectionId != null ? metadataCollectionId.hashCode() : 0); + result = 31 * result + (metadataCollectionName != null ? metadataCollectionName.hashCode() : 0); + result = 31 * result + (replicatedBy != null ? replicatedBy.hashCode() : 0); + result = 31 * result + (instanceLicense != null ? instanceLicense.hashCode() : 0); + result = 31 * result + (createdBy != null ? createdBy.hashCode() : 0); + result = 31 * result + (updatedBy != null ? updatedBy.hashCode() : 0); + result = 31 * result + (maintainedBy != null ? maintainedBy.hashCode() : 0); + result = 31 * result + (createTime != null ? createTime.hashCode() : 0); + result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0); + result = 31 * result + (int) (version ^ (version >>> 32)); + result = 31 * result + (currentStatus != null ? currentStatus.hashCode() : 0); + result = 31 * result + (statusOnDelete != null ? statusOnDelete.hashCode() : 0); + result = 31 * result + (mappingProperties != null ? mappingProperties.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceElementHeader.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceElementHeader.java index d924552a38f..2ff385ededb 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceElementHeader.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceElementHeader.java @@ -31,8 +31,6 @@ public abstract class InstanceElementHeader extends RepositoryElementHeader { private static final long serialVersionUID = 1L; - public static final long CURRENT_INSTANCE_HEADER_VERSION = 1; - /** * Default Constructor sets the instance to nulls */ diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceGraph.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceGraph.java index b2e9f9d5a98..d002470dacc 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceGraph.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceGraph.java @@ -8,7 +8,6 @@ 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; @@ -26,6 +25,8 @@ public class InstanceGraph extends InstanceElementHeader { private static final long serialVersionUID = 1L; + public static final long CURRENT_INSTANCE_GRAPH_HEADER_VERSION = 1; + private List entities = null; private List relationships = null; @@ -311,25 +312,36 @@ public boolean equals(Object objectToCompare) { return true; } - if (!(objectToCompare instanceof InstanceGraph)) + if (! (objectToCompare instanceof InstanceGraph)) { return false; } + if (! super.equals(objectToCompare)) + { + return false; + } + InstanceGraph that = (InstanceGraph) objectToCompare; - return Objects.equals(entities, that.entities) && - Objects.equals(relationships, that.relationships); + + if (entities != null ? ! entities.equals(that.entities) : that.entities != null) + { + return false; + } + return relationships != null ? relationships.equals(that.relationships) : that.relationships == null; } /** * Return a hash code based on the values of this object. * - * @return in hash code + * @return int hash code */ @Override public int hashCode() { - - return Objects.hash(entities, relationships); + int result = super.hashCode(); + result = 31 * result + (entities != null ? entities.hashCode() : 0); + result = 31 * result + (relationships != null ? relationships.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceProperties.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceProperties.java index 663ece28e9a..63b61845f23 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceProperties.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceProperties.java @@ -68,6 +68,7 @@ public class InstanceProperties extends InstanceElementHeader private Date effectiveToTime = null; private Map instanceProperties = new HashMap<>(); + public static final long CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION = 1; /** * Typical constructor diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstancePropertyValue.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstancePropertyValue.java index bf07f5333e6..90b01e68c79 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstancePropertyValue.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstancePropertyValue.java @@ -6,7 +6,6 @@ import java.util.*; import java.util.function.Function; -import java.util.stream.Collectors; import java.util.stream.Stream; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; @@ -33,12 +32,14 @@ public abstract class InstancePropertyValue extends InstanceElementHeader { private static final long serialVersionUID = 1L; + public static final long CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION = 1; + /* * Common type information that is this is augmented by the subclasses */ private InstancePropertyCategory instancePropertyCategory = null; - private String typeGUID = null; - private String typeName = null; + private String typeGUID = null; + private String typeName = null; /** @@ -244,14 +245,26 @@ public boolean equals(Object objectToCompare) { return true; } - if (!(objectToCompare instanceof InstancePropertyValue)) + if (! (objectToCompare instanceof InstancePropertyValue)) + { + return false; + } + if (! super.equals(objectToCompare)) { return false; } + InstancePropertyValue that = (InstancePropertyValue) objectToCompare; - return getInstancePropertyCategory() == that.getInstancePropertyCategory() && - Objects.equals(getTypeGUID(), that.getTypeGUID()) && - Objects.equals(getTypeName(), that.getTypeName()); + + if (instancePropertyCategory != that.instancePropertyCategory) + { + return false; + } + if (typeGUID != null ? ! typeGUID.equals(that.typeGUID) : that.typeGUID != null) + { + return false; + } + return typeName != null ? typeName.equals(that.typeName) : that.typeName == null; } @@ -263,6 +276,10 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(getInstancePropertyCategory(), getTypeGUID(), getTypeName()); + int result = super.hashCode(); + result = 31 * result + (instancePropertyCategory != null ? instancePropertyCategory.hashCode() : 0); + result = 31 * result + (typeGUID != null ? typeGUID.hashCode() : 0); + result = 31 * result + (typeName != null ? typeName.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceType.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceType.java index 1f23fbdfeb3..07228efab3c 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceType.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/InstanceType.java @@ -10,7 +10,6 @@ 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; @@ -35,6 +34,8 @@ public class InstanceType extends InstanceElementHeader private List validStatusList = null; private List validInstanceProperties = null; + public static final long CURRENT_INSTANCE_TYPE_HEADER_VERSION = 1; + /** * Default constructor relies on initialization of variables in the declaration. */ @@ -364,20 +365,50 @@ public boolean equals(Object objectToCompare) { return true; } - if (!(objectToCompare instanceof InstanceType)) + if (! (objectToCompare instanceof InstanceType)) + { + return false; + } + if (! super.equals(objectToCompare)) { return false; } + InstanceType that = (InstanceType) objectToCompare; - return getTypeDefVersion() == that.getTypeDefVersion() && - getTypeDefCategory() == that.getTypeDefCategory() && - Objects.equals(getTypeDefGUID(), that.getTypeDefGUID()) && - Objects.equals(getTypeDefName(), that.getTypeDefName()) && - Objects.equals(getTypeDefDescription(), that.getTypeDefDescription()) && - Objects.equals(getTypeDefDescriptionGUID(), that.getTypeDefDescriptionGUID()) && - Objects.equals(getTypeDefSuperTypes(), that.getTypeDefSuperTypes()) && - Objects.equals(getValidStatusList(), that.getValidStatusList()) && - Objects.equals(getValidInstanceProperties(), that.getValidInstanceProperties()); + + if (typeDefVersion != that.typeDefVersion) + { + return false; + } + if (typeDefCategory != that.typeDefCategory) + { + return false; + } + if (typeDefGUID != null ? ! typeDefGUID.equals(that.typeDefGUID) : that.typeDefGUID != null) + { + return false; + } + if (typeDefName != null ? ! typeDefName.equals(that.typeDefName) : that.typeDefName != null) + { + return false; + } + if (typeDefDescription != null ? ! typeDefDescription.equals(that.typeDefDescription) : that.typeDefDescription != null) + { + return false; + } + if (typeDefDescriptionGUID != null ? ! typeDefDescriptionGUID.equals(that.typeDefDescriptionGUID) : that.typeDefDescriptionGUID != null) + { + return false; + } + if (typeDefSuperTypes != null ? ! typeDefSuperTypes.equals(that.typeDefSuperTypes) : that.typeDefSuperTypes != null) + { + return false; + } + if (validStatusList != null ? ! validStatusList.equals(that.validStatusList) : that.validStatusList != null) + { + return false; + } + return validInstanceProperties != null ? validInstanceProperties.equals(that.validInstanceProperties) : that.validInstanceProperties == null; } @@ -389,15 +420,16 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - - return Objects.hash(getTypeDefCategory(), - getTypeDefGUID(), - getTypeDefName(), - getTypeDefVersion(), - getTypeDefDescription(), - getTypeDefDescriptionGUID(), - getTypeDefSuperTypes(), - getValidStatusList(), - getValidInstanceProperties()); + int result = super.hashCode(); + result = 31 * result + (typeDefCategory != null ? typeDefCategory.hashCode() : 0); + result = 31 * result + (typeDefGUID != null ? typeDefGUID.hashCode() : 0); + result = 31 * result + (typeDefName != null ? typeDefName.hashCode() : 0); + result = 31 * result + (int) (typeDefVersion ^ (typeDefVersion >>> 32)); + result = 31 * result + (typeDefDescription != null ? typeDefDescription.hashCode() : 0); + result = 31 * result + (typeDefDescriptionGUID != null ? typeDefDescriptionGUID.hashCode() : 0); + result = 31 * result + (typeDefSuperTypes != null ? typeDefSuperTypes.hashCode() : 0); + result = 31 * result + (validStatusList != null ? validStatusList.hashCode() : 0); + result = 31 * result + (validInstanceProperties != null ? validInstanceProperties.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/MapPropertyValue.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/MapPropertyValue.java index 4652edb63e6..c5ab3e278a3 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/MapPropertyValue.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/MapPropertyValue.java @@ -7,8 +7,6 @@ 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; @@ -178,12 +176,18 @@ public boolean equals(Object objectToCompare) { return true; } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) + if (! (objectToCompare instanceof MapPropertyValue)) + { + return false; + } + if (! super.equals(objectToCompare)) { return false; } + MapPropertyValue that = (MapPropertyValue) objectToCompare; - return Objects.equals(mapValues, that.mapValues); + + return mapValues != null ? mapValues.equals(that.mapValues) : that.mapValues == null; } @@ -195,7 +199,8 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - - return Objects.hash(mapValues); + int result = super.hashCode(); + result = 31 * result + (mapValues != null ? mapValues.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/PrimitivePropertyValue.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/PrimitivePropertyValue.java index 335540e2524..2bb49277fb3 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/PrimitivePropertyValue.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/PrimitivePropertyValue.java @@ -19,7 +19,7 @@ /** * PrimitivePropertyValue stores a single primitive property. This is stored in the specific Java class - * for the property value's type although it is stored as an object. + * for the property value's type, although it is stored as an object. */ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @@ -175,13 +175,22 @@ public boolean equals(Object objectToCompare) { return true; } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) + if (! (objectToCompare instanceof PrimitivePropertyValue)) { return false; } + if (! super.equals(objectToCompare)) + { + return false; + } + PrimitivePropertyValue that = (PrimitivePropertyValue) objectToCompare; - return primitiveDefCategory == that.primitiveDefCategory && - Objects.equals(primitiveValue, that.primitiveValue); + + if (primitiveDefCategory != that.primitiveDefCategory) + { + return false; + } + return primitiveValue != null ? primitiveValue.equals(that.primitiveValue) : that.primitiveValue == null; } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/StructPropertyValue.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/StructPropertyValue.java index 0278798abd2..c771b169d1b 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/StructPropertyValue.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/StructPropertyValue.java @@ -7,8 +7,6 @@ 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; @@ -140,12 +138,18 @@ public boolean equals(Object objectToCompare) { return true; } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) + if (! (objectToCompare instanceof StructPropertyValue)) + { + return false; + } + if (! super.equals(objectToCompare)) { return false; } + StructPropertyValue that = (StructPropertyValue) objectToCompare; - return Objects.equals(attributes, that.attributes); + + return attributes != null ? attributes.equals(that.attributes) : that.attributes == null; } @@ -157,6 +161,8 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - return Objects.hash(attributes); + int result = super.hashCode(); + result = 31 * result + (attributes != null ? attributes.hashCode() : 0); + return result; } } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/typedefs/TypeDefGallery.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/typedefs/TypeDefGallery.java index 93c445b6747..78a836f05b3 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/typedefs/TypeDefGallery.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/typedefs/TypeDefGallery.java @@ -137,21 +137,21 @@ public String toString() /** * Verify that supplied object has the same properties. * - * @param o object to test + * @param objectToCompare object to test * @return result */ @Override - public boolean equals(Object o) + public boolean equals(Object objectToCompare) { - if (this == o) + if (this == objectToCompare) { return true; } - if (!(o instanceof TypeDefGallery)) + if (!(objectToCompare instanceof TypeDefGallery)) { return false; } - TypeDefGallery that = (TypeDefGallery) o; + TypeDefGallery that = (TypeDefGallery) objectToCompare; return Objects.equals(getAttributeTypeDefs(), that.getAttributeTypeDefs()) && Objects.equals(getTypeDefs(), that.getTypeDefs()); } diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/utilities/OMRSRepositoryPropertiesUtilities.java b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/utilities/OMRSRepositoryPropertiesUtilities.java index e2721f1b8e0..0703dfc0e53 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/utilities/OMRSRepositoryPropertiesUtilities.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/main/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/utilities/OMRSRepositoryPropertiesUtilities.java @@ -27,6 +27,22 @@ public class OMRSRepositoryPropertiesUtilities implements OMRSRepositoryProperti public static final String METADATA_COLLECTION_ID_PROPERTY_NAME = "metadataCollectionId"; public static final String METADATA_COLLECTION_NAME_PROPERTY_NAME = "metadataCollectionName"; + private static final String stringMapTypeGUID = "005c7c14-ac84-4136-beed-959401b041f8"; + private static final String stringMapTypeName = "map<" + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName() + "," + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName() + ">"; + private static final String booleanMapTypeGUID = "8fa603dd-c2c5-43fc-8ff4-92141f2414ab"; + private static final String booleanMapTypeName = "map<" + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName() + "," + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN.getName() + ">"; + private static final String intMapTypeGUID = "8fa603dd-c2c5-43fc-8ff4-92141f2414ac"; + private static final String intMapTypeName = "map<" + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName() + "," + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT.getName() + ">"; + private static final String longMapTypeGUID = "8fa603dd-c2c5-43fc-8ff4-92141f2414ae"; + private static final String longMapTypeName = "map<" + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName() + "," + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG.getName() + ">"; + private static final String objectMapTypeGUID = "8fa603dd-c2c5-43fc-8ff4-92141f2414ad"; + private static final String objectMapTypeName = "map<" + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName() + "," + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_UNKNOWN.getName() + ">"; + + private static final String stringArrayTypeGUID = "0428b5d3-f824-459c-b7f5-f8151de59707"; + private static final String stringArrayTypeName = "array<" + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName() + ">"; + private static final String intArrayTypeGUID = "0103fe10-98b0-4910-8ee0-21d529f7ff6d"; + private static final String intArrayTypeName = "array<" + PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT.getName() + ">"; + private static final Logger log = LoggerFactory.getLogger(OMRSRepositoryPropertiesUtilities.class); /** @@ -130,7 +146,7 @@ public String removeStringProperty(String sourceName, if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } } @@ -188,7 +204,7 @@ public int removeEnumPropertyOrdinal(String sourceName, { retrievedProperty = this.getEnumPropertyOrdinal(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } log.debug("Retrieved " + propertyName + " property ordinal : " + retrievedProperty); @@ -328,7 +344,7 @@ public List removeStringArrayProperty(String sourceName, if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } } @@ -462,7 +478,7 @@ public Map removeStringMapFromProperty(String source if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } } @@ -538,7 +554,7 @@ public Map removeBooleanMapFromProperty(String sour if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } } @@ -614,7 +630,7 @@ public Map removeLongMapFromProperty(String sourceName if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } } @@ -691,7 +707,7 @@ public Map removeIntegerMapFromProperty(String sour if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } } @@ -929,7 +945,7 @@ public int removeIntProperty(String sourceName, retrievedProperty = this.getIntProperty(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } log.debug("Retrieved " + propertyName + " property: " + retrievedProperty); @@ -1017,7 +1033,7 @@ public Date removeDateProperty(String sourceName, retrievedProperty = this.getDateProperty(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } log.debug("Retrieved " + propertyName + " property: " + retrievedProperty); @@ -1104,7 +1120,7 @@ public boolean removeBooleanProperty(String sourceName, retrievedProperty = this.getBooleanProperty(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties.toString()); + log.debug("Properties left: " + properties); } log.debug("Retrieved " + propertyName + " property: " + retrievedProperty); @@ -1150,6 +1166,7 @@ public InstanceProperties addStringPropertyToInstance(String sourceN PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING); primitivePropertyValue.setPrimitiveValue(propertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName()); @@ -1203,6 +1220,7 @@ public InstanceProperties addIntPropertyToInstance(String sourceName PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT); primitivePropertyValue.setPrimitiveValue(propertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT.getName()); @@ -1219,7 +1237,7 @@ public InstanceProperties addIntPropertyToInstance(String sourceName * supplied is null, a new instance properties object is created. * * @param sourceName name of caller - * @param properties properties object to add property to may be null. + * @param properties properties object to add. Property may be null. * @param propertyName name of property * @param propertyValue value of property * @param methodName calling method name @@ -1250,6 +1268,7 @@ public InstanceProperties addLongPropertyToInstance(String sourceNam PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG); primitivePropertyValue.setPrimitiveValue(propertyValue); @@ -1264,7 +1283,7 @@ public InstanceProperties addLongPropertyToInstance(String sourceNam * supplied is null, a new instance properties object is created. * * @param sourceName name of caller - * @param properties properties object to add property to may be null. + * @param properties properties object to add. Property may be null. * @param propertyName name of property * @param propertyValue value of property * @param methodName calling method name @@ -1295,6 +1314,7 @@ public InstanceProperties addFloatPropertyToInstance(String sourceNa PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_FLOAT); primitivePropertyValue.setPrimitiveValue(propertyValue); @@ -1309,7 +1329,7 @@ public InstanceProperties addFloatPropertyToInstance(String sourceNa * supplied is null, a new instance properties object is created. * * @param sourceName name of caller - * @param properties properties object to add property to may be null. + * @param properties properties object to add. Property may be null. * @param propertyName name of property * @param propertyValue value of property * @param methodName calling method name @@ -1345,6 +1365,7 @@ public InstanceProperties addDatePropertyToInstance(String sourceNam /* * Date objects are stored in PrimitivePropertyValue as Java Long. */ + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DATE); Long longValue = propertyValue.getTime(); primitivePropertyValue.setPrimitiveValue(longValue); @@ -1394,6 +1415,7 @@ public InstanceProperties addBooleanPropertyToInstance(String source PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN); primitivePropertyValue.setPrimitiveValue(propertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN.getName()); @@ -1445,6 +1467,7 @@ public InstanceProperties addEnumPropertyToInstance(String sourceNam EnumPropertyValue enumPropertyValue = new EnumPropertyValue(); + enumPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); enumPropertyValue.setOrdinal(ordinal); enumPropertyValue.setSymbolicName(symbolicName); enumPropertyValue.setDescription(description); @@ -1490,7 +1513,12 @@ public InstanceProperties addStringArrayPropertyToInstance(String s } ArrayPropertyValue arrayPropertyValue = new ArrayPropertyValue(); + + arrayPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); + arrayPropertyValue.setTypeGUID(stringArrayTypeGUID); + arrayPropertyValue.setTypeName(stringArrayTypeName); arrayPropertyValue.setArrayCount(arrayValues.size()); + int index = 0; for (String arrayValue : arrayValues) { @@ -1505,7 +1533,7 @@ public InstanceProperties addStringArrayPropertyToInstance(String s resultingProperties.setProperty(propertyName, arrayPropertyValue); - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -1545,6 +1573,8 @@ public InstanceProperties addMapPropertyToInstance(String sourceNam if (properties == null) { resultingProperties = new InstanceProperties(); + + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1567,10 +1597,15 @@ public InstanceProperties addMapPropertyToInstance(String sourceNam if (mapInstanceProperties != null) { MapPropertyValue mapPropertyValue = new MapPropertyValue(); + + mapPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); mapPropertyValue.setMapValues(mapInstanceProperties); + mapPropertyValue.setTypeGUID(objectMapTypeGUID); + mapPropertyValue.setTypeName(objectMapTypeName); + resultingProperties.setProperty(propertyName, mapPropertyValue); - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -1612,6 +1647,7 @@ public InstanceProperties addStringMapPropertyToInstance(String sou if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1635,10 +1671,14 @@ public InstanceProperties addStringMapPropertyToInstance(String sou if (mapInstanceProperties != null) { MapPropertyValue mapPropertyValue = new MapPropertyValue(); + + mapPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); mapPropertyValue.setMapValues(mapInstanceProperties); + mapPropertyValue.setTypeGUID(stringMapTypeGUID); + mapPropertyValue.setTypeName(stringMapTypeName); resultingProperties.setProperty(propertyName, mapPropertyValue); - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -1680,13 +1720,13 @@ public InstanceProperties addBooleanMapPropertyToInstance(String s if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { resultingProperties = properties; } - /* * The values of a map property are stored as an embedded InstanceProperties object. */ @@ -1703,10 +1743,14 @@ public InstanceProperties addBooleanMapPropertyToInstance(String s if (mapInstanceProperties != null) { MapPropertyValue mapPropertyValue = new MapPropertyValue(); + + mapPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); mapPropertyValue.setMapValues(mapInstanceProperties); + mapPropertyValue.setTypeGUID(booleanMapTypeGUID); + mapPropertyValue.setTypeName(booleanMapTypeName); resultingProperties.setProperty(propertyName, mapPropertyValue); - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -1748,6 +1792,7 @@ public InstanceProperties addLongMapPropertyToInstance(String source if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1771,10 +1816,15 @@ public InstanceProperties addLongMapPropertyToInstance(String source if (mapInstanceProperties != null) { MapPropertyValue mapPropertyValue = new MapPropertyValue(); + + mapPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); mapPropertyValue.setMapValues(mapInstanceProperties); + mapPropertyValue.setTypeGUID(longMapTypeGUID); + mapPropertyValue.setTypeName(longMapTypeName); + resultingProperties.setProperty(propertyName, mapPropertyValue); - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -1817,6 +1867,7 @@ public InstanceProperties addIntMapPropertyToInstance(String sourc if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1840,10 +1891,14 @@ public InstanceProperties addIntMapPropertyToInstance(String sourc if (mapInstanceProperties != null) { MapPropertyValue mapPropertyValue = new MapPropertyValue(); + + mapPropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); mapPropertyValue.setMapValues(mapInstanceProperties); + mapPropertyValue.setTypeGUID(longMapTypeGUID); + mapPropertyValue.setTypeName(longMapTypeName); resultingProperties.setProperty(propertyName, mapPropertyValue); - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -1881,6 +1936,7 @@ public InstanceProperties addPropertyMapToInstance(String sourceNam if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1896,6 +1952,7 @@ public InstanceProperties addPropertyMapToInstance(String sourceNam if (mapPropertyValue instanceof String) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING); primitivePropertyValue.setPrimitiveValue(mapPropertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName()); @@ -1906,6 +1963,7 @@ public InstanceProperties addPropertyMapToInstance(String sourceNam else if (mapPropertyValue instanceof Integer) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT.getGUID()); @@ -1916,6 +1974,7 @@ else if (mapPropertyValue instanceof Integer) else if (mapPropertyValue instanceof Long) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG.getGUID()); @@ -1926,6 +1985,7 @@ else if (mapPropertyValue instanceof Long) else if (mapPropertyValue instanceof Short) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_SHORT); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_SHORT.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_SHORT.getGUID()); @@ -1936,6 +1996,7 @@ else if (mapPropertyValue instanceof Short) else if (mapPropertyValue instanceof Date) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DATE); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DATE.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DATE.getGUID()); @@ -1950,6 +2011,7 @@ else if (mapPropertyValue instanceof Date) else if (mapPropertyValue instanceof Character) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_CHAR); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_CHAR.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_CHAR.getGUID()); @@ -1960,6 +2022,7 @@ else if (mapPropertyValue instanceof Character) else if (mapPropertyValue instanceof Byte) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BYTE); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BYTE.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BYTE.getGUID()); @@ -1970,6 +2033,7 @@ else if (mapPropertyValue instanceof Byte) else if (mapPropertyValue instanceof Boolean) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN.getGUID()); @@ -1980,6 +2044,7 @@ else if (mapPropertyValue instanceof Boolean) else if (mapPropertyValue instanceof Float) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_FLOAT); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_FLOAT.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_FLOAT.getGUID()); @@ -1990,8 +2055,8 @@ else if (mapPropertyValue instanceof Float) else if (mapPropertyValue instanceof BigDecimal) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); - primitivePropertyValue.setPrimitiveDefCategory( - PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGDECIMAL); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); + primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGDECIMAL); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGDECIMAL.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGDECIMAL.getGUID()); primitivePropertyValue.setPrimitiveValue(mapPropertyValue); @@ -2001,8 +2066,8 @@ else if (mapPropertyValue instanceof BigDecimal) else if (mapPropertyValue instanceof BigInteger) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); - primitivePropertyValue.setPrimitiveDefCategory( - PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGINTEGER); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); + primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGINTEGER); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGINTEGER.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGINTEGER.getGUID()); primitivePropertyValue.setPrimitiveValue(mapPropertyValue); @@ -2012,6 +2077,7 @@ else if (mapPropertyValue instanceof BigInteger) else if (mapPropertyValue instanceof Double) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DOUBLE); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DOUBLE.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_DOUBLE.getGUID()); @@ -2027,6 +2093,7 @@ else if (mapPropertyValue instanceof InstancePropertyValue) else if (mapPropertyValue != null) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_UNKNOWN); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_UNKNOWN.getName()); primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_UNKNOWN.getGUID()); @@ -2038,7 +2105,7 @@ else if (mapPropertyValue != null) if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -2077,6 +2144,7 @@ public InstanceProperties addStringPropertyMapToInstance(String sou if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -2092,6 +2160,7 @@ public InstanceProperties addStringPropertyMapToInstance(String sou if (mapPropertyValue != null) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING); primitivePropertyValue.setPrimitiveValue(mapPropertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING.getName()); @@ -2103,7 +2172,7 @@ public InstanceProperties addStringPropertyMapToInstance(String sou if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -2142,6 +2211,8 @@ public InstanceProperties addBooleanPropertyMapToInstance(String s if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); + } else { @@ -2157,6 +2228,7 @@ public InstanceProperties addBooleanPropertyMapToInstance(String s if (mapPropertyValue != null) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN); primitivePropertyValue.setPrimitiveValue(mapPropertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BOOLEAN.getName()); @@ -2168,7 +2240,7 @@ public InstanceProperties addBooleanPropertyMapToInstance(String s if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -2208,6 +2280,7 @@ public InstanceProperties addLongPropertyMapToInstance(String sourc if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -2223,6 +2296,7 @@ public InstanceProperties addLongPropertyMapToInstance(String sourc if (mapPropertyValue != null) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG); primitivePropertyValue.setPrimitiveValue(mapPropertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG.getName()); @@ -2234,7 +2308,7 @@ public InstanceProperties addLongPropertyMapToInstance(String sourc if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -2273,6 +2347,7 @@ public InstanceProperties addIntPropertyMapToInstance(String sourc if (properties == null) { resultingProperties = new InstanceProperties(); + resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -2288,6 +2363,7 @@ public InstanceProperties addIntPropertyMapToInstance(String sourc if (mapPropertyValue != null) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT); primitivePropertyValue.setPrimitiveValue(mapPropertyValue); primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_INT.getName()); @@ -2299,7 +2375,7 @@ public InstanceProperties addIntPropertyMapToInstance(String sourc if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties.toString()); + log.debug("Returning instanceProperty: " + resultingProperties); return resultingProperties; } @@ -2593,7 +2669,7 @@ else if (typeDefPatch.getApplyToVersion() < originalTypeDef.getVersion()) { /* * The patch has already been applied and so can be ignored. This is not an - * error because all members of the cohort broadcast new types so it is to be + * error because all members of the cohort broadcast new types, so it is to be * expected that the same patch will come in multiple times. */ return originalTypeDef; @@ -2639,7 +2715,7 @@ public SearchProperties getSearchPropertiesFromInstanceProperties(String } else { - // And the EQ(uals) operator for any other type + // And the EQUALS operator for any other type pc.setOperator(PropertyComparisonOperator.EQ); } // TODO: we may want to default complex types (lists, etc) to other operators than EQ? diff --git a/open-metadata-implementation/repository-services/repository-services-apis/src/test/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtensionTest.java b/open-metadata-implementation/repository-services/repository-services-apis/src/test/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtensionTest.java index dcb0e09696d..19c2acc2f70 100644 --- a/open-metadata-implementation/repository-services/repository-services-apis/src/test/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtensionTest.java +++ b/open-metadata-implementation/repository-services/repository-services-apis/src/test/java/org/odpi/openmetadata/repositoryservices/connectors/stores/metadatacollectionstore/properties/instances/ClassificationEntityExtensionTest.java @@ -39,6 +39,7 @@ private ClassificationEntityExtension getTestObject() { ClassificationEntityExtension testObject = new ClassificationEntityExtension(); + testObject.setHeaderVersion(ClassificationEntityExtension.CURRENT_CLASSIFICATION_EXT_HEADER_VERSION); testObject.setClassification(classification); testObject.setEntityToClassify(entityProxy); diff --git a/open-metadata-implementation/repository-services/repository-services-archive-utilities/src/main/java/org/odpi/openmetadata/repositoryservices/archiveutilities/OMRSArchiveHelper.java b/open-metadata-implementation/repository-services/repository-services-archive-utilities/src/main/java/org/odpi/openmetadata/repositoryservices/archiveutilities/OMRSArchiveHelper.java index c454fb3ceb3..bcdc733506b 100644 --- a/open-metadata-implementation/repository-services/repository-services-archive-utilities/src/main/java/org/odpi/openmetadata/repositoryservices/archiveutilities/OMRSArchiveHelper.java +++ b/open-metadata-implementation/repository-services/repository-services-archive-utilities/src/main/java/org/odpi/openmetadata/repositoryservices/archiveutilities/OMRSArchiveHelper.java @@ -1172,7 +1172,7 @@ private InstanceType getInstanceTypeHeader(TypeDef typeDef) { instanceType = new InstanceType(); - instanceType.setHeaderVersion(InstanceElementHeader.CURRENT_INSTANCE_HEADER_VERSION); + instanceType.setHeaderVersion(InstanceType.CURRENT_INSTANCE_TYPE_HEADER_VERSION); instanceType.setTypeDefCategory(typeDef.getCategory()); instanceType.setTypeDefGUID(typeDef.getGUID()); instanceType.setTypeDefName(typeDef.getName()); @@ -1419,7 +1419,7 @@ public ClassificationEntityExtension getClassificationEntityExtension(EntityProx { ClassificationEntityExtension classificationEntityExtension = new ClassificationEntityExtension(); - classificationEntityExtension.setHeaderVersion(InstanceElementHeader.CURRENT_INSTANCE_HEADER_VERSION); + classificationEntityExtension.setHeaderVersion(ClassificationEntityExtension.CURRENT_CLASSIFICATION_EXT_HEADER_VERSION); classificationEntityExtension.setEntityToClassify(entity); classificationEntityExtension.setClassification(classification); diff --git a/open-metadata-implementation/repository-services/repository-services-implementation/src/main/java/org/odpi/openmetadata/repositoryservices/localrepository/repositorycontentmanager/OMRSRepositoryContentManager.java b/open-metadata-implementation/repository-services/repository-services-implementation/src/main/java/org/odpi/openmetadata/repositoryservices/localrepository/repositorycontentmanager/OMRSRepositoryContentManager.java index deeea81871a..2c0b3ab40c3 100644 --- a/open-metadata-implementation/repository-services/repository-services-implementation/src/main/java/org/odpi/openmetadata/repositoryservices/localrepository/repositorycontentmanager/OMRSRepositoryContentManager.java +++ b/open-metadata-implementation/repository-services/repository-services-implementation/src/main/java/org/odpi/openmetadata/repositoryservices/localrepository/repositorycontentmanager/OMRSRepositoryContentManager.java @@ -3,6 +3,7 @@ package org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.RepositoryElementHeader; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EnumPropertyValue; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; import org.odpi.openmetadata.repositoryservices.ffdc.OMRSAuditCode; @@ -776,6 +777,7 @@ public InstanceType getInstanceType(String sourceName, { instanceType = new InstanceType(); + instanceType.setHeaderVersion(InstanceType.CURRENT_INSTANCE_TYPE_HEADER_VERSION); instanceType.setTypeDefCategory(category); instanceType.setTypeDefGUID(typeDef.getGUID()); instanceType.setTypeDefName(typeDef.getName()); diff --git a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchiveAccessor.java b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchiveAccessor.java index d03876abc37..6d1795a31da 100644 --- a/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchiveAccessor.java +++ b/open-metadata-resources/open-metadata-archives/open-metadata-types/src/main/java/org/odpi/openmetadata/opentypes/OpenMetadataTypesArchiveAccessor.java @@ -206,6 +206,8 @@ public EnumDef getEnumDefByName(String typeName) public InstanceType createTemplateFromTypeDef(TypeDef typeDef) { InstanceType template = new InstanceType(); + + template.setHeaderVersion(InstanceType.CURRENT_INSTANCE_TYPE_HEADER_VERSION); template.setTypeDefName(typeDef.getName()); template.setTypeDefCategory(typeDef.getCategory()); template.setTypeDefDescription(typeDef.getDescription());