com.sap.bpm.tm.api

Interface TaskInstanceManager


public interface TaskInstanceManager

Central access point for getting and manipulating task instances.

NOTE: As this interface can be extended, this interface can be freely used, but must not be implemented.

 SAP API Classification:
This interface is intended to be used only and may not be implemented by client code.

Method Summary
 URI addNote(URI taskInstanceId, String content, boolean isLocal)
          Returns a unique identifier of the newly added Note
Adds a Note to the given TaskAbstract and returns a unique identifier of the Note.
 void claim(URI taskInstanceId)
          Claim responsibility for the task, i.e. set the task to status Reserved and set the current user as the actual owner.
 void claimAndComplete(URI taskInstanceId, commonj.sdo.DataObject taskOutputData, CustomAction customAction)
          Claim responsibility for the task by setting the current user as the actual owner and then complete the processing of the task, i.e.
 void complete(URI taskInstanceId, commonj.sdo.DataObject taskOutputData)
          Complete the processing of the task, i.e. set the task to status Completed.
 void complete(URI taskInstanceId, commonj.sdo.DataObject taskOutputData, CustomAction customAction)
          Complete the processing of the task, i.e. set the task to status Completed with custom action.
 void delegate(URI taskInstanceId, IUser newOwner)
           Triggers the 'Delegate' task action.
 void fail(URI taskInstanceId, Fault fault)
          Execution of the task fails and a fault is returned.
 URL generateTaskExecutionUrl(URI taskInstanceId)
          Generates the URL pointing to the default Task Execution UI for the specified task instance id.
 Attachment getAttachment(URI taskInstanceId, URI attachmentId)
          Returns an Attachment identified by the given URI conforming following conditions If attachment is local to the task instance, then taskInstanceId should be of same task to which attachment belongs to If attachment is at process instance level then taskInstanceId and attachmentId must belong to same process instance Logged on user should have access to task for which taskInstanceId has been passed
 List<Attachment> getAttachments(URI taskInstanceId)
          Returns a list of Attachments visible to the TaskAbstract and its parent ProcessInstance
 Set<TaskAbstract> getMyTaskAbstracts(Set<Status> statuses)
           Returns the set of instances of type TaskAbstract for the logged in user and for the specified task statuses.
 List<TaskAbstract> getMyTaskAbstracts(Set<Status> statuses, QueryResultParameters resultParameters, TaskAbstractQueryCriteria... queryCriteria)
          Returns the set of instances of TaskAbstract for the logged in user and for the specified task statuses.
 Set<TaskAbstract> getMyTaskAbstractsByParent(URI processInstanceId, Set<Status> statuses)
          Returns the set of instances of TaskAbstract for a given process instance.
 int getMyTaskCount(Set<Status> statuses)
          Returns amount of all tasks, which are directly visible for the currently logged-in user (substitution rules will NOT be considered).
 Note getNote(URI noteId)
          Returns a Note identified by the given URI
 List<Note> getNotes(URI taskInstanceId)
          Returns a list of Notes visible to the TaskAbstract
 TaskAbstract getTaskAbstract(URI taskInstanceId)
          Returns an abstract of the task with the given task instance id.
 TaskAbstract getTaskAbstract(URI taskInstanceId, TaskAbstractCustomAttributesCriteria customAttributesCriteria)
          Returns an abstract of the task with the given task instance id.
 List<TaskAbstract> getTaskAbstracts(QueryResultParameters resultParameters, TaskAbstractFetchCriteria... fetchCriteria)
          Returns a list of TaskAbstracts either owned or substituted by the logged in user as specified by the given criteria.
 List<TaskAbstract> getTaskAbstractsByLogonID(String logonID, QueryResultParameters resultParameters, TaskAbstractQueryCriteria... queryCriteria)
          Returns a list of TaskAbstract for which the user with the given logonID is the task processor.
 Set<TaskAbstract> getTaskAbstractsByParent(URI processInstanceId, Set<Status> statuses)
          Returns the set of instances of TaskAbstract for a given process instance.
 Set<TaskAbstract> getTaskAbstractsForAllMySubstitutedUsers(Set<Status> statuses)
          Returns the set of instances of TaskAbstract the currently logged-in user is eligible to work on, because they is the substitute of at least one other user at the moment.
 Set<TaskAbstract> getTaskAbstractsForAllMySubstitutedUsers(Set<Status> statuses, QueryResultParameters resultParameters, TaskAbstractQueryCriteria... queryCriteria)
          Returns the set of instances of TaskAbstract for which the logged-in user have been substituted to work for at least one other user at the moment.
 Set<TaskAbstract> getTaskAbstractsForMySubstitutedUsers(IUser[] substitutedUsers, Set<Status> statuses)
          Returns the set of instances of TaskAbstract for which the logged-in user have been substituted to work for at least one other user at the moment.
 Set<TaskAbstract> getTaskAbstractsForMySubstitutedUsers(IUser[] substitutedUsers, Set<Status> statuses, QueryResultParameters resultParameters, TaskAbstractQueryCriteria... queryCriteria)
          Returns the set of instances of TaskAbstract for which the logged-in user have been substituted to work for at least one other user at the moment.
 int getTaskCountForAllMySubstitutedUsers(Set<Status> statuses)
          Returns the amount of tasks, which are visible for the currently logged-in user because of substitution rules (directly visible tasks will NOT be considered).
 int getTaskCountForMySubstitutedUsers(IUser[] substitutedUsers, Set<Status> statuses)
          Returns the amount of tasks, which are visible for the currently logged-in user because of substitution rules (directly visible tasks will NOT be considered).
 Map<URI,Map<IUser,Integer>> getTaskCountPerTaskModel(IUser[] users, TaskAbstractQueryCriteria... queryCriteria)
          For each TaskModelId it returns per requested user the amount of owned tasks.
 TaskDetail getTaskDetail(URI taskInstanceId)
          Returns the details of the task with the given task instance id.
 void nominate(URI taskInstanceId, IUser newOwner)
          Triggers the 'Nominate' task action.
 void release(URI taskInstanceId)
           Triggers the task action 'Release' (i.e. that the task is released by the actual owner and made available for all potential owners again).
 void setPriority(URI taskInstanceId, Priority prioriy)
          Sets the priority of the given task to a new value NOTE: Priority VERY_LOW is not supported and will result in an BPMIllegalArgumentException
 void start(URI taskInstanceId)
          Start the execution of the task, i.e. set the task to status InProgress.
 void stop(URI taskInstanceId)
          Stop the processing of the task.
 

Method Detail

claim

void claim(URI taskInstanceId)
           throws BPMException
Claim responsibility for the task, i.e. set the task to status Reserved and set the current user as the actual owner.

Parameters:
taskInstanceId - task identifier
Throws:
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalOperationException - if the operation does not apply to the task type
BPMTaskAlreadyClaimedByAnotherUserException - if the task is already claimed by another user
BPMException

start

void start(URI taskInstanceId)
           throws BPMException
Start the execution of the task, i.e. set the task to status InProgress.

Parameters:
taskInstanceId - task identifier
Throws:
BPMIllegalStateException - if the state is invalid
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalOperationException - if the operation does not apply to the task type
BPMException

stop

void stop(URI taskInstanceId)
          throws BPMException
Stop the processing of the task. The task returns to the Reserved state.

Parameters:
taskInstanceId - task identifier
Throws:
BPMIllegalStateException - if the state is invalid
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalOperationException - if the operation does not apply to the task type
BPMException

complete

void complete(URI taskInstanceId,
              commonj.sdo.DataObject taskOutputData)
              throws BPMException
Complete the processing of the task, i.e. set the task to status Completed.

Parameters:
taskInstanceId - task identifier
taskOutputData - the output data that will be used to complete the task.
It must be of a supported implementation (SAP) and matching type, otherwise the method will throw a BPMIllegalArgumentException.
Use TaskDetail.getOutputDataObject() to get a valid data object.
Throws:
BPMIllegalStateException - if the state is invalid
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalOperationException - if the operation does not apply to the task type
BPMException

complete

void complete(URI taskInstanceId,
              commonj.sdo.DataObject taskOutputData,
              CustomAction customAction)
              throws BPMException
Complete the processing of the task, i.e. set the task to status Completed with custom action.

Parameters:
taskInstanceId - task identifier
taskOutputData - the output data that will be used to complete the task.
It must be of a supported implementation (SAP) and matching type, otherwise the method will throw a BPMIllegalArgumentException.
Use TaskDetail.getOutputDataObject() to get a valid data object.
customAction - Custom action chosen to complete the task.
Throws:
BPMIllegalStateException - if the state is invalid
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalOperationException - if the operation does not apply to the task type
BPMException

claimAndComplete

void claimAndComplete(URI taskInstanceId,
                      commonj.sdo.DataObject taskOutputData,
                      CustomAction customAction)
                      throws BPMException
Claim responsibility for the task by setting the current user as the actual owner and then complete the processing of the task, i.e. set the task to status Completed with custom action.

Parameters:
taskInstanceId - task identifier
taskOutputData - the output data that will be used to complete the task.
It must be of a supported implementation (SAP) and matching type, otherwise the method will throw a BPMIllegalArgumentException.
Use TaskDetail.getOutputDataObject() to get a valid data object.
customAction - Custom action chosen to complete the task.
Throws:
BPMIllegalStateException - if the state is invalid
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalOperationException - if the operation does not apply to the task type
BPMTaskAlreadyClaimedByAnotherUserException - if the task is already claimed by another user
BPMException

getTaskDetail

TaskDetail getTaskDetail(URI taskInstanceId)
                         throws BPMException
Returns the details of the task with the given task instance id.

Parameters:
taskInstanceId - task identifier
Returns:
an instance of TaskDetail.
Throws:
BPMIllegalArgumentException - if an argument is invalid or if the task instance for the given URI does not exist.
BPMException

getTaskAbstract

TaskAbstract getTaskAbstract(URI taskInstanceId)
                             throws BPMException
Returns an abstract of the task with the given task instance id.

Parameters:
taskInstanceId - task identifier
Returns:
an instance of TaskAbstract.
Throws:
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalArgumentException - if an argument is invalid or if the task instance for the given URI does not exist.
BPMException

getTaskAbstract

TaskAbstract getTaskAbstract(URI taskInstanceId,
                             TaskAbstractCustomAttributesCriteria customAttributesCriteria)
                             throws BPMException
Returns an abstract of the task with the given task instance id.

Parameters:
taskInstanceId - task identifier
customAttributesCriteria - an instance of TaskAbstractCustomAttributesCriteria indicating Custom Attributes to be included
Returns:
an instance of TaskAbstract.
Throws:
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalArgumentException - if an argument is invalid or if the task instance for the given URI does not exist.
BPMException

getTaskAbstractsByLogonID

List<TaskAbstract> getTaskAbstractsByLogonID(String logonID,
                                             QueryResultParameters resultParameters,
                                             TaskAbstractQueryCriteria... queryCriteria)
                                             throws BPMException
Returns a list of TaskAbstract for which the user with the given logonID is the task processor. Returns an empty list if no tasks are found for the specified logonID.

Allows also to apply parameters to specify task statuses, parameters to sort the result and parameters to specify the exact chunk to be returned. This can also be used to provide paging for the returned tasks.

Please note: When applying the firstResult parameter to QueryResultParameters the returned result is stateless. This means the result may have skipped entries or it contains entries which were returned by a previous query with a different firstResult.

Example usage: To fetch a maximum of two tasks for a user, which are ready or in progress and are sorted based on their created time in ascending order, code would look similar to :

 String logonID = "Rahul";
 
 QueryResultParameters qrp = new QueryResultParameters();
 qrp.setFirstResult(0);
 qrp.setMaxResults(2);
 
 TaskAbstractStatusCriteria includeReadyTask = new TaskAbstractStatusCriteria(Status.READY);
 TaskAbstractStatusCriteria includeInProgressTask = new TaskAbstractStatusCriteria(Status.IN_PROGRESS);
 
 TaskAbstractAttribute attributeToSortOn = TaskAbstractAttribute.CREATED_TIME;
 boolean isAscending = true;
 TaskAbstractSortCriteria sortCriteria = new TaskAbstractSortCriteria(attributeToSortOn, isAscending);
 
 TaskInstanceManager taskInstanceManager = BPMFactory.getTaskInstanceManager();
 taskInstanceManager.getTaskAbstractByLogonID(logonID, qrp, includeReadyTask, includeInProgressTask, sortCriteria);
 

Parameters:
logonID - logon ID of the user whose tasks are to be fetched.
resultParameters - Optional set of parameters to specify result size and offset. May be null.
queryCriteria - Optional set of TaskAbstractQueryCriteria instances specifying query parameters to sort,to get custom attribute(s) value as part of TaskAbstract and to specify the statuses the returned tasks should be in. May be null. For sorting, see TaskAbstractSortCriteria for the supported attributes to sort on. To get custom attribute(s) value of TaskAbstract, use an instance of TaskAbstractCustomAttributesCriteria.To specify statuses, use an instance of TaskAbstractStatusCriteria.
Returns:
a list of TaskAbstract as returned by the underlying query.
Throws:
BPMIllegalArgumentException - if the passed logonID is null or empty
BPMIllegalAccessException - if the logged on user is not authorized to perform the operation
BPMException

getMyTaskAbstracts

Set<TaskAbstract> getMyTaskAbstracts(Set<Status> statuses)
                                     throws BPMException

Returns the set of instances of type TaskAbstract for the logged in user and for the specified task statuses. This method caters to the need of creating end user task lists. Hence, only tasks of which the logged in user is actual owner or potential owner (and no one else has claimed the task yet) are returned.

Note that the current implementation will not return any tasks in states Failed and Suspended.

Parameters:
statuses - Set of valid states the returned tasks should be in. Note that the states Failed and Suspended are not considered as valid states for end user task lists.
If null is provided as argument, the abstracts for the tasks in all valid states are returned.
Returns:
a set of instances of TaskAbstract
Throws:
BPMException - if the argument contains invalid states

getMyTaskAbstracts

List<TaskAbstract> getMyTaskAbstracts(Set<Status> statuses,
                                      QueryResultParameters resultParameters,
                                      TaskAbstractQueryCriteria... queryCriteria)
                                      throws BPMException
Returns the set of instances of TaskAbstract for the logged in user and for the specified task statuses. If null is provided as argument, the abstracts for the tasks with a valid status are returned.

Allows also to apply parameters to sort the result and parameters to specify the exact chunk to be returned. This can be used to provide paging for the returned tasks.

Please note: When applying the firstResult parameter to QueryResultParameters the returned result is stateless. This means the result may have skipped entries or contain entries which were returned by a previous query with a different firstResult.

Parameters:
statuses -
resultParameters - Optional set of parameters to specify result size and offset. May be null
queryCriteria - Optional set of TaskAbstractQueryCriteria instances specifying query parameters for sort and to get custom attribute(s) value as part of TaskAbstract. May be null. For sorting, see TaskAbstractSortCriteria for the supported attributes to sort on. To get custom attribute(s) value of TaskAbstract, use an instance of TaskAbstractCustomAttributesCriteria.
Returns:
a list of instances of {link TaskAbstract} as returned by the underlying query.
Throws:
BPMException

getTaskAbstractsByParent

Set<TaskAbstract> getTaskAbstractsByParent(URI processInstanceId,
                                           Set<Status> statuses)
                                           throws BPMException
Returns the set of instances of TaskAbstract for a given process instance. The results can be filtered by statuses and contains all tasks that are visible to him (e.g. as Task Administrator).

Parameters:
processInstanceId -
statuses - Set of Status instances specifying the statuses of tasks to be returned. If an empty set is passed, the query will implicitly return tasks for all statuses.
Returns:
Set of instances of TaskAbstract satisfying the input criteria.
Throws:
BPMException

getMyTaskAbstractsByParent

Set<TaskAbstract> getMyTaskAbstractsByParent(URI processInstanceId,
                                             Set<Status> statuses)
                                             throws BPMException
Returns the set of instances of TaskAbstract for a given process instance. The result can be filtered by statuses and it contains only the tasks the logged in user is potential or actual owner.

Parameters:
processInstanceId -
statuses - Set of Status instances specifying the statuses of tasks to be returned. If an empty set is passed, the query will implicitly return tasks for all statuses.
Returns:
Set of instances of TaskAbstract satisfying the input criteria.
Throws:
BPMException

getTaskAbstractsForMySubstitutedUsers

Set<TaskAbstract> getTaskAbstractsForMySubstitutedUsers(IUser[] substitutedUsers,
                                                        Set<Status> statuses,
                                                        QueryResultParameters resultParameters,
                                                        TaskAbstractQueryCriteria... queryCriteria)
                                                        throws BPMException
Returns the set of instances of TaskAbstract for which the logged-in user have been substituted to work for at least one other user at the moment.

Allows also to apply parameters to sort the result and parameters to specify the exact chunk to be returned. This can be used to provide paging for the returned tasks.

Please note: When applying the firstResult parameter to QueryResultParameters the returned result is stateless. This means the result may have skipped entries or contain entries which were returned by a previous query with a different firstResult.

Parameters:
statuses - Set of Status instances specifying the statuses of tasks to be returned.
resultParameters - Optional set of parameters to specify result size and offset. May be null
queryCriteria - Optional set of TaskAbstractQueryCriteria instances specifying query parameters for sort and to get custom attribute(s) value as part of TaskAbstract. May be null. For sorting, see TaskAbstractSortCriteria for the supported attributes to sort on. To get custom attribute(s) value of TaskAbstract, use an instance of TaskAbstractCustomAttributesCriteria.
substitutedUsers - list of users that should be checked for substitution
Returns:
Set of instances of TaskAbstract
Throws:
BPMException

getTaskAbstractsForAllMySubstitutedUsers

Set<TaskAbstract> getTaskAbstractsForAllMySubstitutedUsers(Set<Status> statuses,
                                                           QueryResultParameters resultParameters,
                                                           TaskAbstractQueryCriteria... queryCriteria)
                                                           throws BPMException
Returns the set of instances of TaskAbstract for which the logged-in user have been substituted to work for at least one other user at the moment.

Allows also to apply parameters to sort the result and parameters to specify the exact chunk to be returned. This can be used to provide paging for the returned tasks.

Please note: When applying the firstResult parameter to QueryResultParameters the returned result is stateless. This means the result may have skipped entries or contain entries which were returned by a previous query with a different firstResult.

Parameters:
statuses - Set of Status instances specifying the statuses of tasks to be returned.
resultParameters - Optional set of parameters to specify result size and offset. May be null
queryCriteria - Optional set of TaskAbstractQueryCriteria instances specifying query parameters for sort and to get custom attribute(s) value as part of TaskAbstract. May be null. For sorting, see TaskAbstractSortCriteria for the supported attributes to sort on. To get custom attribute(s) value of TaskAbstract, use an instance of TaskAbstractCustomAttributesCriteria.
Returns:
Set of instances of TaskAbstract
Throws:
BPMException

getTaskAbstractsForMySubstitutedUsers

Set<TaskAbstract> getTaskAbstractsForMySubstitutedUsers(IUser[] substitutedUsers,
                                                        Set<Status> statuses)
                                                        throws BPMException
Returns the set of instances of TaskAbstract for which the logged-in user have been substituted to work for at least one other user at the moment.

Parameters:
statuses - Set of Status instances specifying the statuses of tasks to be returned.
substitutedUsers - list of users that should be checked for substitution
Returns:
Set of instances of TaskAbstract
Throws:
BPMException

getTaskAbstractsForAllMySubstitutedUsers

Set<TaskAbstract> getTaskAbstractsForAllMySubstitutedUsers(Set<Status> statuses)
                                                           throws BPMException
Returns the set of instances of TaskAbstract the currently logged-in user is eligible to work on, because they is the substitute of at least one other user at the moment.

Parameters:
statuses - Set of Status instances specifying the statuses of tasks to be returned.
Returns:
Set of instances of TaskAbstract
Throws:
BPMException

fail

void fail(URI taskInstanceId,
          Fault fault)
          throws BPMException
Execution of the task fails and a fault is returned.

Parameters:
taskInstanceId - task identifier
fault - the Fault object representing the reason why the execution of the task has failed
Throws:
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalArgumentException - if an argument is invalid
BPMException

generateTaskExecutionUrl

URL generateTaskExecutionUrl(URI taskInstanceId)
                             throws BPMException
Generates the URL pointing to the default Task Execution UI for the specified task instance id.
The application property 'http.baseurl' will be used to determine the target server and port address.

Parameters:
taskInstanceId - task identifier
Returns:
the generated Task Execution UI URL
Throws:
BPMIllegalArgumentException - if an argument is invalid
BPMServiceException - if a backend issue occurs
BPMException

release

void release(URI taskInstanceId)
             throws BPMException

Triggers the task action 'Release' (i.e. that the task is released by the actual owner and made available for all potential owners again).

The implementation checks if the user that tries to release the task

  • is either the current actual owner and not one of the excluded owners
  • or is a Task Administrator

Parameters:
taskInstanceId - the task that should be released
Throws:
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalOperationException - if the operation does not apply to the task type
BPMException

setPriority

void setPriority(URI taskInstanceId,
                 Priority prioriy)
                 throws BPMException
Sets the priority of the given task to a new value NOTE: Priority VERY_LOW is not supported and will result in an BPMIllegalArgumentException

Parameters:
taskInstanceId - the task of which the priority should be changed
prioriy - the new priority level
Throws:
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalArgumentException - if an argument is invalid (e.g. if the priority is VERY_LOW)
BPMException

delegate

void delegate(URI taskInstanceId,
              IUser newOwner)
              throws BPMException

Triggers the 'Delegate' task action. Thereby, the delegating user is assigning the delegatee as the actual owner of this task. I.e. that the task will be assigned after successfully delegating the task.
The delegatee does not necessarily need to be a potential owner. If not so, the set of potential owners is enlarged with the delegatee.

The implementation checks if:

  • the delegating user is the actual owner (in case the task has already been assigned before)
  • the delegating user is a potential owner
  • neither the delegating user nor the delegatee is one of the excluded owners

Parameters:
taskInstanceId - the task that is to be delegated
newOwner - the user the task is delegated to
Throws:
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalOperationException - if the operation does not apply to the task type
BPMException

nominate

void nominate(URI taskInstanceId,
              IUser newOwner)
              throws BPMException
Triggers the 'Nominate' task action. Thereby, the administrator is assigning the nominated user as the actual owner of this task. I.e. that the task will be assigned after successfully nominating. The nominated user does not necessarily need to be a potential owner. If not so, the set of potential owners is enlarged with the nominated user.

Parameters:
newOwner - the user the task is nominated to
taskInstanceId - the task that is to be nominated
Throws:
BPMIllegalAccessException - if the user is not authorized to perform the operation
BPMIllegalArgumentException - if an argument is invalid
BPMIllegalOperationException - if the operation does not apply to the task type
BPMException

getMyTaskCount

int getMyTaskCount(Set<Status> statuses)
                   throws BPMException
Returns amount of all tasks, which are directly visible for the currently logged-in user (substitution rules will NOT be considered).

Parameters:
statuses - Set of Status instances specifying the statuses of tasks to be considered.
Following statuses are not supported: Status.FAILED and Status.SUSPENDED.
Returns:
task count
Throws:
BPMException

getTaskCountForMySubstitutedUsers

int getTaskCountForMySubstitutedUsers(IUser[] substitutedUsers,
                                      Set<Status> statuses)
                                      throws BPMException
Returns the amount of tasks, which are visible for the currently logged-in user because of substitution rules (directly visible tasks will NOT be considered).

Parameters:
substitutedUsers - list of users that should be checked for substitution
statuses - Set of Status instances specifying the statuses of tasks to be considered.
Following statuses are not supported: Status.FAILED and Status.SUSPENDED.
Returns:
task count
Throws:
BPMException

getTaskCountForAllMySubstitutedUsers

int getTaskCountForAllMySubstitutedUsers(Set<Status> statuses)
                                         throws BPMException
Returns the amount of tasks, which are visible for the currently logged-in user because of substitution rules (directly visible tasks will NOT be considered).

Parameters:
statuses - Set of Status instances specifying the statuses of tasks to be considered.
Following statuses are not supported: Status.FAILED and Status.SUSPENDED.
Returns:
task count
Throws:
BPMException

getTaskCountPerTaskModel

Map<URI,Map<IUser,Integer>> getTaskCountPerTaskModel(IUser[] users,
                                                     TaskAbstractQueryCriteria... queryCriteria)
                                                     throws BPMException
For each TaskModelId it returns per requested user the amount of owned tasks. Only tasks are considered for which the currently logged-on user is task administrator or process administrator of the parent process.

Example Usage : There are two users user1 and user2 who are working on task models, DefaultTask and TestTask, as follows:
user1 is working on two instances of DefaultTask and one instance of TestTask.
user2 is working on three instances of TestTask.

 
 IUser[] users = { user1, user2 };
 
 TaskAbstractStatusCriteria includeReadyTask = new TaskAbstractStatusCriteria(Status.READY);
 TaskAbstractStatusCriteria includeInProgressTask = new TaskAbstractStatusCriteria(Status.IN_PROGRESS);
 
 TaskAbstractModelCriteria includeDefaultTask = new TaskAbstractModelCriteria(taskModelIdForDefaultTask);
 TaskAbstractModelCriteria includeTestTask = new TaskAbstractModelCriteria(taskModelIdForTestTask);
 
 TaskInstanceManager taskInstanceManager = BPMFactory.getTaskInstanceManager();
 taskInstanceManger.getTaskCountPerTaskModel(users, includeReadyTask, includeInProgressTask, includeDefaultTask, includeTestTask);
 
 
It will return a map as follows :
TaskModelId User Count
defaultTaskModelId user1 2
testTaskModelId user1 1
user2 3

Parameters:
users - List of IUser for whom the count is required. This parameter must not be null.
queryCriteria - Optional set of TaskAbstractQueryCriteria instances specifying query parameters to specify the statuses and to specify the task model the returned tasks should be in . May be null. If null is provided specifically, empty sets of lifecycle and model Id are passed. For this API the supported query criteria are TaskAbstractStatusCriteria and TaskAbstractModelCriteria.To specify statuses, use an instance of TaskAbstractStatusCriteria. For specifying the task model id use an instance of TaskAbstractModelCriteria.
Returns:
For each TaskModelId it returns per requested user the amount of owned tasks. It returns an empty map if the user does not own tasks for the given task model id.
Throws:
BPMIllegalArgumentException - if the passed users is null or empty.
if any other query criteria is passed apart from TaskAbstractStatusCriteria or TaskAbstractModelCriteria.
BPMException

getNotes

List<Note> getNotes(URI taskInstanceId)
                    throws BPMException
Returns a list of Notes visible to the TaskAbstract

Parameters:
taskInstanceId - URI of a TaskAbstract
Returns:
A list of Notes that are visible to the TaskAbstract
Throws:
BPMIllegalAccessException - If the user is not authorized to perform the operation
BPMIllegalArgumentException - If task instance id is invalid
BPMException

getNote

Note getNote(URI noteId)
             throws BPMException
Returns a Note identified by the given URI

Parameters:
noteId - URI that uniquely identifies the Note
Returns:
A Note identified by the given URI
Throws:
BPMIllegalArgumentException - If note id is invalid
BPMException

addNote

URI addNote(URI taskInstanceId,
            String content,
            boolean isLocal)
            throws BPMException
Returns a unique identifier of the newly added Note
Adds a Note to the given TaskAbstract and returns a unique identifier of the Note.

Parameters:
taskInstanceId - URI of a TaskAbstract to add the Note
content - The content of the Note to add as String
isLocal - This parameter defines the visibility of the Note in the parent ProcessInstance.
A value true sets the visibility of the Note as local to the TaskAbstract where as a value false sets the visibility of the Note as visible to all TaskAbstracts of the parent ProcessInstance.
Returns:
A unique identifier of the newly added Note
Throws:
BPMIllegalAccessException - If the user is not authorized to perform the operation
BPMIllegalArgumentException - If task instance id is invalid
BPMException

getTaskAbstracts

List<TaskAbstract> getTaskAbstracts(QueryResultParameters resultParameters,
                                    TaskAbstractFetchCriteria... fetchCriteria)
                                    throws BPMException
Returns a list of TaskAbstracts either owned or substituted by the logged in user as specified by the given criteria.

An invoker of the method can influence the resulting list by providing a variable argument list of type TaskAbstractFetchCriteria:

TaskAbstractFetchCriteria Explanation
TaskAbstractOwnerCriteria Task Ownership: If specified, this method returns TaskAbstracts for which the logged in user is owner for. Cannot be used in conjunction with TaskAbstractSubstitutionCriteria
TaskAbstractSubstitutionCriteria Task Substitution: If specified, this method returns TaskAbstracts for which the logged in user is a substitute for. Cannot be used in conjunction with TaskAbstractOwnerCriteria
TaskAbstractFilterCriteria Filtering: To filter for particular attributes of a TaskAbstract
TaskAbstractSortCriteria Sorting: To sort the result
TaskAbstractCustomAttributesCriteria Custom Attributes: To get the value of custom attribute(s) of the TaskAbstract

Parameters:
resultParameters - Optional parameters to specify the result size and offset. null returns the full list.
fetchCriteria - Variable argument list of type TaskAbstractFetchCriteria specifying the criteria for fetching the results as described in the table above.
Returns:
A list of instances of TaskAbstract as returned by the underlying query.
Throws:
BPMIllegalArgumentException - In case the usage of the parameters of this method is incorrect. Refer to the Javadoc of the provided arguments.
BPMException - In case of any technical issue.

getAttachments

List<Attachment> getAttachments(URI taskInstanceId)
                                throws BPMException
Returns a list of Attachments visible to the TaskAbstract and its parent ProcessInstance

Parameters:
taskInstanceId - URI of a TaskAbstract
Returns:
A list of Attachments that are visible to the TaskAbstract and its parent ProcessInstance
Throws:
BPMIllegalAccessException - If the user is unauthorized to perform the operation
BPMIllegalArgumentException - If task instance id is invalid
BPMException

getAttachment

Attachment getAttachment(URI taskInstanceId,
                         URI attachmentId)
                         throws BPMException
Returns an Attachment identified by the given URI conforming following conditions
  • If attachment is local to the task instance, then taskInstanceId should be of same task to which attachment belongs to
  • If attachment is at process instance level then taskInstanceId and attachmentId must belong to same process instance
  • Logged on user should have access to task for which taskInstanceId has been passed

Parameters:
taskInstanceId - URI of a TaskAbstract
attachmentId - URI that uniquely identifies the Attachment
Returns:
An Attachment identified by the given URI
Throws:
BPMIllegalAccessException - If the user is unauthorized to perform the operation
BPMIllegalArgumentException - If attachment id is invalid
BPMException
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] BPEM-FACADE [sap.com] tc/bpem/facade/ear - BC-BMT-BPM-DSK
[sap.com] BPEM-FACADE [sap.com] tc/bpem/facade/ear api BC-BMT-BPM-DSK


Copyright 2015 SAP AG Complete Copyright Notice