@ProviderType public interface WorkflowSession extends Adaptable
The WorkflowSession
class provides all functionality (depending
on the users rights) for managing WorkflowModel
s, Workflow
instances and their execution.
It provides methods to:
WorkItem
s assigned to a user/groupModifier 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
InboxItem s assigned to user for this WorkflowSession instance. |
ResultSet<InboxItem> |
getActiveInboxItems(long start,
long limit,
java.lang.String itemSubType,
InboxItemFilter filter)
Retrieves all the active
InboxItem s 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
Workflow s 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
Workflow s 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
WorkflowModel
s.WorkflowModel
at their newest
versions.WorkflowException
- Thrown in case an error occurs while fetching the
WorkflowModel
s.WorkflowModel[] getModels(WorkflowModelFilter filter) throws WorkflowException
WorkflowModel
s.filter
- for workflow modelsWorkflowModel
at their newest
versions.WorkflowException
- Thrown in case an error occurs while fetching the
WorkflowModel
s.ResultSet<WorkflowModel> getModels(long start, long limit) throws WorkflowException
WorkflowModel
s.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
WorkflowModel
s.ResultSet<WorkflowModel> getModels(long start, long limit, WorkflowModelFilter filter) throws WorkflowException
WorkflowModel
s.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
WorkflowModel
s.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
WorkItem
s assigned to an active Workflow
instance and the respective user of the WorkflowSession
will
be returned.WorkItem
s assigned to an active workflow
and the respective users WorkflowSession
.WorkflowException
- Thrown in case an exception occurs while fetching the active
WorkItem
s.ResultSet<WorkItem> getActiveWorkItems(long start, long limit) throws WorkflowException
WorkItem
s 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.WorkItem
s assigned to an active workflow
and the respective users WorkflowSession
.WorkflowException
- Thrown in case an exception occurs while fetching the active
WorkItem
s.ResultSet<WorkItem> getActiveWorkItems(long start, long limit, WorkItemFilter filter) throws WorkflowException
WorkItem
s 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 itemsWorkItem
s assigned to an active workflow
and the respective users WorkflowSession
.WorkflowException
- Thrown in case an exception occurs while fetching the active
WorkItem
s.ResultSet<InboxItem> getActiveInboxItems(long start, long limit, InboxItemFilter filter) throws WorkflowException
InboxItem
s 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 InboxItem
s.ResultSet<InboxItem> getActiveInboxItems(long start, long limit, java.lang.String itemSubType, InboxItemFilter filter) throws WorkflowException
InboxItem
s 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 InboxItem
s.WorkItem[] getAllWorkItems() throws WorkflowException
WorkItem
s assigned to a Workflow
instance and assigned to the respective user of the
WorkflowSession
will be returned.WorkItem
s assigned to a Workflow
instance and the respective users WorkflowSession
.WorkflowException
- Thrown in case an exception occurs while fetching all
WorkItem
s.ResultSet<WorkItem> getAllWorkItems(long start, long limit) throws WorkflowException
WorkItem
s 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.WorkItem
s assigned to a Workflow
instance and the respective users WorkflowSession
.WorkflowException
- Thrown in case an exception occurs while fetching all
WorkItem
s.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.Workflow
s 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
Workflow
s.ResultSet<Workflow> getWorkflows(java.lang.String[] states, long start, long limit) throws WorkflowException
Workflow
s 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.Workflow
s 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
Workflow
s.Workflow[] getAllWorkflows() throws WorkflowException
Workflow
s which the
WorkflowSession
has access to.Workflow
s the
WorkflowSession
has access to.WorkflowException
- Thrown in case an error occurred while retrieving the
Workflow
s.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.Route
s to advance.WorkflowException
- Thrown in case an error is occurs while evaluating the
Route
s.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.Route
s to advance (back).WorkflowException
- Thrown in case an error is occurs while evaluating the
Route
s.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 WorkItem
item
- The workitemParticipant
s 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
WorkflowException
default java.util.Set<java.lang.String> getUsersExplicitlySharingItems() throws WorkflowException
WorkflowException
default 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 - 2020 Adobe. All Rights Reserved