Class ClassificationMapping
java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.AbstractMapping
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.InstanceAuditHeaderMapping
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.ClassificationMapping
Maps the properties of Classifications between persistence and objects.
The idea is to map Classifications into a XTDB data model that flattens their structure into the EntitySummary
structure itself (so they are always retrieved with the EntitySummary document), using the following convention:
{
...
:classifications.Confidentiality/type :type/(GUID)
:classifications.Confidentiality/instanceLicense ""
:classifications.Confidentiality/createTime #inst "2021-01-26T16:35:37.504-00:00"
:classifications.Confidentiality.classificationProperties/level ...
...
:classifications.AnotherClassification/type :type/(GUID)
:classifications.AnotherClassification/createTime #inst "2021-01-26T16:30:37.504-00:00"
:classifications.AnotherClassification.classificationProperties/property ...
...
}
In this way, each classification can be kept separate from other classifications, and a single classification's
value remains mutually-exclusive with any other values for that classification (due to the unique reference name of
the properties of that classification).-
Field Summary
Fields inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.InstanceAuditHeaderMapping
CREATE_TIME, CURRENT_STATUS, INSTANCE_PROVENANCE_TYPE, MAINTAINED_BY, METADATA_COLLECTION_ID, METADATA_COLLECTION_NAME, REPLICATED_BY, STATUS_ON_DELETE, TYPE_DEF_CATEGORY, TYPE_DEF_GUIDS, UPDATE_TIME, UPDATED_BY, VERSION
Fields inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.AbstractMapping
mapper, xtdbConnector
-
Constructor Summary
ConstructorDescriptionClassificationMapping
(XTDBOMRSRepositoryConnector xtdbConnector, List<Classification> classifications) Construct a mapping from a Classification (to map to a XTDB representation).ClassificationMapping
(XTDBOMRSRepositoryConnector xtdbConnector, xtdb.api.XtdbDocument xtdbDoc) Construct a mapping from a XTDB map (to map to an Egeria representation). -
Method Summary
Modifier and TypeMethodDescriptionstatic clojure.lang.IPersistentMap
addToMap
(clojure.lang.IPersistentMap doc, Classification classification) Add the details of the provided classification to the XTDB document map.void
addToXtdbDoc
(xtdb.api.XtdbDocument.Builder builder) Add the details of the mapping to the provided XtdbDocument builder.protected List<Classification>
fromDoc()
Translate the provided XTDB representation into an Egeria representation.static List<Classification>
fromMap
(clojure.lang.IPersistentMap doc) Translate the provided XTDB representation into an Egeria representation.static String
getClassificationNameFromNamespace
(String root, String qualifiedNamespace) Given a fully-qualified classification namespace and a root, parse out the name of the classification.static ClassificationOrigin
getClassificationOriginFromSymbolicName
(String symbolicName) Convert the provided symbolic name into its ClassificationOrigin.static ClassificationOrigin
getClassificationOriginFromSymbolicName
(XTDBOMRSRepositoryConnector xtdbConnector, String symbolicName) Convert the provided symbolic name into its ClassificationOrigin.static String
getNamespaceForClassification
(String classificationName) Given a classification name (on its own), convert it into a qualified name that can be used for the namespace.static String
getNamespaceForClassification
(String root, String classificationName) Given a classification name and qualifying namespace, convert into a qualified name that can be used for the classification-specific namespace.static String
getNamespaceForProperties
(String qualifiedRoot) Retrieve the namespace for properties of the classificationstatic String
Convert the provided ClassificationOrigin into its symbolic name.static boolean
isKnownBaseProperty
(String property) Check whether the specified property is a known base-level Classification property.static clojure.lang.IPersistentMap
removeFromMap
(clojure.lang.IPersistentMap doc, String classificationName) Remove all details of the provided classification name from the XTDB document map.toEgeria()
Map from XTDB to Egeria.static void
validateHasClassification
(clojure.lang.IPersistentMap instance, String classificationName, String className, String methodName) Validates that the provided metadata instance possesses the specified classification.Methods inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.InstanceAuditHeaderMapping
addToMap, addTypeDetailsToMap, buildDoc, buildDoc, fromDoc, fromDoc, fromMap, getTypeFromInstance
Methods inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.AbstractMapping
getDeserializedValue, getDeserializedValue, getEmbeddedSerializedForm, getEmbeddedSerializedForm, getKeyword, getKeyword
-
Field Details
-
CLASSIFICATION_PROPERTIES_NS
- See Also:
-
N_LAST_CLASSIFICATION_CHANGE
- See Also:
-
LAST_CLASSIFICATION_CHANGE
-
-
Constructor Details
-
ClassificationMapping
public ClassificationMapping(XTDBOMRSRepositoryConnector xtdbConnector, List<Classification> classifications) Construct a mapping from a Classification (to map to a XTDB representation).- Parameters:
xtdbConnector
- connectivity to XTDBclassifications
- from which to map
-
ClassificationMapping
public ClassificationMapping(XTDBOMRSRepositoryConnector xtdbConnector, xtdb.api.XtdbDocument xtdbDoc) Construct a mapping from a XTDB map (to map to an Egeria representation).- Parameters:
xtdbConnector
- connectivity to XTDBxtdbDoc
- from which to map
-
-
Method Details
-
isKnownBaseProperty
Check whether the specified property is a known base-level Classification property.- Parameters:
property
- to check- Returns:
- boolean
-
addToXtdbDoc
public void addToXtdbDoc(xtdb.api.XtdbDocument.Builder builder) Add the details of the mapping to the provided XtdbDocument builder.- Parameters:
builder
- into which to add the classification details
-
addToMap
public static clojure.lang.IPersistentMap addToMap(clojure.lang.IPersistentMap doc, Classification classification) throws IOException, InvalidParameterException Add the details of the provided classification to the XTDB document map.- Parameters:
doc
- document map into which to add the classification detailsclassification
- to add into the doc- Returns:
- IPersistentMap the updated document map
- Throws:
IOException
- on any error serializing the classificationInvalidParameterException
- on any type-related property error
-
removeFromMap
public static clojure.lang.IPersistentMap removeFromMap(clojure.lang.IPersistentMap doc, String classificationName) throws ClassificationErrorException Remove all details of the provided classification name from the XTDB document map.- Parameters:
doc
- document map from which to remove the classification detailsclassificationName
- to remove from the doc- Returns:
- IPersistentMap the updated document map
- Throws:
ClassificationErrorException
- if the provided document map does not contain the specified classification
-
validateHasClassification
public static void validateHasClassification(clojure.lang.IPersistentMap instance, String classificationName, String className, String methodName) throws ClassificationErrorException Validates that the provided metadata instance possesses the specified classification.- Parameters:
instance
- to confirm possesses the classificationclassificationName
- to confirm the instance possessesclassName
- class calledmethodName
- method called- Throws:
ClassificationErrorException
- if the instance does not possess the classification
-
toEgeria
Map from XTDB to Egeria.- Returns:
List<Classification>
- See Also:
-
fromDoc
Translate the provided XTDB representation into an Egeria representation.- Returns:
List<Classification>
-
fromMap
public static List<Classification> fromMap(clojure.lang.IPersistentMap doc) throws IOException, InvalidParameterException Translate the provided XTDB representation into an Egeria representation.- Parameters:
doc
- from which to map- Returns:
List<Classification>
- Throws:
IOException
- on any issue deserializing valuesInvalidParameterException
- for any unmapped properties
-
getNamespaceForClassification
Given a classification name and qualifying namespace, convert into a qualified name that can be used for the classification-specific namespace.- Parameters:
root
- namespaceclassificationName
- of the classification- Returns:
- String qualified namespace
-
getClassificationNameFromNamespace
Given a fully-qualified classification namespace and a root, parse out the name of the classification.- Parameters:
root
- namespacequalifiedNamespace
- fully-qualified classification namespace- Returns:
- String classification name
-
getNamespaceForClassification
Given a classification name (on its own), convert it into a qualified name that can be used for the namespace.- Parameters:
classificationName
- to translate- Returns:
- String qualified namespace
-
getClassificationOriginFromSymbolicName
public static ClassificationOrigin getClassificationOriginFromSymbolicName(XTDBOMRSRepositoryConnector xtdbConnector, String symbolicName) Convert the provided symbolic name into its ClassificationOrigin.- Parameters:
xtdbConnector
- connectivity to the repositorysymbolicName
- to convert- Returns:
- ClassificationOrigin
-
getClassificationOriginFromSymbolicName
public static ClassificationOrigin getClassificationOriginFromSymbolicName(String symbolicName) throws InvalidParameterException Convert the provided symbolic name into its ClassificationOrigin.- Parameters:
symbolicName
- to convert- Returns:
- ClassificationOrigin
- Throws:
InvalidParameterException
- if there is no such symbolic name
-
getSymbolicNameForClassificationOrigin
Convert the provided ClassificationOrigin into its symbolic name.- Parameters:
co
- to convert- Returns:
- String
-
getNamespaceForProperties
Retrieve the namespace for properties of the classification- Parameters:
qualifiedRoot
- the classification-qualified root for the namespace- Returns:
- String
-