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
FieldsFields 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 -
Constructor Summary
ConstructorsConstructorDescriptionClassificationMapping(XTDBOMRSRepositoryConnector xtdbConnector, List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.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.IPersistentMapaddToMap(clojure.lang.IPersistentMap doc, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification classification) Add the details of the provided classification to the XTDB document map.voidaddToXtdbDoc(xtdb.api.XtdbDocument.Builder builder) Add the details of the mapping to the provided XtdbDocument builder.static List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification>fromMap(clojure.lang.IPersistentMap doc) Translate the provided XTDB representation into an Egeria representation.static StringgetClassificationNameFromNamespace(String root, String qualifiedNamespace) Given a fully-qualified classification namespace and a root, parse out the name of the classification.static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ClassificationOrigingetClassificationOriginFromSymbolicName(String symbolicName) Convert the provided symbolic name into its ClassificationOrigin.static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ClassificationOrigingetClassificationOriginFromSymbolicName(XTDBOMRSRepositoryConnector xtdbConnector, String symbolicName) Convert the provided symbolic name into its ClassificationOrigin.static StringgetNamespaceForClassification(String classificationName) Given a classification name (on its own), convert it into a qualified name that can be used for the namespace.static StringgetNamespaceForClassification(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 StringgetNamespaceForProperties(String qualifiedRoot) Retrieve the namespace for properties of the classificationstatic StringgetSymbolicNameForClassificationOrigin(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ClassificationOrigin co) Convert the provided ClassificationOrigin into its symbolic name.static booleanisKnownBaseProperty(String property) Check whether the specified property is a known base-level Classification property.static clojure.lang.IPersistentMapremoveFromMap(clojure.lang.IPersistentMap doc, String classificationName) Remove all details of the provided classification name from the XTDB document map.List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification>toEgeria()Map from XTDB to Egeria.static voidvalidateHasClassification(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, getTypeFromInstanceMethods inherited from class org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.mapping.AbstractMapping
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<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.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, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification classification) throws IOException, org.odpi.openmetadata.repositoryservices.ffdc.exception.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 classificationorg.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- on any type-related property error
-
removeFromMap
public static clojure.lang.IPersistentMap removeFromMap(clojure.lang.IPersistentMap doc, String classificationName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.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:
org.odpi.openmetadata.repositoryservices.ffdc.exception.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 org.odpi.openmetadata.repositoryservices.ffdc.exception.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:
org.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException- if the instance does not possess the classification
-
toEgeria
public List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification> toEgeria()Map from XTDB to Egeria.- Returns:
List<Classification>- See Also:
-
fromMap
public static List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification> fromMap(clojure.lang.IPersistentMap doc) throws IOException, org.odpi.openmetadata.repositoryservices.ffdc.exception.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 valuesorg.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- 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 org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.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 org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ClassificationOrigin getClassificationOriginFromSymbolicName(String symbolicName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException Convert the provided symbolic name into its ClassificationOrigin.- Parameters:
symbolicName- to convert- Returns:
- ClassificationOrigin
- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- if there is no such symbolic name
-
getSymbolicNameForClassificationOrigin
public static String getSymbolicNameForClassificationOrigin(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.ClassificationOrigin co) 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
-