java.lang.Object
org.odpi.openmetadata.frameworks.integration.bitol.mapping.BitolGeneratorBase
Direct Known Subclasses:
DataContractGenerator, DataProductGenerator

public abstract class BitolGeneratorBase extends Object
BitolGeneratorBase holds the logic shared by the generators that build Open Data Contract Standard (ODCS) and Open Data Product Standard (ODPS) documents from open metadata: the reverse of BitolMapperBase. It reads the fundamentals, tags, custom properties, authoritative definitions, support channels and team from an element and its related elements. Values that the cataloguers kept in additional properties under the "bitol." prefix are read back so that a document catalogued by Egeria regenerates faithfully; elements created directly in Egeria produce a document from their native properties.
  • Field Details

  • Constructor Details

    • BitolGeneratorBase

      protected BitolGeneratorBase(ConnectorContextBase context)
      Constructor.
      Parameters:
      context - connector context providing access to the open metadata clients
  • Method Details

    • fillFundamentals

      protected void fillFundamentals(OpenMetadataRootElement element, BitolDocument document)
      Fill the fundamentals of a document from the properties of the element that represents it. The identifier is the element's identifier property, or its GUID when there is none, so that a round trip preserves the original document identifier while an element created in Egeria still gets a stable id.
      Parameters:
      element - element representing the document
      document - document to fill
    • getBitolValue

      protected static String getBitolValue(Map<String,String> additionalProperties, String name)
      Return a value stored by the cataloguers under the bitol prefix.
      Parameters:
      additionalProperties - additional properties of the element (may be null)
      name - name without the prefix
      Returns:
      value or null
    • getCustomProperties

      protected static List<BitolCustomProperty> getCustomProperties(Map<String,String> additionalProperties)
      Return the additional properties that are not bitol bookkeeping as custom properties.
      Parameters:
      additionalProperties - additional properties of the element (may be null)
      Returns:
      list of custom properties or null if there are none
    • getTags

      protected List<String> getTags(AttributedMetadataElement element)
      Return the search keywords of an element as tags.
      Parameters:
      element - element with its related elements
      Returns:
      list of tags or null
    • getAuthoritativeDefinitions

      protected List<BitolAuthoritativeDefinition> getAuthoritativeDefinitions(AttributedMetadataElement element)
      Return the external references of an element as authoritative definitions.
      Parameters:
      element - element with its related elements
      Returns:
      list of definitions or null
    • getSupportChannels

      protected List<BitolSupportChannel> getSupportChannels(AttributedMetadataElement element)
      Return the contact details of an element as support channels.
      Parameters:
      element - element with its related elements
      Returns:
      list of channels or null
    • getTenant

      protected String getTenant(AttributedMetadataElement element)
      Return the organization that the element is scoped by as the tenant.
      Parameters:
      element - element with its related elements
      Returns:
      organization name or null
    • getTeam

      protected BitolTeam getTeam(AttributedMetadataElement element)
      Return the team and person roles scoped to the element as a Bitol team.
      Parameters:
      element - element with its related elements
      Returns:
      team or null if there is neither a team nor any roles
    • getDisplayName

      protected String getDisplayName(MetadataElementSummary summary)
      Return the display name of a summarized element.
      Parameters:
      summary - element summary
      Returns:
      display name, or qualified name, or null
    • getGUID

      protected static String getGUID(OpenMetadataRootElement element)
      Return the unique identifier of an element for use in an error message.
      Parameters:
      element - element (may be null)
      Returns:
      guid or "null"
    • getTypeName

      protected static String getTypeName(OpenMetadataRootElement element)
      Return the type name of an element for use in an error message.
      Parameters:
      element - element (may be null)
      Returns:
      type name or "null"
    • fromJSON

      protected static <T> T fromJSON(String json, Class<T> type)
      Parse a JSON fragment kept in an additional property by the cataloguer.
      Type Parameters:
      T - bean type
      Parameters:
      json - json text (may be null)
      type - bean type
      Returns:
      bean or null if absent or unreadable
    • fromJSONList

      protected static <T> List<T> fromJSONList(String json, Class<T> type)
      Parse a JSON fragment holding a list, kept in an additional property by the cataloguer.
      Type Parameters:
      T - element type
      Parameters:
      json - json text (may be null)
      type - element type
      Returns:
      list or null if absent or unreadable
    • getSynonyms

      protected static List<BitolSynonym> getSynonyms(Map<String,String> additionalProperties)
      Return the synonyms kept as JSON on an element.
      Parameters:
      additionalProperties - additional properties of the element
      Returns:
      synonyms or null
    • getContext

      protected static BitolContext getContext(Map<String,String> additionalProperties)
      Return the AI context kept as JSON on an element.
      Parameters:
      additionalProperties - additional properties of the element
      Returns:
      context or null
    • getDeprecated

      protected static Boolean getDeprecated(Map<String,String> additionalProperties)
      Return whether an element was recorded as deprecated.
      Parameters:
      additionalProperties - additional properties of the element
      Returns:
      true if deprecated, otherwise null so the flag is omitted from the document