Class MetadataUtils
java.lang.Object
io.axoniq.framework.workflow.runtime.util.MetadataUtils
Utility to work on metadata of workflow events.
- Since:
- 5.4.0
- Author:
- Simon Zambrovski, Stefan Dragisic
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMetadata key storing the payload reducer name to apply after a step result.static final StringMetadata key storing the workflow step name.static final StringMetadata key storing the step primitive classification.static final StringMetadata key storing the step status value.static final StringMetadata key storing the workflow version associated with a version marker event.static final StringMetadata key storing the identifier of a recorded workflow version change.static final StringMetadata key storing the workflow definition name.static final StringMetadata key storing the workflow definition version.static final StringMetadata key storing the workflow instance identifier.static final StringMetadata key storing the workflow lifecycle status value.static final StringMarker value identifying a step as a publish primitive: a business event that is also the completed step.static final StringMarker value identifying a step as a wait-for-event primitive. -
Method Summary
Modifier and TypeMethodDescriptionstatic MetadataCreates a new metadata instance with the given workflow id.static Metadatacreate(String workflowId, WorkflowStatus workflowStatus) Creates a new metadata instance with the given workflow id and workflow status.static Metadatacreate(String workflowId, WorkflowStatus workflowStatus, VersionedType workflowDefinitionId) Creates a new metadata instance with the given workflow id, workflow status, and workflow definition id.static Metadatacreate(String workflowId, String stepName, StepStatus stepStatus) Creates a new metadata instance with the given workflow id and step name.static MetadatacreateVersionMigrationStep(String workflowId, String changeId, String version) Metadata for a version-marker event: a COMPLETED step event withstepName = changeIdplus marker keys (versionChangeId,version) whose presence flags this as a version marker.static StringgetStepName(Metadata metadata) Returns the step name from the metadata.static Optional<StepStatus> getStepStatus(Metadata metadata) Returns the step status if present in the metadata.getVersion(Metadata metadata) Returns the version if present in the metadata.getVersionChangeId(Metadata metadata) Returns the version change id if present in the metadata.static Optional<VersionedType> getWorkflowDefinitionId(Metadata metadata) Returns the workflow definition id if present in the metadata.static StringgetWorkflowId(Metadata metadata) Returns the workflow id from the metadata.static Optional<WorkflowStatus> getWorkflowStatus(Metadata metadata) Returns the workflow status if present in the metadata.Predicate that matches metadata that contain a workflow id.static booleanisPublishStep(Metadata metadata) Checks whether the metadata marks a publish step.static booleanisVersionMigrationStep(Metadata metadata) Returns whether the given metadata carries a version marker.static booleanisWaitForEventStep(Metadata metadata) Returns whether the given metadata carries a step that is waiting for an event.static MetadatamarkWaitForEventStep(Metadata metadata) Marks the given metadata as a step that is waiting for an event.payloadReducer(Metadata metadata) Returns the payload reducer if present in the metadata.static MetadatawithWorkflowDefinitionId(Metadata metadata, VersionedType workflowDefinitionId) Enriches metadata with the workflow definition id.workflowIdFilter(String workflowId) Returns a predicate that matches metadata with the given workflow id.
-
Field Details
-
METADATA_KEY_WORKFLOW_ID
Metadata key storing the workflow instance identifier.- See Also:
-
METADATA_KEY_TYPE
Metadata key storing the step status value.- See Also:
-
METADATA_KEY_STEP_PRIMITIVE
Metadata key storing the step primitive classification.- See Also:
-
METADATA_KEY_MODIFY_PAYLOAD
Metadata key storing the payload reducer name to apply after a step result.- See Also:
-
METADATA_KEY_STEP_NAME
Metadata key storing the workflow step name.- See Also:
-
METADATA_KEY_WORKFLOW_STATUS
Metadata key storing the workflow lifecycle status value.- See Also:
-
METADATA_KEY_WORKFLOW_DEFINITION_NAME
Metadata key storing the workflow definition name.- See Also:
-
METADATA_KEY_WORKFLOW_DEFINITION_VERSION
Metadata key storing the workflow definition version.- See Also:
-
METADATA_KEY_VERSION_CHANGE_ID
Metadata key storing the identifier of a recorded workflow version change.- See Also:
-
METADATA_KEY_VERSION
Metadata key storing the workflow version associated with a version marker event.- See Also:
-
STEP_PRIMITIVE_WAIT_FOR_EVENT
Marker value identifying a step as a wait-for-event primitive.- See Also:
-
STEP_PRIMITIVE_PUBLISH
Marker value identifying a step as a publish primitive: a business event that is also the completed step.- See Also:
-
-
Method Details
-
create
Creates a new metadata instance with the given workflow id.- Parameters:
workflowId- the workflow id- Returns:
- metadata instance
-
create
Creates a new metadata instance with the given workflow id and step name.- Parameters:
workflowId- the workflow idstepName- the step namestepStatus- the step status- Returns:
- metadata instance
-
create
Creates a new metadata instance with the given workflow id and workflow status.- Parameters:
workflowId- the workflow idworkflowStatus- the workflow status- Returns:
- metadata instance
-
create
public static Metadata create(String workflowId, WorkflowStatus workflowStatus, VersionedType workflowDefinitionId) Creates a new metadata instance with the given workflow id, workflow status, and workflow definition id.- Parameters:
workflowId- the workflow idworkflowStatus- the workflow statusworkflowDefinitionId- the workflow definition identifier- Returns:
- metadata instance
-
createVersionMigrationStep
public static Metadata createVersionMigrationStep(String workflowId, String changeId, String version) Metadata for a version-marker event: a COMPLETED step event withstepName = changeIdplus marker keys (versionChangeId,version) whose presence flags this as a version marker.- Parameters:
workflowId- the workflow idchangeId- the change idversion- the version- Returns:
- metadata instance
-
markWaitForEventStep
Marks the given metadata as a step that is waiting for an event.- Parameters:
metadata- metadata to mark- Returns:
- enriched metadata
-
getWorkflowStatus
Returns the workflow status if present in the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- optional of workflow status
-
getStepStatus
Returns the step status if present in the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- optional of step status
-
getVersionChangeId
Returns the version change id if present in the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- optional of version change id
-
getVersion
Returns the version if present in the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- optional of version of the workflow
-
withWorkflowDefinitionId
public static Metadata withWorkflowDefinitionId(Metadata metadata, VersionedType workflowDefinitionId) Enriches metadata with the workflow definition id.- Parameters:
metadata- metadata to enrichworkflowDefinitionId- workflow definition id to store- Returns:
- enriched metadata
-
getWorkflowDefinitionId
Returns the workflow definition id if present in the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- optional workflow definition id
-
isVersionMigrationStep
Returns whether the given metadata carries a version marker.- Returns:
trueif the metadata carries aversionChangeIdkey — i.e. it's a version marker.
-
payloadReducer
Returns the payload reducer if present in the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- optional of payload reducer
-
getWorkflowId
Returns the workflow id from the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- workflow id
-
getStepName
Returns the step name from the metadata.- Parameters:
metadata- metadata to inspect- Returns:
- step name
-
isWaitForEventStep
Returns whether the given metadata carries a step that is waiting for an event.- Parameters:
metadata- metadata to inspect- Returns:
trueiff the metadata carries astepPrimitivekey with valueWAIT_FOR_EVENT.
-
workflowIdFilter
Returns a predicate that matches metadata with the given workflow id.- Parameters:
workflowId- workflow id to match- Returns:
- predicate on metadata
-
hasWorkflowId
Predicate that matches metadata that contain a workflow id.- Returns:
- predicate on metadata
-
isPublishStep
Checks whether the metadata marks a publish step.- Parameters:
metadata- metadata to inspect- Returns:
trueiff the metadata carries astepPrimitivekey with valuePUBLISH
-