Direct Known Subclasses:
EntitySummaryMapping, RelationshipMapping

public class InstanceHeaderMapping extends InstanceAuditHeaderMapping
Maps the properties of InstanceHeaders between persistence and objects. (Note that this is the first level of mapping that can be instantiated, as it is the first level in which a XTDB ID (GUID) is mapped.)
  • Field Details

    • RE_IDENTIFIED_FROM_GUID

      public static final String RE_IDENTIFIED_FROM_GUID
    • instanceHeader

      protected InstanceHeader instanceHeader
    • xtdbDoc

      protected xtdb.api.XtdbDocument xtdbDoc
  • Constructor Details

    • InstanceHeaderMapping

      protected InstanceHeaderMapping(XTDBOMRSRepositoryConnector xtdbConnector, InstanceHeader instanceHeader)
      Construct a mapping from an InstanceAuditHeader (to map to a XTDB representation).
      Parameters:
      xtdbConnector - connectivity to XTDB
      instanceHeader - from which to map
    • InstanceHeaderMapping

      protected InstanceHeaderMapping(XTDBOMRSRepositoryConnector xtdbConnector, xtdb.api.XtdbDocument xtdbDoc)
      Construct a mapping from a XTDB map (to map to an Egeria representation).
      Parameters:
      xtdbConnector - connectivity to XTDB
      xtdbDoc - from which to map
  • Method Details

    • toXTDB

      public xtdb.api.XtdbDocument toXTDB()
      Map from Egeria to XTDB.
      Returns:
      XtdbDocument
      See Also:
    • toDoc

      protected xtdb.api.XtdbDocument.Builder toDoc()
      Translate the provided Egeria representation into a XTDB document.
      Returns:
      XtdbDocument.Builder from which to build the document
    • toMap

      public static clojure.lang.IPersistentMap toMap(InstanceHeader header) throws InvalidParameterException, IOException
      Translate the provided Egeria representation into a XTDB document map.
      Parameters:
      header - to translate
      Returns:
      IPersistentMap representing the XTDB document
      Throws:
      InvalidParameterException - on any errors identified within the metadata instance
      IOException - on any error serializing the values
    • fromDoc

      protected void fromDoc()
      Translate the provided XTDB representation into an Egeria representation.
    • fromMap

      protected static void fromMap(InstanceHeader ih, clojure.lang.IPersistentMap doc) throws IOException, InvalidParameterException
      Translate the provided XTDB representation into an Egeria representation.
      Parameters:
      ih - into which to map
      doc - from which to map
      Throws:
      IOException - on any issue deserializing values
      InvalidParameterException - for any unmapped properties
    • getGuidReference

      public static String getGuidReference(XTDBOMRSRepositoryConnector xtdbConnector, InstanceHeader ih)
      Translate the provided InstanceHeader information into a XTDB reference to the GUID of the instance.
      Parameters:
      xtdbConnector - connectivity to the repository
      ih - to translate
      Returns:
      String for the XTDB reference
    • getGuidReference

      public static String getGuidReference(InstanceHeader ih) throws InvalidParameterException
      Translate the provided InstanceHeader information into a XTDB reference to the GUID of the instance.
      Parameters:
      ih - to translate
      Returns:
      String for the XTDB reference
      Throws:
      InvalidParameterException - on any error translating the GUID
    • trimGuidFromReference

      public static String trimGuidFromReference(String reference)
      Retrieve only the GUID portion of a XTDB reference.
      Parameters:
      reference - from which to trim the GUID
      Returns:
      String of only the GUID portion of the reference
    • getReference

      protected static String getReference(String instanceType, String guid)
      Translate the provided details into a XTDB reference.
      Parameters:
      instanceType - of the instance (from TypeDefCategory name)
      guid - of the instance
      Returns:
      String for the XTDB reference