I've a requirement where user can set the vacation period and rules. When the vacation period starts, all the tasks already assigned to him should get REASSIGNED AUTOMATICALLY to the other user that we configured in the vacation rule. How can I achieve this? Please suggest me some ideas.
Vacation rules are enforced on a point-forward basis. Have the user finish their assigned work before going on vacation or reassign the tasks manually.
You could write some logic to search for all these instances assigned to that particular user and reassign them to another user; however, I'm not sure there is a hook available in the Workspace from which to call this logic.
Thanks for your reply Bill. I am trying to execute my own logic to reassign the tasks manually.
I am creating a new task flow where user enters the userId to which the task will be reassigned. When user clicks the 'Submit' button, calling the below code. Here I need to pass the userName and pwd of the logged in user to get the IWorkflowContext. Is there a way to avoid passing the pwd in the code. How can I get the IWorkFlowContext without passing userName/pwd.
//Login as jstein
IWorkflowContext ctx = querySvc.authenticate("user1","welcome1".toCharArray(),null);
List queryColumns = new ArrayList();
//Query a list of tasks assigned to jstein
List tasks = querySvc.queryTasks(ctx,
null, //Do not query additional info
null, //No keywords
null, //No custom predicate
null, //No special ordering
0, //Do not page the query result
//Get the task service
ITaskService taskSvc = wfSvcClient.getTaskService();
//Loop over the tasks, outputting task information, and approving any
//tasks whose outcome has not been set...
for(int i = 0 ; i < tasks.size() ; i ++)
Task task = (Task)tasks.get(i);
int taskNumber = task.getSystemAttributes().getTaskNumber();
String title = task.getTitle();
String taskId = task.getSystemAttributes().getTaskId();
String outcome = task.getSystemAttributes().getOutcome();
List assignees = new ArrayList();
taskSvc.reassignTask(ctx, taskId, assignees) ;
System.out.println("============================== After reassigning the task ==================================");
System.out.println("Task #"+taskNumber+" ("+title+") is "+outcome);
Instead of getting a handle on IWorkflowServiceClient, look at oracle.bpm.client.BPMServiceClientFactory. There is a service called IBPMUserAuthenticationService that has a getBPMContextForAuthenticatedUser() method. This will give you a BPMContext for the logged in user. Then, you should be able to do anything task access permits.