Informatica ActiveVOS
- Informatica ActiveVOS 9.2.6
- All Products
import com.activevos.api.humantask.AeB4PTaskClientTaskOperations; import com.activevos.api.humantask.TaskOperations; import com.activevos.api.humantask.wsht.htda.TGenericHumanRoleType; import com.activevos.api.humantask.wsht.htda.TStatus; import com.activevos.api.humantask.wsht.htda.TTask; import java.util.ArrayList; import java.util.List; import javax.xml.ws.BindingProvider; // Define endpoint, username and password String serviceUrl = "http://localhost:8080/active-bpel/services/AeB4PTaskClient-taskOperations"; String username = "loanrep1"; String password = "loanrep1"; // Create service and get service port. AeB4PTaskClientTaskOperations wshtService = new AeB4PTaskClientTaskOperations(); TaskOperations wshtServicePort = wshtService.getAeB4PTaskClientTaskOperationsPort(); // Set request properties such as binding endpoint and BASIC credentials. ((BindingProvider)wshtServicePort).getRequestContext(). put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceUrl); ((BindingProvider)wshtServicePort).getRequestContext(). put(BindingProvider.USERNAME_PROPERTY, username); ((BindingProvider)wshtServicePort).getRequestContext(). put(BindingProvider.PASSWORD_PROPERTY, password); // Task type. In this case we are looking for the tasks (and not notifications). // In general, the taskType is 'TASKS' for all cases unless you want notifications // in the response. For notifications, use the value 'NOTIFICATIONS'. If you want // tasks and notifications, use 'ALL'. String taskType = "TASKS"; // Set role to be potential owners. That is, tasks that are available // to potential owners. TGenericHumanRoleType role = TGenericHumanRoleType.POTENTIAL_OWNERS; // workQueue - not used. String workQueue = null; // Task status - this is one of the main filters we use to narrow down the // resultset. Unclaimed tasks have a status of 'READY'. // Some other common status enumerations are claimed (RESERVED), // started (IN_PROGRESS), failed (FAILED), and completed (COMPLETED). List<TStatus> statuses = new ArrayList<TStatus>(); statuses.add(TStatus.READY); // READY = 'unclaimed'. // whereClause - not used. String where = null; // createdOn - not used. String createdOnClause = null; // maximum number of tasks to be returned in the resultset. int maxtasks = 5; // Call getMyTasks List<TTask> tasks = wshtServicePort.getMyTasks(taskType, role, workQueue, statuses, where, createdOnClause, maxtasks); // Note: TTask is of complex type tTask defined in ws-humantask-api-wsdl.xsd schema. int count = tasks.size(); System.out.println("Number of tasks: " + count); if ( count == 0 ) { // No tasks. Normally, this happens if: // - The username (defined in PRINCIPAL_USERNAME) does not have access to any tasks // - There are no unclaimed tasks (that is, tasks with status = READY). return; } // // Get 1st task in the list and print some information. // TTask task = tasks.get(0); // The taskId is unique and normally takes for form "urn:b4p:NNN" where NNN is some number // (usually representing the process id that implements the task on the ActiveVOS server). // The taskId is required for all task related operations. String taskId = task.getId(); System.out.println("TaskID: " + taskId); // print some additional information: System.out.println("Name: " + task.getName());// task QName System.out.println("PresentationName: " + task.getPresentationName()); System.out.println("PresentationSubject: " + task.getPresentationSubject()); // Expected value is READY (unclaimed). System.out.println("Status: " + task.getStatus().toString());