public class EnumPropertyValueMapping extends InstancePropertyValueMapping
Maps singular EnumPropertyValues between persistence and objects. These cannot simply be serialized to JSON as that would impact the ability to search their values correctly, so we will serde and search based strictly on their ordinal values: { ... :instanceProvenanceType 1 :currentStatus 15 ... }
  • Constructor Details

    • EnumPropertyValueMapping

      public EnumPropertyValueMapping()
  • Method Details

    • addEnumPropertyValueToDoc

      public static void addEnumPropertyValueToDoc(xtdb.api.XtdbDocument.Builder builder, PropertyKeywords keywords, EnumPropertyValue value)
      Add the provided enum value to the XTDB document.
      Parameters:
      builder - to which to add the property value
      keywords - of the property
      value - of the property
    • addEnumPropertyValueToDoc

      public static clojure.lang.IPersistentMap addEnumPropertyValueToDoc(clojure.lang.IPersistentMap doc, clojure.lang.Keyword propertyKeyword, EnumPropertyValue value)
      Add the provided enum value to the XTDB map.
      Parameters:
      doc - the XTDB map to which to add the property
      propertyKeyword - the property whose value should be set, fully-qualified with namespace and type name
      value - of the property
      Returns:
      IPersistentMap of the updated XTDB doc
    • getEnumPropertyValueForComparison

      public static Integer getEnumPropertyValueForComparison(EnumPropertyValue epv)
      Convert the provided enumeration property value into a XTDB comparable form.
      Parameters:
      epv - Egeria value to translate to XTDB-comparable value
      Returns:
      Integer value that XTDB can compare
    • getInstanceProvenanceTypeFromOrdinal

      public static InstanceProvenanceType getInstanceProvenanceTypeFromOrdinal(XTDBOMRSRepositoryConnector xtdbConnector, Integer ordinal)
      Convert the provided ordinal into its InstanceProvenanceType.
      Parameters:
      xtdbConnector - connectivity to the repository
      ordinal - to convert
      Returns:
      InstanceProvenanceType
    • getInstanceProvenanceTypeFromOrdinal

      public static InstanceProvenanceType getInstanceProvenanceTypeFromOrdinal(Integer ordinal) throws InvalidParameterException
      Convert the provided ordinal into its InstanceProvenanceType.
      Parameters:
      ordinal - to convert
      Returns:
      InstanceProvenanceType
      Throws:
      InvalidParameterException - if there is no such enumeration
    • getOrdinalForInstanceProvenanceType

      public static Integer getOrdinalForInstanceProvenanceType(InstanceProvenanceType ipt)
      Convert the provided InstanceProvenanceType into its symbolic name.
      Parameters:
      ipt - to convert
      Returns:
      Integer
    • getInstanceStatusFromOrdinal

      public static InstanceStatus getInstanceStatusFromOrdinal(XTDBOMRSRepositoryConnector xtdbConnector, Integer ordinal)
      Convert the provided ordinal into its InstanceStatus.
      Parameters:
      xtdbConnector - connectivity to the repository
      ordinal - to convert
      Returns:
      InstanceStatus
    • getInstanceStatusFromOrdinal

      public static InstanceStatus getInstanceStatusFromOrdinal(Integer ordinal) throws InvalidParameterException
      Convert the provided ordinal into its InstanceStatus.
      Parameters:
      ordinal - to convert
      Returns:
      InstanceStatus
      Throws:
      InvalidParameterException - if there is no such enumeration
    • getOrdinalForInstanceStatus

      public static Integer getOrdinalForInstanceStatus(InstanceStatus is)
      Convert the provided InstanceStatus into its ordinal.
      Parameters:
      is - to convert
      Returns:
      Integer