Interface HvlBpmnRuntimeService

All Known Implementing Classes:
HvlBpmnRuntimeServiceImpl

@Validated public interface HvlBpmnRuntimeService
This service provides operational and retrieve methods.
  • Method Details

    • createProcessInstanceBuilder

      org.flowable.engine.runtime.ProcessInstanceBuilder createProcessInstanceBuilder()
      Create a ProcessInstanceBuilder, that allows to set various options for starting a process instance, as an alternative to the various startProcessInstanceByXX methods.
      Returns:
      the process instance builder
    • startProcessInstanceById

      HvlBpmnProcessInstanceModel startProcessInstanceById(@NotBlank @NotBlank String processDefinitionId, HvlBpmnStartProcessInstanceModel startProcessInstanceModel)
      Starts a new process instance in the latest version of the process definition with the given process definition query model.
      Parameters:
      processDefinitionId - the process definition id
      startProcessInstanceModel - the start process instance model
      Returns:
      the process instance
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no process definition is deployed with the given key.
    • startProcessInstanceByKey

      HvlBpmnProcessInstanceModel startProcessInstanceByKey(@NotBlank @NotBlank String processDefinitionKey, HvlBpmnStartProcessInstanceModel startProcessInstanceModel)
      Start process instance by key process instance.
      Parameters:
      processDefinitionKey - the process definition key
      startProcessInstanceModel - the start process instance model
      Returns:
      the process instance
    • startProcessInstanceByMessage

      HvlBpmnProcessInstanceModel startProcessInstanceByMessage(@NotBlank @NotBlank String messageName, HvlBpmnStartProcessInstanceModel startProcessInstanceModel)

      Signals the process engine that a message is received and starts a new ProcessInstance.

      Calling this method can have two different outcomes:

      • If the message name is associated with a message start event, a new process instance is started.
      • If no subscription to a message with the given name exists, FlowableException is thrown
      Parameters:
      messageName - the 'name' of the message as specified as an attribute on the bpmn20 <message name="messageName" /> element.
      startProcessInstanceModel - the start process instance model
      Returns:
      the ProcessInstance object representing the started process instance
      Throws:
      org.flowable.common.engine.api.FlowableException - if no subscription to a message with the given name exists
      Since:
      5.9
    • deleteProcessInstance

      void deleteProcessInstance(@NotBlank @NotBlank String processInstanceId, String deleteReason)
      Delete an existing runtime process instance.
      Parameters:
      processInstanceId - id of process instance to delete, cannot be null.
      deleteReason - reason for deleting, can be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no process instance is found with the given id.
    • getActiveActivityIds

      List<String> getActiveActivityIds(@NotBlank @NotBlank String processInstanceId)
      Finds the activity ids for all executions that are waiting in activities. This is a list because a single activity can be active multiple times.
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      Returns:
      the active activity ids
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution exists with the given processInstanceId.
    • trigger

      void trigger(@NotNull @NotNull HvlBpmnTriggerModel flowableTriggerModel)
      Sends an external trigger to an activity instance that is waiting inside the given execution.
      Parameters:
      flowableTriggerModel - the flowable trigger model
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
    • evaluateConditionalEvents

      void evaluateConditionalEvents(@NotBlank @NotBlank String processInstanceId)
      Evaluate waiting conditional events (boundary, intermediate catch and event sub process start events) and trigger them if a condition evaluates to true.
      Parameters:
      processInstanceId - id of process instance, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given processInstanceId.
    • evaluateConditionalEvents

      void evaluateConditionalEvents(@NotBlank @NotBlank String processInstanceId, Map<String,Object> processVariables)
      Evaluate waiting conditional events (boundary, intermediate catch and event sub process start events) and trigger them if a condition evaluates to true.
      Parameters:
      processInstanceId - id of process instance, cannot be null.
      processVariables - a map of process variables to be set before evaluation
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given processInstanceId.
    • updateBusinessKey

      void updateBusinessKey(@NotBlank @NotBlank String processInstanceId, String businessKey)
      Updates the business key for the provided process instance
      Parameters:
      processInstanceId - id of the process instance to set the business key, cannot be null
      businessKey - new businessKey value
    • updateBusinessStatus

      void updateBusinessStatus(@NotBlank @NotBlank String processInstanceId, String businessStatus)
      Updates the business status for the provided process instance
      Parameters:
      processInstanceId - id of the process instance to set the business status, cannot be null
      businessStatus - new business status value
    • addUserIdentityLink

      void addUserIdentityLink(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String userId, @NotBlank @NotBlank String identityLinkType)
      Involves a user with a process instance. The type of identity link is defined by the given identityLinkType.
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      userId - id of the user involve, cannot be null.
      identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process instance doesn't exist.
    • addGroupIdentityLink

      void addGroupIdentityLink(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String groupId, @NotBlank @NotBlank String identityLinkType)
      Involves a group with a process instance. The type of identityLink is defined by the given identityLink.
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      groupId - id of the group to involve, cannot be null.
      identityLinkType - type of identity, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the process instance or group doesn't exist.
    • addParticipantUser

      void addParticipantUser(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String userId)
      Convenience shorthand for addUserIdentityLink(String, String, String); with type IdentityLinkType.PARTICIPANT
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      userId - id of the user to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • addParticipantGroup

      void addParticipantGroup(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String groupId)
      Convenience shorthand for addGroupIdentityLink(String, String, String); with type IdentityLinkType.PARTICIPANT
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      groupId - id of the group to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or group doesn't exist.
    • deleteParticipantUser

      void deleteParticipantUser(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String userId)
      Convenience shorthand for deleteUserIdentityLink(String, String, String); with type IdentityLinkType.PARTICIPANT
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      userId - id of the user to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • deleteParticipantGroup

      void deleteParticipantGroup(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String groupId)
      Convenience shorthand for deleteGroupIdentityLink(String, String, String); with type IdentityLinkType.PARTICIPANT
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      groupId - id of the group to use as candidate, cannot be null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or group doesn't exist.
    • deleteUserIdentityLink

      void deleteUserIdentityLink(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String userId, @NotBlank @NotBlank String identityLinkType)
      Removes the association between a user and a process instance for the given identityLinkType.
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      userId - id of the user involve, cannot be null.
      identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or user doesn't exist.
    • deleteGroupIdentityLink

      void deleteGroupIdentityLink(@NotBlank @NotBlank String processInstanceId, @NotBlank @NotBlank String groupId, @NotBlank @NotBlank String identityLinkType)
      Removes the association between a group and a process instance for the given identityLinkType.
      Parameters:
      processInstanceId - id of the process instance, cannot be null.
      groupId - id of the group to involve, cannot be null.
      identityLinkType - type of identity, cannot be null (@see IdentityLinkType).
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the task or group doesn't exist.
    • getIdentityLinksForProcessInstance

      List<org.flowable.identitylink.api.IdentityLink> getIdentityLinksForProcessInstance(@NotBlank @NotBlank String instanceId)
      Retrieves the IdentityLinks associated with the given process instance. Such an IdentityLink informs how a certain user is involved with a process instance.
      Parameters:
      instanceId - the instance id
      Returns:
      the identity links for process instance
    • queryVariables

      Map<String,Object> queryVariables(@NotNull @NotNull HvlBpmnExecutionVariableQueryModel executionVariableQueryModel)
      Query variables map.
      Parameters:
      executionVariableQueryModel - the execution variable query model
      Returns:
      the map
    • queryVariableInstances

      Map<String,org.flowable.variable.api.persistence.entity.VariableInstance> queryVariableInstances(@NotNull @NotNull HvlBpmnExecutionVariableQueryModel executionVariableQueryModel)
      Query variable instances map.
      Parameters:
      executionVariableQueryModel - the execution variable query model
      Returns:
      the map
    • getVariableInstancesByExecutionIds

      List<org.flowable.variable.api.persistence.entity.VariableInstance> getVariableInstancesByExecutionIds(@NotEmpty @NotEmpty Set<String> executionIds)
      All variables visible from the given execution scope (including parent scopes).
      Parameters:
      executionIds - ids of execution, cannot be null.
      Returns:
      the variables.
    • getVariable

      Object getVariable(@NotNull @NotNull HvlBpmnExecutionVariableQueryModel executionVariableQueryModel)
      The variable value. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given name or when the value is set to null.
      Parameters:
      executionVariableQueryModel - the execution variable query model
      Returns:
      the variable value or null if the variable is undefined or the value of the variable is null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
    • getVariableInstance

      org.flowable.variable.api.persistence.entity.VariableInstance getVariableInstance(@NotNull @NotNull HvlBpmnExecutionVariableQueryModel executionVariableQueryModel)
      The variable. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given name or when the value is set to null.
      Parameters:
      executionVariableQueryModel - the execution variable query model
      Returns:
      the variable or null if the variable is undefined.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
    • getVariable

      <T> T getVariable(@NotNull @NotNull HvlBpmnExecutionVariableQueryModel executionVariableQueryModel, @NotNull @NotNull Class<T> variableClass)
      The variable value. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given name or when the value is set to null. Throws ClassCastException when cannot cast variable to given class
      Type Parameters:
      T - the type parameter
      Parameters:
      executionVariableQueryModel - the execution variable query model
      variableClass - name of variable, cannot be null.
      Returns:
      the variable value or null if the variable is undefined or the value of the variable is null.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
    • hasVariable

      boolean hasVariable(@NotNull @NotNull HvlBpmnExecutionVariableQueryModel executionVariableQueryModel)
      Check whether or not this execution has variable set with the given name, Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes).
      Parameters:
      executionVariableQueryModel - the execution variable query model
      Returns:
      the boolean
    • setVariable

      void setVariable(@NotBlank @NotBlank String executionId, @NotBlank @NotBlank String variableName, Object value, boolean isLocal)
      Update or create a variable for an execution.

      The variable is set according to the algorithm as documented for VariableScope.setVariable(String, Object).

      Parameters:
      executionId - id of execution to set variable in, cannot be null.
      variableName - name of variable to set, cannot be null.
      value - value to set. When null is passed, the variable is not removed, only it's value will be set to null.
      isLocal - the is local
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
      See Also:
      • VariableScope#setVariable(String, Object)VariableScope#setVariable(String, Object)
    • setVariables

      void setVariables(@NotBlank @NotBlank String executionId, @NotEmpty @NotEmpty Map<String,? extends Object> variables, boolean isLocal)
      Update or create given variables for an execution (including parent scopes).

      Variables are set according to the algorithm as documented for VariableScope.setVariables(Map), applied separately to each variable.

      Parameters:
      executionId - id of the execution, cannot be null.
      variables - map containing name (key) and value of variables, can be null.
      isLocal - the is local
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
      See Also:
      • VariableScope#setVariables(Map)VariableScope#setVariables(Map)
    • removeVariable

      void removeVariable(@NotNull @NotNull HvlBpmnExecutionVariableQueryModel executionVariableQueryModel)
      Removes a variable for an execution.
      Parameters:
      executionVariableQueryModel - the execution variable query model
    • getDataObjects

      Map<String,org.flowable.engine.runtime.DataObject> getDataObjects(@NotNull @NotNull HvlBpmnExecutionDataObjectQueryModel executionDataObjectQueryModel)
      All DataObjects visible from the given execution scope (including parent scopes).
      Parameters:
      executionDataObjectQueryModel - data object query model
      Returns:
      the DataObjects or an empty map if no such variables are found.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
    • getDataObject

      org.flowable.engine.runtime.DataObject getDataObject(@NotNull @NotNull HvlBpmnExecutionDataObjectQueryModel executionDataObjectQueryModel)
      The DataObject. Searching for the DataObject is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no DataObject value is found with the given name or when the value is set to null.
      Parameters:
      executionDataObjectQueryModel - data object query model
      Returns:
      the DataObject or null if the variable is undefined.
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when no execution is found for the given executionId.
    • createExecutionQuery

      org.flowable.engine.runtime.ExecutionQuery createExecutionQuery()
      Creates a new ExecutionQuery instance, that can be used to query the executions and process instances.
      Returns:
      the execution query
    • createNativeExecutionQuery

      org.flowable.engine.runtime.NativeExecutionQuery createNativeExecutionQuery()
      creates a new NativeExecutionQuery to query Executions by SQL directly
      Returns:
      the native execution query
    • createProcessInstanceQuery

      org.flowable.engine.runtime.ProcessInstanceQuery createProcessInstanceQuery()
      Creates a new ProcessInstanceQuery instance, that can be used to query process instances.
      Returns:
      the process instance query
    • createNativeProcessInstanceQuery

      org.flowable.engine.runtime.NativeProcessInstanceQuery createNativeProcessInstanceQuery()
      creates a new NativeProcessInstanceQuery to query ProcessInstances by SQL directly
      Returns:
      the native process instance query
    • createActivityInstanceQuery

      org.flowable.engine.runtime.ActivityInstanceQuery createActivityInstanceQuery()
      Creates a new ActivityInstanceQuery instance, that can be used to query activities in the currently running process instances.
      Returns:
      the activity instance query
    • createNativeActivityInstanceQuery

      org.flowable.engine.runtime.NativeActivityInstanceQuery createNativeActivityInstanceQuery()
      creates a new NativeActivityInstanceQuery to query ActivityInstances which are included in the cuby SQL directly.
      Returns:
      the native activity instance query
    • createEventSubscriptionQuery

      org.flowable.eventsubscription.api.EventSubscriptionQuery createEventSubscriptionQuery()
      Creates a new EventSubscriptionQuery instance, that can be used to query the event subscriptions.
      Returns:
      the event subscription query
    • suspendProcessInstanceById

      void suspendProcessInstanceById(@NotBlank @NotBlank String processInstanceId)
      Suspends the process instance with the given id.

      If a process instance is in state suspended, flowable will not execute jobs (timers, messages) associated with this instance.

      If you have a process instance hierarchy, suspending one process instance form the hierarchy will not suspend other process instances form that hierarchy.

      Parameters:
      processInstanceId - the process instance id
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processInstance can be found.
      org.flowable.common.engine.api.FlowableException - the process instance is already in state suspended.
    • activateProcessInstanceById

      void activateProcessInstanceById(@NotBlank @NotBlank String processInstanceId)
      Activates the process instance with the given id.

      If you have a process instance hierarchy, suspending one process instance form the hierarchy will not suspend other process instances form that hierarchy.

      Parameters:
      processInstanceId - the process instance id
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such processInstance can be found.
      org.flowable.common.engine.api.FlowableException - if the process instance is already in state active.
    • signalEventReceived

      void signalEventReceived(@NotNull @NotNull HvlBpmnSignalEventModel signalEventModel)

      Notifies the process engine that a signal event of name 'signalName' has been received. This method delivers the signal to all executions waiting on the signal.

      NOTE: The waiting executions are notified synchronously.
      Parameters:
      signalEventModel - signal event model
    • messageEventReceived

      void messageEventReceived(@NotNull @NotNull HvlBpmnMessageEventModel messageEventModel)
      Notifies the process engine that a message event with name 'messageName' has been received and has been correlated to an execution with id 'executionId'.

      The waiting execution is notified synchronously.

      Parameters:
      messageEventModel - message event query model
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - if no such execution exists.
      org.flowable.common.engine.api.FlowableException - if the execution has not subscribed to the signal
    • addEventListener

      void addEventListener(@NotNull @NotNull org.flowable.common.engine.api.delegate.event.FlowableEventListener listenerToAdd)
      Adds an event-listener which will be notified of ALL events by the dispatcher.
      Parameters:
      listenerToAdd - the listener to add
    • addEventListener

      void addEventListener(@NotNull @NotNull org.flowable.common.engine.api.delegate.event.FlowableEventListener listenerToAdd, org.flowable.common.engine.api.delegate.event.FlowableEngineEventType... types)
      Adds an event-listener which will only be notified when an event occurs, which type is in the given types.
      Parameters:
      listenerToAdd - the listener to add
      types - types of events the listener should be notified for
    • removeEventListener

      void removeEventListener(@NotNull @NotNull org.flowable.common.engine.api.delegate.event.FlowableEventListener listenerToRemove)
      Removes the given listener from this dispatcher. The listener will no longer be notified, regardless of the type(s) it was registered for in the first place.
      Parameters:
      listenerToRemove - listener to remove
    • dispatchEvent

      void dispatchEvent(@NotNull @NotNull org.flowable.common.engine.api.delegate.event.FlowableEvent event)
      Dispatches the given event to any listeners that are registered.
      Parameters:
      event - event to dispatch.
      Throws:
      org.flowable.common.engine.api.FlowableException - if an exception occurs when dispatching the event or when the FlowableEventDispatcher is disabled.
      org.flowable.common.engine.api.FlowableIllegalArgumentException - when the given event is not suitable for dispatching.
    • addEventRegistryConsumer

      void addEventRegistryConsumer(@NotNull @NotNull org.flowable.eventregistry.api.EventRegistryEventConsumer eventConsumer)
      Add event registry consumer.
      Parameters:
      eventConsumer - the event consumer
    • removeEventRegistryConsumer

      void removeEventRegistryConsumer(@NotNull @NotNull org.flowable.eventregistry.api.EventRegistryEventConsumer eventConsumer)
      Remove event registry consumer.
      Parameters:
      eventConsumer - the event consumer
    • setProcessInstanceName

      void setProcessInstanceName(@NotBlank @NotBlank String processInstanceId, String name)
      Sets the name for the process instance with the given id.
      Parameters:
      processInstanceId - id of the process instance to update
      name - new name for the process instance
      Throws:
      org.flowable.common.engine.api.FlowableObjectNotFoundException - when the given process instance does not exist.
    • getAdhocSubProcessExecutions

      List<org.flowable.engine.runtime.Execution> getAdhocSubProcessExecutions(@NotBlank @NotBlank String processInstanceId)
      Gets executions with an adhoc sub process as current flow element
      Parameters:
      processInstanceId - id of the process instance that is used to search for child executions
      Returns:
      a list of executions
    • getEnabledActivitiesFromAdhocSubProcess

      List<org.flowable.bpmn.model.FlowNode> getEnabledActivitiesFromAdhocSubProcess(@NotBlank @NotBlank String executionId)
      Gets enabled activities from ad-hoc sub process
      Parameters:
      executionId - id of the execution that has an ad-hoc sub process as current flow element
      Returns:
      a list of enabled activities
    • executeActivityInAdhocSubProcess

      org.flowable.engine.runtime.Execution executeActivityInAdhocSubProcess(@NotBlank @NotBlank String executionId, @NotBlank @NotBlank String activityId)
      Executes an activity in a ad-hoc sub process
      Parameters:
      executionId - id of the execution that has an ad-hoc sub process as current flow element
      activityId - id of the activity id to enable
      Returns:
      the newly created execution of the enabled activity
    • completeAdhocSubProcess

      void completeAdhocSubProcess(@NotBlank @NotBlank String executionId)
      Completes the ad-hoc sub process
      Parameters:
      executionId - id of the execution that has an ad-hoc sub process as current flow element
    • createChangeActivityStateBuilder

      org.flowable.engine.runtime.ChangeActivityStateBuilder createChangeActivityStateBuilder()
      Create a ChangeActivityStateBuilder, that allows to set various options for changing the state of a process instance.
      Returns:
      the change activity state builder
    • addMultiInstanceExecution

      org.flowable.engine.runtime.Execution addMultiInstanceExecution(@NotBlank @NotBlank String activityId, @NotBlank @NotBlank String parentExecutionId, Map<String,Object> executionVariables)
      Adds a new execution to a running multi-instance parent execution
      Parameters:
      activityId - id of the multi-instance activity (id attribute in the BPMN XML)
      parentExecutionId - can be the process instance id, in case there's one multi-instance execution for the provided activity id. In case of multiple multi-instance executions with the same activity id this can be a specific parent execution id.
      executionVariables - variables to be set on as local variable on the newly created multi-instance execution
      Returns:
      the newly created multi-instance execution
    • deleteMultiInstanceExecution

      void deleteMultiInstanceExecution(@NotBlank @NotBlank String executionId, boolean executionIsCompleted)
      Deletes a multi-instance execution
      Parameters:
      executionId - id of the multi-instance execution to be deleted
      executionIsCompleted - defines if the deleted execution should be marked as completed on the parent multi-instance execution
    • getProcessInstanceEvents

      List<org.flowable.engine.task.Event> getProcessInstanceEvents(@NotBlank @NotBlank String processInstanceId)
      The all events related to the given Process Instance.
      Parameters:
      processInstanceId - the process instance id
      Returns:
      the process instance events
    • queryPage

      tr.com.havelsan.javarch.data.commons.pageable.HvlPage<HvlBpmnProcessInstanceModel> queryPage(@NotNull @RequestBody @NotNull HvlBpmnProcessInstanceQueryModel processInstanceQueryModel)
      Query as page.
      Parameters:
      processInstanceQueryModel - the process instance query model
      Returns:
      the hvl page