Class InstancePropertyValueMapping
- java.lang.Object
-
- org.odpi.egeria.connectors.juxt.xtdb.mapping.AbstractMapping
-
- org.odpi.egeria.connectors.juxt.xtdb.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.xtdb.mapping.AbstractMapping
mapper, xtdbConnector
-
-
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 clojure.lang.IPersistentMapaddInstancePropertyValueToDoc(clojure.lang.IPersistentMap doc, PropertyKeywords propertyKeywords, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value)Add a single property value to the provided XTDB representation.static Set<clojure.lang.Keyword>getKeywordsForProperty(XtdbOMRSRepositoryConnector xtdbConnector, 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 ObjectgetValueForComparison(XtdbOMRSRepositoryConnector xtdbConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue ipv)Convert the provided Egeria value into a XTDB comparable form.static ObjectgetValueForComparison(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue ipv)Convert the provided Egeria value into a XTDB comparable form.-
Methods inherited from class org.odpi.egeria.connectors.juxt.xtdb.mapping.AbstractMapping
getDeserializedValue, getDeserializedValue, getEmbeddedSerializedForm, getEmbeddedSerializedForm, getKeyword, getKeyword
-
-
-
-
Method Detail
-
getValueForComparison
public static Object getValueForComparison(XtdbOMRSRepositoryConnector xtdbConnector, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue ipv)
Convert the provided Egeria value into a XTDB comparable form.- Parameters:
xtdbConnector- connectivity to the repositoryipv- Egeria value to translate to XTDB-comparable value- Returns:
- Object value that XTDB can compare
-
getValueForComparison
public static Object getValueForComparison(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue ipv) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException
Convert the provided Egeria value into a XTDB comparable form.- Parameters:
ipv- Egeria value to translate to XTDB-comparable value- Returns:
- Object value that XTDB can compare
- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- if the value cannot be persisted
-
addInstancePropertyValueToDoc
public static clojure.lang.IPersistentMap addInstancePropertyValueToDoc(clojure.lang.IPersistentMap doc, PropertyKeywords propertyKeywords, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue value) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, IOExceptionAdd a single property value to the provided XTDB representation.- Parameters:
doc- the XTDB map to which to add the propertypropertyKeywords- the property whose value should be setvalue- of the property- Returns:
- IPersistentMap containing the updated value
- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- if the value cannot be persistedIOException- on any error serializing the value
-
getKeywordsForProperty
public static Set<clojure.lang.Keyword> getKeywordsForProperty(XtdbOMRSRepositoryConnector xtdbConnector, 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:
xtdbConnector- 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
-
-