@ProviderType public interface WorkflowSession extends Adaptable
The WorkflowSession class provides all functionality (depending
on the users rights) for managing WorkflowModels, Workflow
instances and their execution.
It provides methods to:
WorkItems assigned to a user/group| Modifier and Type | Method and Description |
|---|---|
void |
complete(WorkItem item,
Route route)
Completes the
for the assigned
instance and assign to the next
according to the given
. |
WorkflowModel |
createNewModel(java.lang.String title)
Creates a new blank
. |
WorkflowModel |
createNewModel(java.lang.String title,
java.lang.String id)
Creates a new blank
under the given path. |
void |
delegateWorkItem(WorkItem item,
Participant participant)
Delegates the
WorkItem to the specified Principal. |
void |
deleteModel(java.lang.String id)
Deletes the given
. |
void |
deployModel(WorkflowModel model)
Deploys a new or modified
. |
ResultSet<InboxItem> |
getActiveInboxItems(long start,
long limit,
InboxItemFilter filter)
Retrieves all the active
InboxItems assigned to user for this WorkflowSession instance. |
ResultSet<InboxItem> |
getActiveInboxItems(long start,
long limit,
java.lang.String itemSubType,
InboxItemFilter filter)
Retrieves all the active
InboxItems assigned to user for this WorkflowSession instance. |
WorkItem[] |
getActiveWorkItems()
|
ResultSet<WorkItem> |
getActiveWorkItems(long start,
long limit)
|
ResultSet<WorkItem> |
getActiveWorkItems(long start,
long limit,
WorkItemFilter filter)
|
Workflow[] |
getAllWorkflows()
Returns all
Workflows which the
has access to. |
WorkItem[] |
getAllWorkItems()
|
ResultSet<WorkItem> |
getAllWorkItems(long start,
long limit)
|
java.util.List<Route> |
getBackRoutes(WorkItem item,
boolean expand)
All
to all possible already passed
destinations will be returned. |
java.util.Iterator<Participant> |
getDelegates(WorkItem item)
Returns all
delegates as Participant who are
allowed to take over the WorkItem |
java.util.List<HistoryItem> |
getHistory(Workflow instance)
The complete ordered list of
HistoryItem
s is returned for the given Workflow instance. |
WorkflowModel |
getModel(java.lang.String id)
Returns newest version of the
with the
given ID. |
WorkflowModel |
getModel(java.lang.String id,
java.lang.String version)
Returns the
with the given ID and
version. |
WorkflowModel[] |
getModels()
Returns newest versions of all deployed
s. |
ResultSet<WorkflowModel> |
getModels(long start,
long limit)
Returns newest versions of all deployed
s. |
ResultSet<WorkflowModel> |
getModels(long start,
long limit,
WorkflowModelFilter filter)
Returns newest versions of all deployed
s. |
WorkflowModel[] |
getModels(WorkflowModelFilter filter)
Returns newest versions of all deployed
s. |
java.util.List<Route> |
getRoutes(WorkItem item,
boolean expand)
All
to all possible destinations will be
returned. |
default java.util.Set<java.lang.String> |
getUsersExplicitlySharingItems()
Provides the set of users, who have explicitly shared some of their inbox items with the current user
Returns null if there is no user matching above criterion
|
default java.util.Set<java.lang.String> |
getUsersSharingInbox()
Provides the set of users, who have shared their entire inbox with the current user
Returns null if there is no user matching above criterion
|
Workflow |
getWorkflow(java.lang.String id)
Retrieve the
instance with the given ID. |
Workflow[] |
getWorkflows(java.lang.String[] states)
Returns all
Workflow instances that are in one of
the given states and to which the
WorkflowSession has access to. |
ResultSet<Workflow> |
getWorkflows(java.lang.String[] states,
long start,
long limit)
Returns all
Workflows instances that are in one of
the given states and to which the WorkflowSession has access to. |
WorkItem |
getWorkItem(java.lang.String id)
Returns the
WorkItem with the given ID assigned to a
Workflow instance, but only if the respective users
WorkflowSession has access to it. |
boolean |
isSuperuser()
Checks for the workflow superuser
|
default void |
lock(InboxItem item)
Locks the shared InboxItem.
|
void |
logout()
The logout method has to be called in order to clean up all jcr session
references.
|
WorkflowData |
newWorkflowData(java.lang.String payloadType,
java.lang.Object payload)
Creates a new
instance based on the
given data. |
void |
restartWorkflow(Workflow workflow)
This method restarts a workflow instance that is in a "stale" state.
|
void |
resumeWorkflow(Workflow instance)
Resumes the given
Workflow instance. |
default void |
returnItem(InboxItem item)
Returns the inbox item to previous assignee
|
default void |
share(InboxItem item,
java.util.Set<java.lang.String> userIds)
Shares the InboxItem with provided list of users.
|
Workflow |
startWorkflow(WorkflowModel model,
WorkflowData data)
|
Workflow |
startWorkflow(WorkflowModel model,
WorkflowData data,
java.util.Map<java.lang.String,java.lang.Object> metaData)
|
void |
suspendWorkflow(Workflow instance)
Suspends the given
Workflow instance. |
void |
terminateWorkflow(Workflow instance)
Terminates the given
Workflow instance. |
void |
updateWorkflowData(Workflow instance,
WorkflowData data)
Updates the workflow data of a running workflow instance to the given
WorkflowData. |
void deployModel(WorkflowModel model) throws WorkflowException
WorkflowModel.model - The WorkflowModel to be deployed.WorkflowException - Thrown in case an error prevents deployment of the
WorkflowModel.WorkflowModel createNewModel(java.lang.String title) throws WorkflowException
WorkflowModel.title - The title of the newly created
WorkflowModel.WorkflowModel.WorkflowException - Thrown in case an error prevents creation of the
WorkflowModel.WorkflowModel createNewModel(java.lang.String title, java.lang.String id) throws WorkflowException
WorkflowModel under the given path.title - The title of the newly created
WorkflowModel.id - The ID of the new WorkflowModel.WorkflowModel.WorkflowException - Thrown in case an error prevents creation of the
WorkflowModel.void deleteModel(java.lang.String id)
throws WorkflowException
WorkflowModel.id - The ID of the WorkflowModel to be
deleted.WorkflowException - Thrown in case an error prevents deployment of the
WorkflowModel.WorkflowModel[] getModels() throws WorkflowException
WorkflowModels.WorkflowModel at their newest
versions.WorkflowException - Thrown in case an error occurs while fetching the
WorkflowModels.WorkflowModel[] getModels(WorkflowModelFilter filter) throws WorkflowException
WorkflowModels.filter - for workflow modelsWorkflowModel at their newest
versions.WorkflowException - Thrown in case an error occurs while fetching the
WorkflowModels.ResultSet<WorkflowModel> getModels(long start, long limit) throws WorkflowException
WorkflowModels.start - Start index of the result set.limit - Limit of the result set.WorkflowModel at their newest
versions.WorkflowException - Thrown in case an error occurs while fetching the
WorkflowModels.ResultSet<WorkflowModel> getModels(long start, long limit, WorkflowModelFilter filter) throws WorkflowException
WorkflowModels.filter - for workflow modelsstart - Start index of the result set.limit - Limit of the result set.WorkflowModel at their newest
versions.WorkflowException - Thrown in case an error occurs while fetching the
WorkflowModels.WorkflowModel getModel(java.lang.String id) throws WorkflowException
WorkflowModel with the
given ID.id - The ID of the WorkflowModel.WorkflowModel with
the given ID or null, if no WorkflowModel
with the given ID exists.WorkflowException - Thrown in case an error occurs while fetching the
WorkflowModel.WorkflowModel getModel(java.lang.String id, java.lang.String version) throws WorkflowException, VersionException
WorkflowModel with the given ID and
version.id - The ID of the WorkflowModel.version - The version of the WorkflowModel.WorkflowModel with the given ID and
version or null, if no WorkflowModel matches
the given ID and/or version.WorkflowException - Thrown in case an error occurs while fetching the
WorkflowModel.VersionException - Thrown in case the version does not exist or can not be
accessed.Workflow startWorkflow(WorkflowModel model, WorkflowData data) throws WorkflowException
model - WorkflowModel to be used for the new
Workflow instance.data - WorkflowData to be attached to the new
workflow instance.Workflow of the newly started
Workflow instance.WorkflowException - Thrown in case the workflow process cannot be started.Workflow startWorkflow(WorkflowModel model, WorkflowData data, java.util.Map<java.lang.String,java.lang.Object> metaData) throws WorkflowException
model - WorkflowModel to be used for the new
Workflow instance.data - WorkflowData to be attached to the new
workflow instance.metaData - Meta data assigned to the new Workflow.Workflow of the newly started
Workflow instance. eWorkflowException - Thrown in case the workflow process cannot be started.void terminateWorkflow(Workflow instance) throws WorkflowException
Workflow instance.instance - The Workflow instance that shall be
terminated.WorkflowException - Thrown in case the workflow instance cannot be terminated.void resumeWorkflow(Workflow instance) throws WorkflowException
Workflow instance.instance - The Workflow instance that shall be
resumed.WorkflowException - Thrown in case the workflow instance cannot be resumed.void suspendWorkflow(Workflow instance) throws WorkflowException
Workflow instance.instance - The Workflow of the workflow instance
that shall be suspended.WorkflowException - Thrown in case the workflow instance cannot be suspended.WorkItem[] getActiveWorkItems() throws WorkflowException
WorkItems assigned to an active Workflow
instance and the respective user of the WorkflowSession will
be returned.WorkItems assigned to an active workflow
and the respective users WorkflowSession.WorkflowException - Thrown in case an exception occurs while fetching the active
WorkItems.ResultSet<WorkItem> getActiveWorkItems(long start, long limit) throws WorkflowException
WorkItems assigned to an active Workflow
instance and the respective user of the WorkflowSession will
be returned.start - Start index of the result set.limit - Limit of the result set.WorkItems assigned to an active workflow
and the respective users WorkflowSession.WorkflowException - Thrown in case an exception occurs while fetching the active
WorkItems.ResultSet<WorkItem> getActiveWorkItems(long start, long limit, WorkItemFilter filter) throws WorkflowException
WorkItems assigned to an active Workflow
instance and the respective user of the WorkflowSession will
be returned.start - Start index of the result set.limit - Limit of the result set.filter - filter for work itemsWorkItems assigned to an active workflow
and the respective users WorkflowSession.WorkflowException - Thrown in case an exception occurs while fetching the active
WorkItems.ResultSet<InboxItem> getActiveInboxItems(long start, long limit, InboxItemFilter filter) throws WorkflowException
InboxItems assigned to user for this WorkflowSession instance.
Use this method instead of getActiveWorkItems(long, long, com.adobe.granite.workflow.exec.filter.WorkItemFilter) ()}
if you wish to retrieve both WorkItems (which is an InboxItem) and InboxItems from other InboxItem providersstart - Start index of the result set. zero based, pass 0 to start at beginninglimit - Limit of the result set. pass -1 for no limit.filter - filter for inbox itemsWorkflowException - Thrown in case an exception occurs while fetching all InboxItems.ResultSet<InboxItem> getActiveInboxItems(long start, long limit, java.lang.String itemSubType, InboxItemFilter filter) throws WorkflowException
InboxItems assigned to user for this WorkflowSession instance.
The provided filter can also specify user whose items the current user has access to.
Use this method instead of getActiveWorkItems(long, long, com.adobe.granite.workflow.exec.filter.WorkItemFilter) ()}
if you wish to retrieve both WorkItems (which is an InboxItem) and InboxItems from other InboxItem providersstart - Start index of the result set. zero based, pass 0 to start at beginninglimit - Limit of the result set. pass -1 for no limit.itemSubType - The sub-type of the inbox item.filter - filter for inbox itemsWorkflowException - Thrown in case an exception occurs while fetching all InboxItems.WorkItem[] getAllWorkItems() throws WorkflowException
WorkItems assigned to a Workflow
instance and assigned to the respective user of the
WorkflowSession will be returned.WorkItems assigned to a Workflow
instance and the respective users WorkflowSession.WorkflowException - Thrown in case an exception occurs while fetching all
WorkItems.ResultSet<WorkItem> getAllWorkItems(long start, long limit) throws WorkflowException
WorkItems assigned to a Workflow
instance and assigned to the respective user of the
WorkflowSession will be returned.start - Start index of the result set.limit - Limit of the result set.WorkItems assigned to a Workflow
instance and the respective users WorkflowSession.WorkflowException - Thrown in case an exception occurs while fetching all
WorkItems.WorkItem getWorkItem(java.lang.String id) throws WorkflowException
WorkItem with the given ID assigned to a
Workflow instance, but only if the respective users
WorkflowSession has access to it.id - The ID of the WorkItem.WorkItem with the given ID.WorkflowException - Thrown in case an exception is occurs while fetching the
WorkItem.Workflow[] getWorkflows(java.lang.String[] states) throws WorkflowException
Workflow instances that are in one of
the given states and to which the
WorkflowSession has access to.states - The list of states used to select the Workflow instances.Workflows that are in one of the given
states and to which the WorkflowSession has access to.WorkflowException - Thrown in case an error occurred while retrieving the
Workflows.ResultSet<Workflow> getWorkflows(java.lang.String[] states, long start, long limit) throws WorkflowException
Workflows instances that are in one of
the given states and to which the WorkflowSession has access to.states - The list of states used to select the Workflow instances.start - Start index of the result set.limit - Limit of the result set.Workflows that are in one of the given
states and to which the WorkflowSession has access to.WorkflowException - Thrown in case an error occurred while retrieving the
Workflows.Workflow[] getAllWorkflows() throws WorkflowException
Workflows which the
WorkflowSession has access to.Workflows the
WorkflowSession has access to.WorkflowException - Thrown in case an error occurred while retrieving the
Workflows.Workflow getWorkflow(java.lang.String id) throws WorkflowException
Workflow instance with the given ID.id - The ID of the Workflow instance that
should be returned.Workflow instance with the given ID or
null, if no Workflow instance ID matches the
given ID.WorkflowException - Thrown in case an unexpected error occurs while retrieving
the Workflow.void complete(WorkItem item, Route route) throws WorkflowException
WorkItem for the assigned
Workflow instance and assign to the next
WorkflowNode according to the given
Route.item - The WorkItem to be completed.route - The Route to the destination to be
advanced.WorkflowException - Thrown in case an error is occurs while completing the
WorkItem.java.util.List<Route> getRoutes(WorkItem item, boolean expand) throws WorkflowException
Route to all possible destinations will be
returned. Rules will be already executed, thus all routes that are active
can be selected.item - The WorkItem to retrieve routes from.expand - Expands the group members if the destination points to a
group. Means that not only the group is returned as route but
as well all group members.Routes to advance.WorkflowException - Thrown in case an error is occurs while evaluating the
Routes.java.util.List<Route> getBackRoutes(WorkItem item, boolean expand) throws WorkflowException
Route to all possible already passed
destinations will be returned. Rules will be already executed, thus all
routes that are active can be selected.item - The WorkItem to retrieve back routes
from.expand - Expands the group members if the destination points to a
group. Means that not only the group is returned as route but
as well all group members.Routes to advance (back).WorkflowException - Thrown in case an error is occurs while evaluating the
Routes.WorkflowData newWorkflowData(java.lang.String payloadType, java.lang.Object payload)
WorkflowData instance based on the
given data.payloadType - The type of payload for the new
WorkflowData instance.payload - The payload object used for creating the new
WorkflowData instance.
WorkflowData instance.WorkflowData instance.java.util.Iterator<Participant> getDelegates(WorkItem item) throws WorkflowException
delegates as Participant who are
allowed to take over the WorkItemitem - The workitemParticipants who are allowed to act as delegates.WorkflowException - in case the delegates could not be retrieved for some reasonvoid delegateWorkItem(WorkItem item, Participant participant) throws WorkflowException, java.security.AccessControlException
WorkItem to the specified Principal.item - the corresponding workitemparticipant - the participant to delegatejava.security.AccessControlException - if the given participant is not allowed to take over the workitem.WorkflowException - in case the delegation fails in regards of persisting the "new" state.java.util.List<HistoryItem> getHistory(Workflow instance) throws WorkflowException
HistoryItem
s is returned for the given Workflow instance.instance - Workflow instanceList of HistoryItem
sWorkflowException - in case the history item retrieval failsvoid updateWorkflowData(Workflow instance, WorkflowData data)
WorkflowData.instance - The Workflow instance for which to update the data.data - The WorkflowData for the update.void logout()
boolean isSuperuser()
true if the user is a workflow superuservoid restartWorkflow(Workflow workflow) throws WorkflowException
This method restarts a workflow instance that is in a "stale" state. means there is no workitem around. this could happen in case the eventing which controls the the script/java processes purges an event/job (there is the depending (serialized) workitem stored). The restart tries to start the workflow at the position right before the workitem got lost.
Note: This is an administrative method and can only be used by a workflow superuser!
workflow - workflowWorkflowException - in case an error occursdefault java.util.Set<java.lang.String> getUsersSharingInbox()
throws WorkflowException
WorkflowExceptiondefault java.util.Set<java.lang.String> getUsersExplicitlySharingItems()
throws WorkflowException
WorkflowExceptiondefault void share(InboxItem item, java.util.Set<java.lang.String> userIds) throws WorkflowException
item - The inbox item to be shared.userIds - The list of authorizableIds of the users with whom item has to be shared.WorkflowException - Thrown in case an error occurs while sharing the inbox item.default void lock(InboxItem item) throws WorkflowException
item - The inbox item to be locked.WorkflowException - Thrown in case an error occurs while locking the inbox item.default void returnItem(InboxItem item) throws WorkflowException
item - The inbox item to be returned.WorkflowException - Thrown in case an error occurs while returning the inbox item.Copyright © 2010 - 2023 Adobe. All Rights Reserved