Package com.persequor.event
Class Event
java.lang.Object
com.persequor.event.Event
- All Implemented Interfaces:
Model
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Exception>
voidaddCustomTag
(String xpath, ThrowingConsumer<CustomTag, T> consumer) void
addCustomTag
(String xpath, String value) void
void
addEpcs
(Collection<String> epcs) void
addInputEpcs
(String... epcs) void
addInputEpcs
(Collection<String> epcs) <E extends Exception>
voidaddInputQuantity
(ThrowingConsumer<QuantityElement, E> consumer) Add quantity to the output quantity list.<E extends Exception>
voidaddQuantity
(ThrowingConsumer<QuantityElement, E> consumer) Add quantity to this list.copy()
Create a deep clone of the Event object.Create a deep clone of the Event object without ids that should be unique and/or be maintained by SAGA.ensureCustomTag
(String xpath) This method is useful for making revert events.<E extends Exception>
ErrorDeclarationensureErrorDeclaration
(ThrowingConsumer<ErrorDeclaration, E> consumer) This method is useful for making revert events.getCustomTags
(String xpath) getCustomTagValue
(String xpath) getCustomTagValue
(String xpath, Boolean isFullyQualifiedName) If not empty, this unique ID is used to identify the event not only in the Saga system, but globally.getEpcs()
Depending on the EventType this can be the parentEPC, transactionId or transformationIdlong
getRequiredCustomTag
(Namespace namespace, String name) Find custom tag with matching namespace and name,IllegalArgumentException
is thrown if there's no matching custom taggetRequiredCustomTag
(String xpath) getRequiredCustomTagValue
(String xpath) boolean
void
void
setBizLocation
(BizLocation bizLocation) void
setBizLocation
(ElementUri bizLocation) void
setBizLocation
(String bizLocation) void
setBizStep
(BizStep bizStep) void
setBizStep
(ElementUri bizStep) void
setBizStep
(String bizStep) void
setDisposition
(Disposition disposition) void
setDisposition
(ElementUri disposition) void
setDisposition
(String disposition) void
setDocumentId
(String documentId) 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.void
void
setEpcs
(Collection<String> epcs) void
setEventTime
(ZonedDateTime eventTime) void
setEventTimeZoneOffset
(String eventTimeZoneOffset) void
setEventType
(EventType eventType) void
setParentId
(String parentId) void
setPartition
(long partition) void
setReadPoint
(ElementUri readPoint) void
setReadPoint
(ReadPoint readPoint) void
setReadPoint
(String readPoint) void
setRecordTime
(ZonedDateTime recordTime) void
setSagaEventId
(UUID sagaEventId)
-
Constructor Details
-
Event
public Event()
-
-
Method Details
-
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
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
- Be a UUID take the form:
-
getEpcs
-
setEpcs
-
setEpcs
-
addEpcs
-
addEpcs
-
getEventTime
-
setEventTime
-
getRecordTime
-
setRecordTime
-
getEventTimeZoneOffset
-
setEventTimeZoneOffset
-
getErrorDeclaration
-
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 EThis 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
-
setAction
-
getBizStep
-
getDisposition
-
getReadPoint
-
getBizLocation
-
getBizTransactions
-
getCustomTags
-
addCustomTag
public <T extends Exception> void addCustomTag(String xpath, ThrowingConsumer<CustomTag, T> consumer) throws T- Throws:
T extends Exception
-
addCustomTag
-
getCustomTagValue
-
getCustomTagValue
-
getRequiredCustomTagValue
-
getRequiredCustomTag
-
getCustomTags
-
getRequiredCustomTag
Find custom tag with matching namespace and name,IllegalArgumentException
is thrown if there's no matching custom tag- Parameters:
namespace
- to look forname
- to look for- Returns:
- custom tag with specified namespace and name
-
getSagaEventId
-
setSagaEventId
-
getSources
-
getDestinations
-
getQuantities
-
addQuantity
public <E extends Exception> void addQuantity(ThrowingConsumer<QuantityElement, E> consumer) throws EAdd 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
Depending on the EventType this can be the parentEPC, transactionId or transformationId- Returns:
- parentEPC, transactionId or transformationId.
-
setParentId
-
is
-
getEventType
-
setEventType
-
getInstanceLotMasterData
-
getPartition
public long getPartition() -
setPartition
public void setPartition(long partition) -
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
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
-
getInputEpcs
-
addInputEpcs
-
addInputEpcs
-
getInputQuantities
-
addInputQuantity
public <E extends Exception> void addInputQuantity(ThrowingConsumer<QuantityElement, E> consumer) throws EAdd 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
-
getDocumentId
-
getEpcsIncludingParent
-
setBizStep
-
setBizStep
-
setBizStep
-
setDisposition
-
setDisposition
-
setDisposition
-
setBizLocation
-
setBizLocation
-
setBizLocation
-
setReadPoint
-
setReadPoint
-
setReadPoint
-