Skip to content

Commit

Permalink
Merge pull request #7253 from lpalashevski/fix-cts-for-release-3.14-2
Browse files Browse the repository at this point in the history
Fix cts for release 3.14
  • Loading branch information
Ljupcho Palashevski authored Dec 16, 2022
2 parents 63f28ca + 7f46032 commit 31bac9c
Show file tree
Hide file tree
Showing 24 changed files with 444 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ public R map(org.odpi.openmetadata.repositoryservices.connectors.stores.metadata
if (guid1 != null) {
end1.setNodeGuid(guid1);
}
Map<String, InstancePropertyValue> map = proxy1.getUniqueProperties().getInstanceProperties();
PrimitivePropertyValue qualifiedNamePropertyValue = (PrimitivePropertyValue) map.get("qualifiedName");
if (qualifiedNamePropertyValue != null) {
end1.setNodeQualifiedName(qualifiedNamePropertyValue.getPrimitiveValue().toString());
if (proxy1.getUniqueProperties() != null) {
Map<String, InstancePropertyValue> 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) {
Expand All @@ -57,10 +58,12 @@ public R map(org.odpi.openmetadata.repositoryservices.connectors.stores.metadata
if (guid2 != null) {
end2.setNodeGuid(guid2);
}
Map<String, InstancePropertyValue> map = proxy2.getUniqueProperties().getInstanceProperties();
PrimitivePropertyValue qualifiedNamePropertyValue = (PrimitivePropertyValue) map.get("qualifiedName");
if (qualifiedNamePropertyValue != null) {
end2.setNodeQualifiedName(qualifiedNamePropertyValue.getPrimitiveValue().toString());
if (proxy2.getUniqueProperties() != null) {
Map<String, InstancePropertyValue> map = proxy2.getUniqueProperties().getInstanceProperties();
PrimitivePropertyValue qualifiedNamePropertyValue = (PrimitivePropertyValue) map.get("qualifiedName");
if (qualifiedNamePropertyValue != null) {
end2.setNodeQualifiedName(qualifiedNamePropertyValue.getPrimitiveValue().toString());
}
}
}
// set readonly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -32,7 +30,8 @@ public class ArrayPropertyValue extends InstancePropertyValue
/**
* Default constructor sets the array to empty.
*/
public ArrayPropertyValue() {
public ArrayPropertyValue()
{
super(InstancePropertyCategory.ARRAY);
}

Expand Down Expand Up @@ -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 +
Expand All @@ -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;
}


Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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;
}


Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, InstancePropertyValue> propertyValueMap = new HashMap<>();
Map<String, InstancePropertyValue> 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;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ public boolean equals(Object objectToCompare)
@Override
public int hashCode()
{

return Objects.hash(super.hashCode(), getOrdinal(), getSymbolicName(), getDescription());
}
}
Expand Down
Loading

0 comments on commit 31bac9c

Please sign in to comment.