Class InstancePropertyValueMapping
java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.AbstractMapping
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.InstancePropertyValueMapping
- Direct Known Subclasses:
ArrayPropertyValueMapping
,EnumPropertyValueMapping
,MapPropertyValueMapping
,PrimitivePropertyValueMapping
,StructPropertyValueMapping
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.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.AbstractMapping
mapper, xtdbConnector
-
Constructor Summary
ModifierConstructorDescriptionprotected
Necessary default constructor to ensure we can use the static objectMapper of the base class. -
Method Summary
Modifier and TypeMethodDescriptionstatic clojure.lang.IPersistentMap
addInstancePropertyValueToDoc
(clojure.lang.IPersistentMap doc, PropertyKeywords propertyKeywords, 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, InstancePropertyValue value) Retrieve the fully-qualified names for the provided property, everywhere it could appear within a given type.static Object
getValueForComparison
(XTDBOMRSRepositoryConnector xtdbConnector, InstancePropertyValue ipv) Convert the provided Egeria value into a XTDB comparable form.static Object
Convert the provided Egeria value into a XTDB comparable form.Methods inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.AbstractMapping
getDeserializedValue, getDeserializedValue, getEmbeddedSerializedForm, getEmbeddedSerializedForm, getKeyword, getKeyword
-
Constructor Details
-
InstancePropertyValueMapping
protected InstancePropertyValueMapping()Necessary default constructor to ensure we can use the static objectMapper of the base class.
-
-
Method Details
-
getValueForComparison
public static Object getValueForComparison(XTDBOMRSRepositoryConnector xtdbConnector, 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(InstancePropertyValue ipv) throws 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:
InvalidParameterException
- if the value cannot be persisted
-
addInstancePropertyValueToDoc
public static clojure.lang.IPersistentMap addInstancePropertyValueToDoc(clojure.lang.IPersistentMap doc, PropertyKeywords propertyKeywords, InstancePropertyValue value) throws InvalidParameterException, IOException Add 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:
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, 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
-