Class Event

java.lang.Object
com.persequor.event.Event
All Implemented Interfaces:
Model

public class Event extends Object implements Model
  • Constructor Details

    • Event

      public Event()
  • Method Details

    • getEpcisEventId

      public Optional<String> getEpcisEventId()
      If not empty, this unique ID is used to identify the event not only in the Saga system, but globally. See GS1 CBV for more information.
    • setEpcisEventId

      public void setEpcisEventId(String epcisEventId)
      If set, it must be globally unique as it is used to identify the event not only in the Saga system, but globally. According to the GS1 Core Business Vocabulary it should follow one of these formats:
      • Be a UUID take the form: urn:uuid:2902c942-c26d-43fa-8ba3-d7ac1e58211f
      • Be a hash and look like this: ni:///sha-256;e838b765d316a7b6c3cf2c5ba19735a34ab36a34c741788e1bc896ae6b2c02f2?ver=CBV2.0
      See GS1 CBV for more information.
    • getEpcs

      public EpcList getEpcs()
    • setEpcs

      public void setEpcs(Collection<String> epcs)
    • setEpcs

      public void setEpcs(String... epcs)
    • addEpcs

      public void addEpcs(String... epcs)
    • addEpcs

      public void addEpcs(Collection<String> epcs)
    • getEventTime

      public ZonedDateTime getEventTime()
    • setEventTime

      public void setEventTime(ZonedDateTime eventTime)
    • getRecordTime

      public ZonedDateTime getRecordTime()
    • setRecordTime

      public void setRecordTime(ZonedDateTime recordTime)
    • getEventTimeZoneOffset

      public String getEventTimeZoneOffset()
    • setEventTimeZoneOffset

      public void setEventTimeZoneOffset(String eventTimeZoneOffset)
    • getErrorDeclaration

      public Optional<ErrorDeclaration> getErrorDeclaration()
    • ensureErrorDeclaration

      public ErrorDeclaration ensureErrorDeclaration()
      This method is useful for making revert events. You can obtain the error declaration. If the error declaration is not yet initialized then a new instance is created. That mean this method never returns null.
      Returns:
      always error declaration instance
    • ensureErrorDeclaration

      public <E extends Exception> ErrorDeclaration ensureErrorDeclaration(ThrowingConsumer<ErrorDeclaration,E> consumer) throws E
      This method is useful for making revert events. You can obtain the error declaration. If the error declaration is not yet initialized then a new instance is created. That mean this method never returns null.
      Type Parameters:
      E - exception type
      Parameters:
      consumer - function that accepts the error. It can access values of the resulting ErrorDeclaration
      Returns:
      error stored in this event
      Throws:
      E - exception thrown out of the provided consumer
    • getAction

      public Action getAction()
    • setAction

      public void setAction(Action action)
    • getBizStep

      public BizStep getBizStep()
    • getDisposition

      public Disposition getDisposition()
    • getReadPoint

      public ReadPoint getReadPoint()
    • getBizLocation

      public BizLocation getBizLocation()
    • getBizTransactions

      public BizTransactionList getBizTransactions()
    • getCustomTags

      public CustomTagList getCustomTags()
    • addCustomTag

      public <T extends Exception> void addCustomTag(String xpath, ThrowingConsumer<CustomTag,T> consumer) throws T
      Throws:
      T extends Exception
    • addCustomTag

      public void addCustomTag(String xpath, String value)
    • getCustomTagValue

      public Optional<String> getCustomTagValue(String xpath, Boolean isFullyQualifiedName)
    • getCustomTagValue

      public Optional<String> getCustomTagValue(String xpath)
    • getRequiredCustomTagValue

      public String getRequiredCustomTagValue(String xpath)
    • getRequiredCustomTag

      public CustomTag getRequiredCustomTag(String xpath)
    • getCustomTags

      public CustomTagList getCustomTags(String xpath)
    • getRequiredCustomTag

      public CustomTag getRequiredCustomTag(Namespace namespace, String name)
      Find custom tag with matching namespace and name, IllegalArgumentException is thrown if there's no matching custom tag
      Parameters:
      namespace - to look for
      name - to look for
      Returns:
      custom tag with specified namespace and name
    • getSagaEventId

      public UUID getSagaEventId()
    • setSagaEventId

      public void setSagaEventId(UUID sagaEventId)
    • getSources

      public SourceList getSources()
    • getDestinations

      public DestinationList getDestinations()
    • getQuantities

      public QuantityList getQuantities()
    • addQuantity

      public <E extends Exception> void addQuantity(ThrowingConsumer<QuantityElement,E> consumer) throws E
      Add quantity to this list. The quantity is obtained from the provided consumer that may throw an exception
      Type Parameters:
      E - type of exception thrown by the provided consumer
      Parameters:
      consumer - quanatity provider
      Throws:
      E - exception thrown by the consumer
    • getParentId

      public Optional<String> getParentId()
      Depending on the EventType this can be the parentEPC, transactionId or transformationId
      Returns:
      parentEPC, transactionId or transformationId.
    • setParentId

      public void setParentId(String parentId)
    • is

      public boolean is(EventType eventType)
    • getEventType

      public EventType getEventType()
    • setEventType

      public void setEventType(EventType eventType)
    • getInstanceLotMasterData

      public InstanceLotMasterData getInstanceLotMasterData()
    • getPartition

      public long getPartition()
    • setPartition

      public void setPartition(long partition)
    • copy

      public Event copy()
      Create a deep clone of the Event object. Useful for returning an event that does not propagate changes to the original Event object, but still holds all information.
      Returns:
      clone of Event object
    • copyWithoutIds

      public Event copyWithoutIds()
      Create a deep clone of the Event object without ids that should be unique and/or be maintained by SAGA. Useful for creating a series of similar events from a base Event object
      Returns:
      clone of Event object with unique ids empty
    • ensureCustomTag

      public CustomTag ensureCustomTag(String xpath)
    • getInputEpcs

      public EpcList getInputEpcs()
    • addInputEpcs

      public void addInputEpcs(Collection<String> epcs)
    • addInputEpcs

      public void addInputEpcs(String... epcs)
    • getInputQuantities

      public QuantityList getInputQuantities()
    • addInputQuantity

      public <E extends Exception> void addInputQuantity(ThrowingConsumer<QuantityElement,E> consumer) throws E
      Add quantity to the output quantity list. The quantity is obtained from the provided consumer that may throw an exception
      Type Parameters:
      E - type of exception thrown by the provided consumer
      Parameters:
      consumer - quantity provider
      Throws:
      E - exception thrown by the consumer
    • setDocumentId

      public void setDocumentId(String documentId)
    • getDocumentId

      public String getDocumentId()
    • getEpcsIncludingParent

      public EpcList getEpcsIncludingParent()
    • setBizStep

      public void setBizStep(BizStep bizStep)
    • setBizStep

      public void setBizStep(String bizStep)
    • setBizStep

      public void setBizStep(ElementUri bizStep)
    • setDisposition

      public void setDisposition(Disposition disposition)
    • setDisposition

      public void setDisposition(String disposition)
    • setDisposition

      public void setDisposition(ElementUri disposition)
    • setBizLocation

      public void setBizLocation(BizLocation bizLocation)
    • setBizLocation

      public void setBizLocation(String bizLocation)
    • setBizLocation

      public void setBizLocation(ElementUri bizLocation)
    • setReadPoint

      public void setReadPoint(ReadPoint readPoint)
    • setReadPoint

      public void setReadPoint(String readPoint)
    • setReadPoint

      public void setReadPoint(ElementUri readPoint)