Class InstancePropertyValueMapping
- java.lang.Object
-
- org.odpi.egeria.connectors.juxt.crux.mapping.AbstractMapping
-
- org.odpi.egeria.connectors.juxt.crux.mapping.InstancePropertyValueMapping
-
- Direct Known Subclasses:
ArrayPropertyValueMapping,EnumPropertyValueMapping,MapPropertyValueMapping,PrimitivePropertyValueMapping,StructPropertyValueMapping
public abstract class InstancePropertyValueMapping extends AbstractMapping
Maps singular InstancePropertyValues between persistence and objects. These cannot simply be serialized to JSON as that would impact the ability to search their values correctly, so we must break apart the values and the types for each property. In general, we will store the complete value into the '.json' portion, but we will also store just the value alone (without any type details) into the '.value' portion. This will allow us to quickly pull back the complete value from a JSON-serialized form (from '.json') while also providing a reliable search point at the '.value'. This class and its subclasses must be responsible for ensuring that these two properties are kept aligned with each other at all times. Furthermore, the naming for the '.value' point used for searching must retain within its overall property name the qualification of which TypeDef defined that property. This is to ensure that different TypeDefinitions that use the same property name, but which have different types (eg. position being a string vs an integer) can be distinguished. This is necessary at a minimum because otherwise we will hit ClassCastExceptions in Clojure due to trying to compare the same property with fundamentally different values (string vs int) if the property name is not qualified with the type in which it is defined. (The '.json' value does not need to be qualified since we do not compare it but only use it for fast-access serde purposes.) See the subclasses of this class, which handle mappings for the various subtypes of InstancePropertyValue for details of each '.value' representation.
-
-
Field Summary
-
Fields inherited from class org.odpi.egeria.connectors.juxt.crux.mapping.AbstractMapping
cruxConnector, mapper
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInstancePropertyValueMapping()Necessary default constructor to ensure we can use the static objectMapper of the base class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddInstancePropertyValueToDoc(CruxOMRSRepositoryConnector cruxConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceType instanceType, crux.api.CruxDocument.Builder builder, String propertyName, String namespace, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value)Add a single property value to the provided Crux representation.static StringgetEndsWithPropertyNameForMatching(String propertyName)Retrieve a partially-qualified property name that can be used to compare a Lucene match using ends-with.static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValuegetInstancePropertyValueFromDoc(CruxOMRSRepositoryConnector cruxConnector, crux.api.CruxDocument cruxDoc, String namespace, String propertyName)Retrieve a single property value from the provided Crux representation.static Set<clojure.lang.Keyword>getKeywordsForProperty(CruxOMRSRepositoryConnector cruxConnector, String propertyName, String namespace, Set<String> limitToTypes, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value)Retrieve the fully-qualified names for the provided property, everywhere it could appear within a given type.static Set<String>getNamesForProperty(CruxOMRSRepositoryConnector cruxConnector, String propertyName, String namespace, Set<String> limitToTypes, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value)Retrieve the fully-qualified names for the provided property, everywhere it could appear within a given type.protected static StringgetPropertyValueKeyword(CruxOMRSRepositoryConnector cruxConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceType instanceType, String propertyName, String namespace)Retrieve the qualified Crux name for the value of the property.protected static StringgetSerializedPropertyKeyword(String namespace, String propertyName)Retrieve the keyword to use to store the serialized value of the property.static ObjectgetValueForComparison(CruxOMRSRepositoryConnector cruxConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue ipv)Convert the provided Egeria value into a Crux comparable form.-
Methods inherited from class org.odpi.egeria.connectors.juxt.crux.mapping.AbstractMapping
getDeserializedValue, getEmbeddedSerializedForm, getKeyword, getKeyword
-
-
-
-
Method Detail
-
getValueForComparison
public static Object getValueForComparison(CruxOMRSRepositoryConnector cruxConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue ipv)
Convert the provided Egeria value into a Crux comparable form.- Parameters:
cruxConnector- connectivity to the repositoryipv- Egeria value to translate to Crux-comparable value- Returns:
- Object value that Crux can compare
-
getInstancePropertyValueFromDoc
public static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue getInstancePropertyValueFromDoc(CruxOMRSRepositoryConnector cruxConnector, crux.api.CruxDocument cruxDoc, String namespace, String propertyName)
Retrieve a single property value from the provided Crux representation.- Parameters:
cruxConnector- connectivity to the repositorycruxDoc- from which to retrieve the valuenamespace- by which the property is qualifiedpropertyName- of the property- Returns:
- InstancePropertyValue giving Egeria representation of the value
-
addInstancePropertyValueToDoc
public static void addInstancePropertyValueToDoc(CruxOMRSRepositoryConnector cruxConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceType instanceType, crux.api.CruxDocument.Builder builder, String propertyName, String namespace, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value)
Add a single property value to the provided Crux representation.- Parameters:
cruxConnector- connectivity to the repositoryinstanceType- describing the instance to which this property appliesbuilder- through which to add the propertypropertyName- of the property to add / replacenamespace- by which the property should be qualifiedvalue- of the property
-
getSerializedPropertyKeyword
protected static String getSerializedPropertyKeyword(String namespace, String propertyName)
Retrieve the keyword to use to store the serialized value of the property.- Parameters:
namespace- by which to qualify the propertypropertyName- of the property- Returns:
- String giving the qualified keyword
-
getPropertyValueKeyword
protected static String getPropertyValueKeyword(CruxOMRSRepositoryConnector cruxConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceType instanceType, String propertyName, String namespace)
Retrieve the qualified Crux name for the value of the property.- Parameters:
cruxConnector- connectivity to the repositoryinstanceType- of the instance for which this property appliespropertyName- of the propertynamespace- by which to qualify the property- Returns:
- String
-
getNamesForProperty
public static Set<String> getNamesForProperty(CruxOMRSRepositoryConnector cruxConnector, String propertyName, String namespace, Set<String> limitToTypes, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value)
Retrieve the fully-qualified names for the provided property, everywhere it could appear within a given type. Note that generally the returned Set will only have a single element, however if requested from a sufficiently abstract type (eg. Referenceable) under which different subtypes have the same property defined, the Set will contain a property reference for each of those subtypes' properties.- Parameters:
cruxConnector- connectivity to the repositorypropertyName- of the property for which to qualify type-specific referencesnamespace- under which to qualify the propertieslimitToTypes- limit the type-specific qualifications to only properties that are applicable to these typesvalue- that will be used for comparison, to limit the properties to include based on their type- Returns:
Set<String>of the property references
-
getKeywordsForProperty
public static Set<clojure.lang.Keyword> getKeywordsForProperty(CruxOMRSRepositoryConnector cruxConnector, String propertyName, String namespace, Set<String> limitToTypes, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value)
Retrieve the fully-qualified names for the provided property, everywhere it could appear within a given type. Note that generally the returned Set will only have a single element, however if requested from a sufficiently abstract type (eg. Referenceable) under which different subtypes have the same property defined, the Set will contain a property reference for each of those subtypes' properties.- Parameters:
cruxConnector- connectivity to the repositorypropertyName- of the property for which to qualify type-specific referencesnamespace- under which to qualify the propertieslimitToTypes- limit the type-specific qualifications to only properties that are applicable to these typesvalue- that will be used for comparison, to limit the properties to include based on their type- Returns:
Set<Keyword>of the property references
-
getEndsWithPropertyNameForMatching
public static String getEndsWithPropertyNameForMatching(String propertyName)
Retrieve a partially-qualified property name that can be used to compare a Lucene match using ends-with.- Parameters:
propertyName- of the property to reference- Returns:
- String match-able ending to the property (without any type qualification)
-
-