Class OMRSEvent

  • Direct Known Subclasses:
    OMRSInstanceEvent, OMRSRegistryEvent, OMRSTypeDefEvent

    public abstract class OMRSEvent
    extends Object
    OMRSEvent defines the common content of a message that is sent through the OMRSTopicConnector to all metadata repositories registered in the open metadata repository cohort. It supports a category enum for the three main categories of event and provides specialized structures for processing each category of event.
    • Constructor Detail

      • OMRSEvent

        public OMRSEvent​(OMRSEventV1 inboundEvent)
        Inbound event constructor that takes the object created by the Jackson JSON mapper and unpacks the properties into the internal OMRSEvent object.
        Parameters:
        inboundEvent - incoming Event.
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory)
        Outbound event constructor used when there is no error.
        Parameters:
        eventCategory - category of event.
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String targetMetadataCollectionId,
                         Connection targetRemoteConnection)
        Outbound event constructor used for registry error events.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error
        errorMessage - detailed error message for remote audit log
        targetMetadataCollectionId - identifier of the metadata collection in error.
        targetRemoteConnection - connection used to create the connector to access metadata in the remote repository.
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String targetMetadataCollectionId,
                         TypeDefSummary targetTypeDefSummary,
                         TypeDefSummary otherTypeDefSummary)
        Outbound constructor used for TypeDef conflict events.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error
        errorMessage - detailed error message for remote audit log
        targetMetadataCollectionId - identifier of the metadata collection required to change TypeDef.
        targetTypeDefSummary - details of TypeDef to change.
        otherTypeDefSummary - description of conflicting TypeDef that will not change.
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String otherMetadataCollectionId,
                         TypeDefSummary otherTypeDefSummary)
        Outbound constructor used for TypeDef conflict events.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error
        errorMessage - detailed error message for remote audit log
        otherMetadataCollectionId - identifier of the metadata collection that sent the type.
        otherTypeDefSummary - description of conflicting TypeDef.
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String targetMetadataCollectionId,
                         AttributeTypeDef targetAttributeTypeDef,
                         AttributeTypeDef otherAttributeTypeDef)
        Outbound constructor used for AttributeTypeDef conflict events.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error
        errorMessage - detailed error message for remote audit log
        targetMetadataCollectionId - identifier of the metadata collection required to change TypeDef.
        targetAttributeTypeDef - details of AttributeTypeDef to change.
        otherAttributeTypeDef - description of conflicting AttributeTypeDef that will not change.
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String otherMetadataCollectionId,
                         AttributeTypeDef otherAttributeTypeDef)
        Outbound constructor used for AttributeTypeDef conflict events.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error
        errorMessage - detailed error message for remote audit log
        otherMetadataCollectionId - identifier of the remote metadata collection.
        otherAttributeTypeDef - description of conflicting AttributeTypeDef.
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String targetMetadataCollectionId,
                         TypeDefSummary targetTypeDefSummary,
                         TypeDef otherTypeDef)
        Outbound event constructor for a TypeDef patch mismatch warning.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error.
        errorMessage - detailed error message for remote audit log
        targetMetadataCollectionId - identifier of the remote metadata collection with mismatched TypeDef.
        targetTypeDefSummary - description of TypeDef.
        otherTypeDef - details of local TypeDef
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String targetMetadataCollectionId,
                         TypeDefSummary targetTypeDefSummary,
                         String targetInstanceGUID,
                         String otherMetadataCollectionId,
                         InstanceProvenanceType otherOrigin,
                         TypeDefSummary otherTypeDefSummary,
                         String otherInstanceGUID)
        Outbound constructor used for metadata instance conflict events.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error
        errorMessage - detailed error message for remote audit log
        targetMetadataCollectionId - metadata collection id of other repository with the conflicting instance
        targetTypeDefSummary - description of the target instance's TypeDef
        targetInstanceGUID - unique identifier for the source instance
        otherOrigin - origin of the other (older) metadata instance
        otherMetadataCollectionId - metadata collection of the other (older) metadata instance
        otherTypeDefSummary - details of the other (older) instance's TypeDef
        otherInstanceGUID - unique identifier for the other (older) instance
      • OMRSEvent

        public OMRSEvent​(OMRSEventCategory eventCategory,
                         OMRSEventErrorCode genericErrorCode,
                         String errorMessage,
                         String targetMetadataCollectionId,
                         TypeDefSummary targetTypeDefSummary,
                         String targetInstanceGUID,
                         TypeDefSummary otherTypeDefSummary)
        Outbound constructor used for metadata instance type conflict events.
        Parameters:
        eventCategory - category of event.
        genericErrorCode - code for the error
        errorMessage - detailed error message for remote audit log
        targetMetadataCollectionId - metadata collection id of other repository with the conflicting instance
        targetTypeDefSummary - details of the target instance's TypeDef
        targetInstanceGUID - unique identifier for the source instance
        otherTypeDefSummary - details of the local TypeDef
    • Method Detail

      • setEventOriginator

        public void setEventOriginator​(OMRSEventOriginator eventOriginator)
        Set up details of the event originator used by the event publisher for outbound events.
        Parameters:
        eventOriginator - details of the originator of the event including the id of the local metadata collection.
      • getEventDirection

        public OMRSEventDirection getEventDirection()
        Return whether this is an inbound or outbound event. This is used for messages.
        Returns:
        OMRSEventDirection enum
      • getEventTimestamp

        public Date getEventTimestamp()
        Return the timestamp for the event.
        Returns:
        Date object
      • getEventCategory

        public OMRSEventCategory getEventCategory()
        Return the category of the event. If the event category is null then the event was unreadable in some form (or there is a logic error).
        Returns:
        event category enum
      • getEventOriginator

        public OMRSEventOriginator getEventOriginator()
        Return details of the originator of the event including the id of their metadata collection. If the originator is null then the event was unreadable in some form (or there is a logic error).
        Returns:
        event originator object
      • getGenericErrorCode

        protected OMRSEventErrorCode getGenericErrorCode()
        Return the error code for the event. This is set to null if there is no error.
        Returns:
        error code enum or null
      • getErrorMessage

        public String getErrorMessage()
        Return any error message for the event. This is null if there is no error. If there is an error, this error message is suitable for the local OMRS audit log.
        Returns:
        String errorMessage
      • getTargetMetadataCollectionId

        public String getTargetMetadataCollectionId()
        This is the identifier of the metadata collection that needs to take action. It is null if there is no error condition.
        Returns:
        String metadata collection id
      • getTargetRemoteConnection

        public Connection getTargetRemoteConnection()
        This is the target's connection that is causing errors in the originator's server.
        Returns:
        OCF connection
      • getTargetTypeDefSummary

        public TypeDefSummary getTargetTypeDefSummary()
        Return the target's TypeDef summary.
        Returns:
        TypeDefSummary containing identifiers, category and version
      • getTargetAttributeTypeDef

        public AttributeTypeDef getTargetAttributeTypeDef()
        Return the target AttributeTypeDef.
        Returns:
        AttributeTypeDef object
      • getTargetInstanceGUID

        public String getTargetInstanceGUID()
        Return the target's instance's unique identifier.
        Returns:
        String guid
      • getOtherOrigin

        public InstanceProvenanceType getOtherOrigin()
        Return the provenance (origin) information for the other instance.
        Returns:
        InstanceProvenanceType enum
      • getOtherMetadataCollectionId

        public String getOtherMetadataCollectionId()
        Return the unique identifier for the metadata collection containing the other instance.
        Returns:
        String guid
      • getOtherTypeDefSummary

        public TypeDefSummary getOtherTypeDefSummary()
        Return the version of the TypeDef from the other repository.
        Returns:
        TypeDefSummary containing identifiers, category and version
      • getOtherTypeDef

        public TypeDef getOtherTypeDef()
        Return the TypeDef from the other repository.
        Returns:
        TypeDef object
      • getOtherAttributeTypeDef

        public AttributeTypeDef getOtherAttributeTypeDef()
        Return the AttributeTypeDef from the other repository.
        Returns:
        AttributeTypeDef object
      • getOtherInstanceGUID

        public String getOtherInstanceGUID()
        Return the unique identifier for the other instance.
        Returns:
        String guid
      • getOMRSEventV1

        public OMRSEventV1 getOMRSEventV1()
        Returns an OMRSEvent populated with details about a generic event. Specific subtypes override this method to create messages with specific subsections.
        Returns:
        OMRSEvent (Version 1) object
      • toString

        public String toString()
        Standard toString method.
        Overrides:
        toString in class Object
        Returns:
        JSON style description of variables.