Class BitolMapperBase
java.lang.Object
org.odpi.openmetadata.frameworks.integration.bitol.mapping.BitolMapperBase
- Direct Known Subclasses:
DataContractMapper,DataProductMapper
BitolMapperBase holds the mapping logic that is shared by the Open Data Contract Standard (ODCS) and Open Data
Product Standard (ODPS) mappers: the fundamentals of a document (identity, status, description, tags), custom
properties, authoritative definitions, support channels and teams. The mappers work through the connector context
clients so that they can run inside an integration connector (through the IntegrationContext) or inside a view
service that builds a ConnectorContextBase for the calling user.
Every element created from a document has a deterministic qualifiedName built from the document's identifier and version, so that republishing a document updates the existing elements rather than duplicating them, and each version of a document is a distinct element. The document identifier is also recorded as an ExternalId shared by all versions.
Every element created from a document has a deterministic qualifiedName built from the document's identifier and version, so that republishing a document updates the existing elements rather than duplicating them, and each version of a document is a distinct element. The document identifier is also recorded as an ExternalId shared by all versions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPrefix used in additionalProperties for values that have no home in the open metadata types.protected final ConnectorContextBasestatic final StringName of the additional property that holds the AI context block as JSON.static final StringName of the additional property that holds the full custom properties list as JSON when an entry carries a vendor, description or id.static final StringName of the additional property that records that an element is deprecated.static final Stringstatic final StringName of the additional property that holds the synonyms as JSON. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBitolMapperBase(ConnectorContextBase context) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomProperties(List<BitolCustomProperty> customProperties, Map<String, String> additionalProperties) Copy custom properties into additional properties.protected voidaddDescriptionDetails(BitolDescription description, Map<String, String> additionalProperties) Copy the limitations and usage of a description into additional properties.protected voidaddSearchKeywords(List<String> tags, String elementGUID) Attach the document's tags to the element as search keywords.Return the standard spelling of a vocabulary value when it is one of the standard values, otherwise the value as written in the document.protected voidfillFundamentals(BitolDocument document, AuthoredReferenceableProperties properties, String qualifiedName) Copy the fundamentals of a document into the properties of the element that represents it.protected StringfindElementGUID(String qualifiedName) Return the unique identifier of the element with the supplied qualified name, or null if there is none.protected List<OpenMetadataRootElement> findElementsByDocumentId(String kind, String id) Return the elements identified by a document identifier, found through the ExternalId that all versions of the document share.protected ContactMethodTypegetContactMethodType(String tool) Map a Bitol support tool onto a contact method type.static StringgetDocumentQualifiedName(String kind, String id, String version) Build the qualified name for the element that represents a document version.static StringgetExternalIdQualifiedName(String kind, String id) Build the qualified name for the ExternalId that carries a document identifier.protected OpenMetadataRootElementgetLatestVersion(List<OpenMetadataRootElement> elements) Return the element with the highest version identifier from the supplied list.protected booleanisRetired(BitolDocument document) Return whether the document has been retired, in which case its element is deleted rather than maintained.protected voidlinkAuthoritativeDefinitions(List<BitolAuthoritativeDefinition> authoritativeDefinitions, String elementGUID) Link the element to external references for the document's authoritative definitions, creating each reference if its URL is not already known.protected voidlinkExternalId(String kind, String id, String elementGUID, String source) Record the document identifier as an ExternalId linked to the element.protected voidlinkSupportChannels(List<BitolSupportChannel> supportChannels, String elementGUID, String elementQualifiedName) Create contact details for each of the document's support channels and link them to the element.protected voidlinkTeam(BitolTeam team, String elementGUID, String elementQualifiedName, BitolMappingResult result) Create the team and the roles for the team members described in the document.protected voidlinkTenantOrganization(String tenant, String elementGUID) Link the element to the organization named as the document's tenant, creating the organization profile if it is not already known.protected DateParse an ISO date (yyyy-MM-dd) from the document.protected static voidAdd a value to the additional properties under the bitol prefix if it is present.protected voidsetContentStatus(String status, AuthoredReferenceableProperties properties) Map a Bitol status onto the content status of an element.protected StringFormat a bean (or list of beans) from a document as a JSON fragment for an additional property, so that it can be regenerated without loss.protected StringtoStringValue(Object value) Return a value from a document as a string for additionalProperties.
-
Field Details
-
ADDITIONAL_PROPERTY_PREFIX
Prefix used in additionalProperties for values that have no home in the open metadata types.- See Also:
-
CUSTOM_PROPERTIES_JSON
Name of the additional property that holds the full custom properties list as JSON when an entry carries a vendor, description or id.- See Also:
-
CONTEXT_JSON
Name of the additional property that holds the AI context block as JSON.- See Also:
-
SYNONYMS_JSON
Name of the additional property that holds the synonyms as JSON.- See Also:
-
DEPRECATED
Name of the additional property that records that an element is deprecated.- See Also:
-
SEPARATOR
- See Also:
-
context
-
-
Constructor Details
-
BitolMapperBase
Constructor.- Parameters:
context- connector context providing access to the open metadata clients
-
-
Method Details
-
getDocumentQualifiedName
Build the qualified name for the element that represents a document version.- Parameters:
kind- kind of documentid- document identifierversion- document version (may be null)- Returns:
- qualified name
-
getExternalIdQualifiedName
Build the qualified name for the ExternalId that carries a document identifier. It is shared by all versions.- Parameters:
kind- kind of documentid- document identifier- Returns:
- qualified name
-
findElementGUID
protected String findElementGUID(String qualifiedName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Return the unique identifier of the element with the supplied qualified name, or null if there is none.- Parameters:
qualifiedName- qualified name to look for- Returns:
- guid or null
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
findElementsByDocumentId
protected List<OpenMetadataRootElement> findElementsByDocumentId(String kind, String id) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Return the elements identified by a document identifier, found through the ExternalId that all versions of the document share.- Parameters:
kind- kind of documentid- document identifier- Returns:
- list of elements (empty if none)
- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
getLatestVersion
Return the element with the highest version identifier from the supplied list. Versions are compared as dot-separated numbers where possible, otherwise as strings.- Parameters:
elements- candidate elements- Returns:
- chosen element or null if the list is empty
-
fillFundamentals
protected void fillFundamentals(BitolDocument document, AuthoredReferenceableProperties properties, String qualifiedName) Copy the fundamentals of a document into the properties of the element that represents it.- Parameters:
document- documentproperties- properties to fillqualifiedName- qualified name for the element
-
setContentStatus
Map a Bitol status onto the content status of an element. Values outside the standard set are recorded as OTHER with the original value in userDefinedContentStatus.- Parameters:
status- status from the documentproperties- properties to update
-
isRetired
Return whether the document has been retired, in which case its element is deleted rather than maintained.- Parameters:
document- document- Returns:
- boolean
-
addDescriptionDetails
protected void addDescriptionDetails(BitolDescription description, Map<String, String> additionalProperties) Copy the limitations and usage of a description into additional properties.- Parameters:
description- description structure (may be null)additionalProperties- map to add to
-
addCustomProperties
protected void addCustomProperties(List<BitolCustomProperty> customProperties, Map<String, String> additionalProperties) Copy custom properties into additional properties. Values that are not simple strings are rendered with toString so that lists and structures are still visible.- Parameters:
customProperties- custom properties from the document (may be null)additionalProperties- map to add to
-
canonical
Return the standard spelling of a vocabulary value when it is one of the standard values, otherwise the value as written in the document. The enumerations are also registered as valid metadata values by the Core Content Pack, so a standard value stored this way matches the valid value exactly.- Type Parameters:
E- enumeration type- Parameters:
value- value from the document (may be null)standard- the enumeration matched from the value, or null if it is not a standard value- Returns:
- canonical value or the original
-
putIfPresent
protected static void putIfPresent(Map<String, String> additionalProperties, String name, String value) Add a value to the additional properties under the bitol prefix if it is present.- Parameters:
additionalProperties- map to add toname- property name (without prefix)value- value (may be null)
-
toJSON
Format a bean (or list of beans) from a document as a JSON fragment for an additional property, so that it can be regenerated without loss.- Parameters:
bean- bean (may be null)- Returns:
- json text or null
-
toStringValue
Return a value from a document as a string for additionalProperties.- Parameters:
value- value (may be null)- Returns:
- string or null
-
linkExternalId
protected void linkExternalId(String kind, String id, String elementGUID, String source) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Record the document identifier as an ExternalId linked to the element. The ExternalId is shared by all versions of the document, so it is created once and linked to each version's element.- Parameters:
kind- kind of documentid- document identifierelementGUID- element representing this versionsource- description of where the document came from- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
addSearchKeywords
protected void addSearchKeywords(List<String> tags, String elementGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Attach the document's tags to the element as search keywords.- Parameters:
tags- tags from the document (may be null)elementGUID- element to tag- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
linkTenantOrganization
protected void linkTenantOrganization(String tenant, String elementGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Link the element to the organization named as the document's tenant, creating the organization profile if it is not already known. The element is scoped by the organization.- Parameters:
tenant- tenant from the document (may be null)elementGUID- element to link- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
linkAuthoritativeDefinitions
protected void linkAuthoritativeDefinitions(List<BitolAuthoritativeDefinition> authoritativeDefinitions, String elementGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Link the element to external references for the document's authoritative definitions, creating each reference if its URL is not already known.- Parameters:
authoritativeDefinitions- definitions from the document (may be null)elementGUID- element to link- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
linkSupportChannels
protected void linkSupportChannels(List<BitolSupportChannel> supportChannels, String elementGUID, String elementQualifiedName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Create contact details for each of the document's support channels and link them to the element. The contact details are anchored to the element so they are removed with it.- Parameters:
supportChannels- channels from the document (may be null)elementGUID- element to linkelementQualifiedName- qualified name of the element (used to build the contact details' names)- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
getContactMethodType
Map a Bitol support tool onto a contact method type.- Parameters:
tool- tool from the document (may be null)- Returns:
- enum
-
linkTeam
protected void linkTeam(BitolTeam team, String elementGUID, String elementQualifiedName, BitolMappingResult result) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Create the team and the roles for the team members described in the document. The team is a Team profile named from the document; each member becomes a PersonRole scoped to the element (ScopedBy). Where the member's username is known to Egeria as a user identity with a profile, the profile is appointed to the role; otherwise the username and name are recorded on the role's additional properties and reported as a warning.- Parameters:
team- team from the document (may be null)elementGUID- element that the roles are scoped toelementQualifiedName- qualified name of the element (used to build the roles' names)result- result to record warnings in- Throws:
InvalidParameterException- invalid parameterPropertyServerException- problem with the metadata storeUserNotAuthorizedException- security problem
-
parseDate
Parse an ISO date (yyyy-MM-dd) from the document.- Parameters:
value- date string (may be null)- Returns:
- date or null if missing or malformed
-