Class XExtendedEvent

  • All Implemented Interfaces:
    java.lang.Cloneable, XAttributable, XElement, XEvent

    public class XExtendedEvent
    extends java.lang.Object
    implements XEvent
    Helper class. This class can be used to dynamically wrap any event, and provides an extended set of getter and setter methods for typically-available extension attributes.
    Author:
    Christian W. Guenther (christian@deckfour.org)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected XEvent original
      The original, wrapped event.
    • Constructor Summary

      Constructors 
      Constructor Description
      XExtendedEvent​(XEvent original)
      Constructs a new wrapper object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(XVisitor visitor, XTrace trace)  
      java.lang.Object clone()
      Clones this event, i.e.
      boolean equals​(java.lang.Object o)
      Tests for equality of type and ID
      XAttributeMap getAttributes()
      Retrieves the attributes set for this element.
      java.util.Set<XExtension> getExtensions()
      Retrieves the extensions used by this element, i.e.
      java.lang.String getGroup()
      Returns the group of the event, as defined by the Organizational extension.
      XID getID()
      Returns the id of the event
      java.lang.String getInstance()
      Retrieves the activity instance of this event, as defined by the Concept extension.
      java.util.List<java.lang.String> getModelReferences()
      Returns the list of model references defined for this event, as defined in the Semantic extension.
      java.util.List<java.net.URI> getModelReferenceURIs()
      Returns the list of model reference URIs defined for this event, as defined in the Semantic extension.
      java.lang.String getName()
      Retrieves the activity name of this event, as defined by the Concept extension.
      java.lang.String getResource()
      Returns the resource of the event, as defined by the Organizational extension.
      java.lang.String getRole()
      Returns the role of the event, as defined by the Organizational extension.
      XLifecycleExtension.StandardModel getStandardTransition()
      Returns the standard lifecycle transition of the event, as defined by the Lifecycle extension.
      java.util.Date getTimestamp()
      Retrieves the timestamp of the event, as defined by the Time extension.
      java.lang.String getTransition()
      Returns the lifecycle transition of the event, as defined by the Lifecycle extension.
      boolean hasAttributes()
      Checks for the existence of attributes.
      int hashCode()
      Returns the hashCode of the ID
      void setAttributes​(XAttributeMap attributes)
      Sets the map of attributes for this element.
      void setGroup​(java.lang.String group)
      Sets the group of the event, as defined by the Organizational extension.
      void setInstance​(java.lang.String instance)
      Sets the activity instance of this event, as defined by the Concept extension.
      void setModelReferences​(java.util.List<java.lang.String> modelReferences)
      Sets the list of model reference strings defined for this event, as defined in the Semantic extension.
      void setModelReferenceURIs​(java.util.List<java.net.URI> modelReferenceURIs)
      Sets the list of model reference URIs defined for this event, as defined in the Semantic extension.
      void setName​(java.lang.String name)
      Sets the activity name of this event, as defined by the Concept extension.
      void setResource​(java.lang.String resource)
      Sets the resource of the event, as defined by the Organizational extension.
      void setRole​(java.lang.String role)
      Sets the role of the event, as defined by the Organizational extension.
      void setStandardTransition​(XLifecycleExtension.StandardModel transition)
      Sets the standard lifecycle transition of the event, as defined by the Lifecycle extension.
      void setTimestamp​(long timestamp)
      Sets the timestamp of the event, as defined by the Time extension.
      void setTimestamp​(java.util.Date timestamp)
      Sets the timestamp of the event, as defined by the Time extension.
      void setTransition​(java.lang.String transition)
      Sets the lifecycle transition of the event, as defined by the Lifecycle extension.
      static XExtendedEvent wrap​(XEvent event)
      Static wrapper method.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • original

        protected XEvent original
        The original, wrapped event.
    • Constructor Detail

      • XExtendedEvent

        public XExtendedEvent​(XEvent original)
        Constructs a new wrapper object.
        Parameters:
        original - The original event to be wrapped.
    • Method Detail

      • wrap

        public static XExtendedEvent wrap​(XEvent event)
        Static wrapper method. Wraps the given event into an instance of this class, which transparently provides extended access to attributes.
        Parameters:
        event - The original event to be wrapped.
        Returns:
        A wrapped event.
      • getName

        public java.lang.String getName()
        Retrieves the activity name of this event, as defined by the Concept extension.
        Returns:
        Activity name of the event.
      • setName

        public void setName​(java.lang.String name)
        Sets the activity name of this event, as defined by the Concept extension.
        Parameters:
        name - Activity name of the event.
      • getInstance

        public java.lang.String getInstance()
        Retrieves the activity instance of this event, as defined by the Concept extension.
        Returns:
        Activity instance of the event.
      • setInstance

        public void setInstance​(java.lang.String instance)
        Sets the activity instance of this event, as defined by the Concept extension.
        Parameters:
        instance - Activity instance of the event.
      • getTimestamp

        public java.util.Date getTimestamp()
        Retrieves the timestamp of the event, as defined by the Time extension.
        Returns:
        Timestamp as Date object, or null if not defined.
      • setTimestamp

        public void setTimestamp​(java.util.Date timestamp)
        Sets the timestamp of the event, as defined by the Time extension.
        Parameters:
        timestamp - Timestamp, as Date, to be set.
      • setTimestamp

        public void setTimestamp​(long timestamp)
        Sets the timestamp of the event, as defined by the Time extension.
        Parameters:
        timestamp - Timestamp, as long value in milliseconds, to be set.
      • getResource

        public java.lang.String getResource()
        Returns the resource of the event, as defined by the Organizational extension.
        Returns:
        Resource string. Can be null, if not defined.
      • setResource

        public void setResource​(java.lang.String resource)
        Sets the resource of the event, as defined by the Organizational extension.
        Parameters:
        resource - Resource string.
      • getRole

        public java.lang.String getRole()
        Returns the role of the event, as defined by the Organizational extension.
        Returns:
        Role string. Can be null, if not defined.
      • setRole

        public void setRole​(java.lang.String role)
        Sets the role of the event, as defined by the Organizational extension.
        Parameters:
        role - Role string.
      • getGroup

        public java.lang.String getGroup()
        Returns the group of the event, as defined by the Organizational extension.
        Returns:
        Group string. Can be null, if not defined.
      • setGroup

        public void setGroup​(java.lang.String group)
        Sets the group of the event, as defined by the Organizational extension.
        Parameters:
        group - Group string.
      • getTransition

        public java.lang.String getTransition()
        Returns the lifecycle transition of the event, as defined by the Lifecycle extension.
        Returns:
        Lifecycle transition string. Can be null, if not defined.
      • setTransition

        public void setTransition​(java.lang.String transition)
        Sets the lifecycle transition of the event, as defined by the Lifecycle extension.
        Parameters:
        transition - Lifecycle transition string.
      • getStandardTransition

        public XLifecycleExtension.StandardModel getStandardTransition()
        Returns the standard lifecycle transition of the event, as defined by the Lifecycle extension.
        Returns:
        Standard lifecycle transition object. Can be null, if not defined.
      • setStandardTransition

        public void setStandardTransition​(XLifecycleExtension.StandardModel transition)
        Sets the standard lifecycle transition of the event, as defined by the Lifecycle extension.
        Parameters:
        transition - Standard lifecycle transition object.
      • getModelReferences

        public java.util.List<java.lang.String> getModelReferences()
        Returns the list of model references defined for this event, as defined in the Semantic extension.
        Returns:
        List of model reference strings.
      • setModelReferences

        public void setModelReferences​(java.util.List<java.lang.String> modelReferences)
        Sets the list of model reference strings defined for this event, as defined in the Semantic extension.
        Parameters:
        modelReferences - List of model reference strings.
      • getModelReferenceURIs

        public java.util.List<java.net.URI> getModelReferenceURIs()
        Returns the list of model reference URIs defined for this event, as defined in the Semantic extension.
        Returns:
        List of model reference URIs.
      • setModelReferenceURIs

        public void setModelReferenceURIs​(java.util.List<java.net.URI> modelReferenceURIs)
        Sets the list of model reference URIs defined for this event, as defined in the Semantic extension.
        Parameters:
        modelReferenceURIs - List of model reference URIs.
      • getExtensions

        public java.util.Set<XExtension> getExtensions()
        Description copied from interface: XAttributable
        Retrieves the extensions used by this element, i.e. the extensions used by all attributes of this element, and the element itself.
        Specified by:
        getExtensions in interface XAttributable
        Returns:
        A set of extensions.
      • setAttributes

        public void setAttributes​(XAttributeMap attributes)
        Description copied from interface: XAttributable
        Sets the map of attributes for this element.
        Specified by:
        setAttributes in interface XAttributable
        Parameters:
        attributes - A map of attributes.
      • hasAttributes

        public boolean hasAttributes()
        Description copied from interface: XAttributable
        Checks for the existence of attributes. This method can be a more efficient way of checking for the existance of attributes than using XAttributable.getAttributes() in certain situations.
        Specified by:
        hasAttributes in interface XAttributable
        Returns:
        whether this element has any attributes
      • clone

        public java.lang.Object clone()
        Clones this event, i.e. creates a deep copy, but with a new ID, so equals does not hold between this and the clone
        Specified by:
        clone in interface XElement
        Overrides:
        clone in class java.lang.Object
        Returns:
        An identical clone.
      • equals

        public boolean equals​(java.lang.Object o)
        Tests for equality of type and ID
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns the hashCode of the ID
        Overrides:
        hashCode in class java.lang.Object
      • getID

        public XID getID()
        Description copied from interface: XEvent
        Returns the id of the event
        Specified by:
        getID in interface XEvent
        Returns:
        the ID of this event