Class ClassificationMapping
- java.lang.Object
-
- org.odpi.egeria.connectors.juxt.xtdb.mapping.AbstractMapping
-
- org.odpi.egeria.connectors.juxt.xtdb.mapping.InstanceAuditHeaderMapping
-
- org.odpi.egeria.connectors.juxt.xtdb.mapping.ClassificationMapping
-
public class ClassificationMapping extends InstanceAuditHeaderMapping
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 Modifier and Type Field Description static StringCLASSIFICATION_PROPERTIES_NSstatic StringLAST_CLASSIFICATION_CHANGEstatic StringN_LAST_CLASSIFICATION_CHANGE-
Fields inherited from class org.odpi.egeria.connectors.juxt.xtdb.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.egeria.connectors.juxt.xtdb.mapping.AbstractMapping
mapper, xtdbConnector
-
-
Constructor Summary
Constructors Constructor Description 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).ClassificationMapping(XtdbOMRSRepositoryConnector xtdbConnector, xtdb.api.XtdbDocument xtdbDoc)Construct a mapping from a XTDB map (to map to an Egeria representation).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.protected List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification>fromDoc()Translate the provided XTDB representation into an Egeria representation.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.egeria.connectors.juxt.xtdb.mapping.InstanceAuditHeaderMapping
addToMap, addTypeDetailsToMap, buildDoc, buildDoc, fromDoc, fromDoc, fromMap, getTypeFromInstance
-
Methods inherited from class org.odpi.egeria.connectors.juxt.xtdb.mapping.AbstractMapping
getDeserializedValue, getDeserializedValue, getEmbeddedSerializedForm, getEmbeddedSerializedForm, getKeyword, getKeyword
-
-
-
-
Field Detail
-
CLASSIFICATION_PROPERTIES_NS
public static final String CLASSIFICATION_PROPERTIES_NS
- See Also:
- Constant Field Values
-
N_LAST_CLASSIFICATION_CHANGE
public static final String N_LAST_CLASSIFICATION_CHANGE
- See Also:
- Constant Field Values
-
LAST_CLASSIFICATION_CHANGE
public static final String LAST_CLASSIFICATION_CHANGE
-
-
Constructor Detail
-
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 Detail
-
isKnownBaseProperty
public static boolean isKnownBaseProperty(String property)
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.InvalidParameterExceptionAdd 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.ClassificationErrorExceptionRemove 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.ClassificationErrorExceptionValidates 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:
ClassificationMapping(XtdbOMRSRepositoryConnector, XtdbDocument)
-
fromDoc
protected List<org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification> fromDoc()
Translate the provided XTDB representation into an Egeria representation.- Returns:
List<Classification>
-
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
public 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.- Parameters:
root- namespaceclassificationName- of the classification- Returns:
- String qualified namespace
-
getClassificationNameFromNamespace
public static String getClassificationNameFromNamespace(String root, String qualifiedNamespace)
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
public 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.- 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
-
-