From b16dd087591addc5a3fc50a257c2e16761a7be3e Mon Sep 17 00:00:00 2001 From: Nigel Jones Date: Tue, 20 Dec 2022 06:11:28 +0000 Subject: [PATCH] Revert "Set headerVersion" This reverts commit 7f460327a5a2bdd2da6722777ddcbc095cc83d92. Signed-off-by: Nigel Jones --- .../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, 136 insertions(+), 422 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 a8dbb28db4e..24c0776ddcf 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,7 +698,6 @@ 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()); @@ -753,7 +752,6 @@ 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()); @@ -787,7 +785,6 @@ 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()); @@ -831,7 +828,6 @@ 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()); @@ -918,7 +914,6 @@ 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 71b7f061154..fff9ea02ad9 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,7 +815,6 @@ 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); @@ -851,7 +850,6 @@ 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 b4ca2db065c..2b401a44ec1 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,7 +711,6 @@ 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()); @@ -766,7 +765,6 @@ 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()); @@ -800,7 +798,6 @@ 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()); @@ -844,7 +841,6 @@ 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()); @@ -931,7 +927,6 @@ 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 2c5aba5b470..28c52c95460 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,7 +7,6 @@ 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; @@ -17,7 +16,6 @@ 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; @@ -96,38 +94,4 @@ 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 3faac35b507..22614800815 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,6 +8,8 @@ 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; @@ -30,8 +32,7 @@ public class ArrayPropertyValue extends InstancePropertyValue /** * Default constructor sets the array to empty. */ - public ArrayPropertyValue() - { + public ArrayPropertyValue() { super(InstancePropertyCategory.ARRAY); } @@ -167,8 +168,7 @@ 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,22 +192,13 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof ArrayPropertyValue)) - { - return false; - } - if (! super.equals(objectToCompare)) + if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } - ArrayPropertyValue that = (ArrayPropertyValue) objectToCompare; - - if (arrayCount != that.arrayCount) - { - return false; - } - return arrayValues != null ? arrayValues.equals(that.arrayValues) : that.arrayValues == null; + return arrayCount == that.arrayCount && + Objects.equals(arrayValues, that.arrayValues); } @@ -217,11 +208,7 @@ public boolean equals(Object objectToCompare) * @return int hash code */ @Override - public int hashCode() - { - int result = super.hashCode(); - result = 31 * result + arrayCount; - result = 31 * result + (arrayValues != null ? arrayValues.hashCode() : 0); - return result; + public int hashCode() { + return Objects.hash(arrayCount, arrayValues); } } 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 e39c0fb4565..ee5ba25da64 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,6 +3,8 @@ 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 @@ -16,8 +18,6 @@ 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,22 +117,13 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof ClassificationEntityExtension)) - { - return false; - } - if (! super.equals(objectToCompare)) + if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } - ClassificationEntityExtension that = (ClassificationEntityExtension) objectToCompare; - - if (classification != null ? ! classification.equals(that.classification) : that.classification != null) - { - return false; - } - return entityToClassify != null ? entityToClassify.equals(that.entityToClassify) : that.entityToClassify == null; + return Objects.equals(getClassification(), that.getClassification()) && + Objects.equals(getEntityToClassify(), that.getEntityToClassify()); } @@ -144,9 +135,6 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (classification != null ? classification.hashCode() : 0); - result = 31 * result + (entityToClassify != null ? entityToClassify.hashCode() : 0); - return result; + return Objects.hash(getClassification(), getEntityToClassify()); } } 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 12f7b711d08..c141094682f 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,6 +189,7 @@ 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 ad52b548a76..6f008ab5fae 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,6 +92,13 @@ 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 */ @@ -523,7 +530,7 @@ public void setMappingProperties(Map mappingProperties) @Override public String toString() { return "InstanceAuditHeader{" + - "headerVersion=" + getHeaderVersion() + + "headerVersion=" + headerVersion + ", type=" + type + ", instanceProvenanceType=" + instanceProvenanceType + ", metadataCollectionId='" + metadataCollectionId + '\'' + @@ -556,77 +563,30 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof InstanceAuditHeader)) + if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } - if (! super.equals(objectToCompare)) - { - return false; - } - InstanceAuditHeader that = (InstanceAuditHeader) objectToCompare; - - 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; + 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()); } + /** * Return a hash code based on the values of this object. * @@ -635,22 +595,9 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - 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; + return Objects.hash(getType(), getInstanceProvenanceType(), getMetadataCollectionId(), + getMetadataCollectionName(), + getInstanceLicense(), getCreatedBy(), getUpdatedBy(), getCreateTime(), getMaintainedBy(), getUpdateTime(), + getVersion(), getStatus(), getStatusOnDelete(), getMappingProperties()); } } 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 2ff385ededb..d924552a38f 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,6 +31,8 @@ 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 d002470dacc..b2e9f9d5a98 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,6 +8,7 @@ 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; @@ -25,8 +26,6 @@ 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; @@ -312,36 +311,25 @@ 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; - - if (entities != null ? ! entities.equals(that.entities) : that.entities != null) - { - return false; - } - return relationships != null ? relationships.equals(that.relationships) : that.relationships == null; + return Objects.equals(entities, that.entities) && + Objects.equals(relationships, that.relationships); } /** * Return a hash code based on the values of this object. * - * @return int hash code + * @return in hash code */ @Override public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (entities != null ? entities.hashCode() : 0); - result = 31 * result + (relationships != null ? relationships.hashCode() : 0); - return result; + + return Objects.hash(entities, relationships); } } 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 63b61845f23..663ece28e9a 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,7 +68,6 @@ 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 90b01e68c79..bf07f5333e6 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,6 +6,7 @@ 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; @@ -32,14 +33,12 @@ 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; /** @@ -245,26 +244,14 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof InstancePropertyValue)) - { - return false; - } - if (! super.equals(objectToCompare)) + if (!(objectToCompare instanceof InstancePropertyValue)) { return false; } - InstancePropertyValue that = (InstancePropertyValue) objectToCompare; - - 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; + return getInstancePropertyCategory() == that.getInstancePropertyCategory() && + Objects.equals(getTypeGUID(), that.getTypeGUID()) && + Objects.equals(getTypeName(), that.getTypeName()); } @@ -276,10 +263,6 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - 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; + return Objects.hash(getInstancePropertyCategory(), getTypeGUID(), getTypeName()); } } 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 07228efab3c..1f23fbdfeb3 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,6 +10,7 @@ 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; @@ -34,8 +35,6 @@ 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. */ @@ -365,50 +364,20 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof InstanceType)) - { - return false; - } - if (! super.equals(objectToCompare)) + if (!(objectToCompare instanceof InstanceType)) { return false; } - InstanceType that = (InstanceType) objectToCompare; - - 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; + 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()); } @@ -420,16 +389,15 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - 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; + + return Objects.hash(getTypeDefCategory(), + getTypeDefGUID(), + getTypeDefName(), + getTypeDefVersion(), + getTypeDefDescription(), + getTypeDefDescriptionGUID(), + getTypeDefSuperTypes(), + getValidStatusList(), + getValidInstanceProperties()); } } 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 c5ab3e278a3..4652edb63e6 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,6 +7,8 @@ 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; @@ -176,18 +178,12 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof MapPropertyValue)) - { - return false; - } - if (! super.equals(objectToCompare)) + if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } - MapPropertyValue that = (MapPropertyValue) objectToCompare; - - return mapValues != null ? mapValues.equals(that.mapValues) : that.mapValues == null; + return Objects.equals(mapValues, that.mapValues); } @@ -199,8 +195,7 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (mapValues != null ? mapValues.hashCode() : 0); - return result; + + return Objects.hash(mapValues); } } 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 2bb49277fb3..335540e2524 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,22 +175,13 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof PrimitivePropertyValue)) + if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } - if (! super.equals(objectToCompare)) - { - return false; - } - PrimitivePropertyValue that = (PrimitivePropertyValue) objectToCompare; - - if (primitiveDefCategory != that.primitiveDefCategory) - { - return false; - } - return primitiveValue != null ? primitiveValue.equals(that.primitiveValue) : that.primitiveValue == null; + return primitiveDefCategory == that.primitiveDefCategory && + Objects.equals(primitiveValue, that.primitiveValue); } 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 c771b169d1b..0278798abd2 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,6 +7,8 @@ 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; @@ -138,18 +140,12 @@ public boolean equals(Object objectToCompare) { return true; } - if (! (objectToCompare instanceof StructPropertyValue)) - { - return false; - } - if (! super.equals(objectToCompare)) + if (objectToCompare == null || getClass() != objectToCompare.getClass()) { return false; } - StructPropertyValue that = (StructPropertyValue) objectToCompare; - - return attributes != null ? attributes.equals(that.attributes) : that.attributes == null; + return Objects.equals(attributes, that.attributes); } @@ -161,8 +157,6 @@ public boolean equals(Object objectToCompare) @Override public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (attributes != null ? attributes.hashCode() : 0); - return result; + return Objects.hash(attributes); } } 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 78a836f05b3..93c445b6747 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 objectToCompare object to test + * @param o object to test * @return result */ @Override - public boolean equals(Object objectToCompare) + public boolean equals(Object o) { - if (this == objectToCompare) + if (this == o) { return true; } - if (!(objectToCompare instanceof TypeDefGallery)) + if (!(o instanceof TypeDefGallery)) { return false; } - TypeDefGallery that = (TypeDefGallery) objectToCompare; + TypeDefGallery that = (TypeDefGallery) o; 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 0703dfc0e53..e2721f1b8e0 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,22 +27,6 @@ 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); /** @@ -146,7 +130,7 @@ public String removeStringProperty(String sourceName, if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } } @@ -204,7 +188,7 @@ public int removeEnumPropertyOrdinal(String sourceName, { retrievedProperty = this.getEnumPropertyOrdinal(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } log.debug("Retrieved " + propertyName + " property ordinal : " + retrievedProperty); @@ -344,7 +328,7 @@ public List removeStringArrayProperty(String sourceName, if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } } @@ -478,7 +462,7 @@ public Map removeStringMapFromProperty(String source if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } } @@ -554,7 +538,7 @@ public Map removeBooleanMapFromProperty(String sour if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } } @@ -630,7 +614,7 @@ public Map removeLongMapFromProperty(String sourceName if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } } @@ -707,7 +691,7 @@ public Map removeIntegerMapFromProperty(String sour if (retrievedProperty != null) { this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } } @@ -945,7 +929,7 @@ public int removeIntProperty(String sourceName, retrievedProperty = this.getIntProperty(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } log.debug("Retrieved " + propertyName + " property: " + retrievedProperty); @@ -1033,7 +1017,7 @@ public Date removeDateProperty(String sourceName, retrievedProperty = this.getDateProperty(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } log.debug("Retrieved " + propertyName + " property: " + retrievedProperty); @@ -1120,7 +1104,7 @@ public boolean removeBooleanProperty(String sourceName, retrievedProperty = this.getBooleanProperty(sourceName, propertyName, properties, methodName); this.removeProperty(propertyName, properties); - log.debug("Properties left: " + properties); + log.debug("Properties left: " + properties.toString()); } log.debug("Retrieved " + propertyName + " property: " + retrievedProperty); @@ -1166,7 +1150,6 @@ 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()); @@ -1220,7 +1203,6 @@ 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()); @@ -1237,7 +1219,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 may be null. + * @param properties properties object to add property to may be null. * @param propertyName name of property * @param propertyValue value of property * @param methodName calling method name @@ -1268,7 +1250,6 @@ 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); @@ -1283,7 +1264,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 may be null. + * @param properties properties object to add property to may be null. * @param propertyName name of property * @param propertyValue value of property * @param methodName calling method name @@ -1314,7 +1295,6 @@ 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); @@ -1329,7 +1309,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 may be null. + * @param properties properties object to add property to may be null. * @param propertyName name of property * @param propertyValue value of property * @param methodName calling method name @@ -1365,7 +1345,6 @@ 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); @@ -1415,7 +1394,6 @@ 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()); @@ -1467,7 +1445,6 @@ 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); @@ -1513,12 +1490,7 @@ 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) { @@ -1533,7 +1505,7 @@ public InstanceProperties addStringArrayPropertyToInstance(String s resultingProperties.setProperty(propertyName, arrayPropertyValue); - log.debug("Returning instanceProperty: " + resultingProperties); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -1573,8 +1545,6 @@ public InstanceProperties addMapPropertyToInstance(String sourceNam if (properties == null) { resultingProperties = new InstanceProperties(); - - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1597,15 +1567,10 @@ 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); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -1647,7 +1612,6 @@ public InstanceProperties addStringMapPropertyToInstance(String sou if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1671,14 +1635,10 @@ 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); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -1720,13 +1680,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. */ @@ -1743,14 +1703,10 @@ 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); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -1792,7 +1748,6 @@ public InstanceProperties addLongMapPropertyToInstance(String source if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1816,15 +1771,10 @@ 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); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -1867,7 +1817,6 @@ public InstanceProperties addIntMapPropertyToInstance(String sourc if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1891,14 +1840,10 @@ 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); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -1936,7 +1881,6 @@ public InstanceProperties addPropertyMapToInstance(String sourceNam if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -1952,7 +1896,6 @@ 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()); @@ -1963,7 +1906,6 @@ 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()); @@ -1974,7 +1916,6 @@ 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()); @@ -1985,7 +1926,6 @@ 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()); @@ -1996,7 +1936,6 @@ 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()); @@ -2011,7 +1950,6 @@ 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()); @@ -2022,7 +1960,6 @@ 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()); @@ -2033,7 +1970,6 @@ 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()); @@ -2044,7 +1980,6 @@ 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()); @@ -2055,8 +1990,8 @@ else if (mapPropertyValue instanceof Float) else if (mapPropertyValue instanceof BigDecimal) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); - primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); - primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGDECIMAL); + 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); @@ -2066,8 +2001,8 @@ else if (mapPropertyValue instanceof BigDecimal) else if (mapPropertyValue instanceof BigInteger) { PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); - primitivePropertyValue.setHeaderVersion(InstancePropertyValue.CURRENT_INSTANCE_PROPERTY_VALUE_HEADER_VERSION); - primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_BIGINTEGER); + 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); @@ -2077,7 +2012,6 @@ 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()); @@ -2093,7 +2027,6 @@ 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()); @@ -2105,7 +2038,7 @@ else if (mapPropertyValue != null) if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -2144,7 +2077,6 @@ public InstanceProperties addStringPropertyMapToInstance(String sou if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -2160,7 +2092,6 @@ 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()); @@ -2172,7 +2103,7 @@ public InstanceProperties addStringPropertyMapToInstance(String sou if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -2211,8 +2142,6 @@ public InstanceProperties addBooleanPropertyMapToInstance(String s if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); - } else { @@ -2228,7 +2157,6 @@ 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()); @@ -2240,7 +2168,7 @@ public InstanceProperties addBooleanPropertyMapToInstance(String s if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -2280,7 +2208,6 @@ public InstanceProperties addLongPropertyMapToInstance(String sourc if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -2296,7 +2223,6 @@ 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()); @@ -2308,7 +2234,7 @@ public InstanceProperties addLongPropertyMapToInstance(String sourc if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -2347,7 +2273,6 @@ public InstanceProperties addIntPropertyMapToInstance(String sourc if (properties == null) { resultingProperties = new InstanceProperties(); - resultingProperties.setHeaderVersion(InstanceProperties.CURRENT_INSTANCE_PROPERTIES_HEADER_VERSION); } else { @@ -2363,7 +2288,6 @@ 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()); @@ -2375,7 +2299,7 @@ public InstanceProperties addIntPropertyMapToInstance(String sourc if (propertyCount > 0) { - log.debug("Returning instanceProperty: " + resultingProperties); + log.debug("Returning instanceProperty: " + resultingProperties.toString()); return resultingProperties; } @@ -2669,7 +2593,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; @@ -2715,7 +2639,7 @@ public SearchProperties getSearchPropertiesFromInstanceProperties(String } else { - // And the EQUALS operator for any other type + // And the EQ(uals) 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 19c2acc2f70..dcb0e09696d 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,7 +39,6 @@ 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 bcdc733506b..c454fb3ceb3 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(InstanceType.CURRENT_INSTANCE_TYPE_HEADER_VERSION); + instanceType.setHeaderVersion(InstanceElementHeader.CURRENT_INSTANCE_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(ClassificationEntityExtension.CURRENT_CLASSIFICATION_EXT_HEADER_VERSION); + classificationEntityExtension.setHeaderVersion(InstanceElementHeader.CURRENT_INSTANCE_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 2c0b3ab40c3..deeea81871a 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,7 +3,6 @@ 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; @@ -777,7 +776,6 @@ 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 6d1795a31da..d03876abc37 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,8 +206,6 @@ 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());