Class PCTaskHelper

java.lang.Object
com.webmethods.caf.portalclient.task.PCTaskHelper

public class PCTaskHelper extends Object
Helper class which implements variety of TaskEngine API functions. This class is a simple wrapper on top of PortalClient API used to facilitate access to TaskEngine webServices port type. Prior using these API PortalClient needs to be initialized by calling one of its initialize(...) methods
  • Constructor Details

    • PCTaskHelper

      public PCTaskHelper()
  • Method Details

    • queueTask

      public static String queueTask(String user, String taskTypeID, TaskInfo taskInfo, Hashtable<String,?> taskData) throws Exception
      Queues new task to the TaskEngine
      Parameters:
      user - (optional) UserID on behalf of whom new task will be queued. If null, then portal client session context userID will be used
      taskTypeID - (required) task type ID as defined in the Task Application
      taskInfo - (optional) Additional generic information for the new task
      taskData - (optional) Additional business data for the new task
      Returns:
      newly created taskID if successful
      Throws:
      Exception
    • updateTask

      public static void updateTask(String user, String taskID, TaskInfo taskInfo, Hashtable<String,?> taskData) throws Exception
      Updates an existing task
      Parameters:
      user - (optional) UserID on behalf of whom task will be updated. If null, then portal client session context userID will be used
      taskID - (required) TaskID to be updated
      taskInfo - (optional) Generic task information to be set on the task
      taskData - (optional) Business data information to be set on the task
      Throws:
      Exception - if there is an error updating a task
    • deleteTask

      public static void deleteTask(String user, String taskID) throws Exception
      Deletes a task
      Parameters:
      user - (optional) UserID on behalf of whom task will be deleted. If null, then portal client session context userID will be used
      taskID - (required) TaskID to be deleted
      Throws:
      Exception - if there is an error deleting a task
    • getTask

      public static Task getTask(String user, String taskID, boolean includeTaskData) throws Exception
      Fetches task by its ID
      Parameters:
      user - (optional) UserID on behalf of whom task will be fetched. If null, then portal client session context userID will be used
      taskID - (required) TaskID to get
      includeTaskData - whether result should include task business data
      Returns:
      Task filled with task generic info and task business data (if requested)
      Throws:
      Exception - if there is a problem getting task
    • searchAllTasks

      public static Task[] searchAllTasks(String user, TaskSearchQuery taskSearchQuery, boolean includeTaskData) throws Exception
      Searches all tasks
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      includeTaskData - whether result should include task business data
      Returns:
      list of matched tasks
      Throws:
      Exception - if there is a problem searching for tasks
    • searchUserTasks

      public static Task[] searchUserTasks(String user, TaskSearchQuery taskSearchQuery, boolean includeTaskData) throws Exception
      Searches user inbox tasks
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      includeTaskData - whether result should include task business data
      Returns:
      list of matched tasks
      Throws:
      Exception - if there is a problem searching for tasks
    • searchFieldsAllTasks

      public static TaskFields[] searchFieldsAllTasks(String user, TaskSearchQuery taskSearchQuery, boolean includeTaskData, String[] fields) throws Exception
      Searches all tasks
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      includeTaskData - whether result should include task business data
      Returns:
      list of matched tasks
      Throws:
      Exception - if there is a problem searching for tasks
    • searchFieldsUserTasks

      public static TaskFields[] searchFieldsUserTasks(String user, TaskSearchQuery taskSearchQuery, boolean includeTaskData, String[] fields) throws Exception
      Searches user inbox tasks
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      includeTaskData - whether result should include task business data
      Returns:
      list of matched tasks
      Throws:
      Exception - if there is a problem searching for tasks
    • searchAllTasksIndexed

      public static Task[] searchAllTasksIndexed(String user, TaskSearchQueryV2 taskSearchQuery, boolean businessData) throws Exception
      Searches all tasks with paging
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      includeTaskData - whether result should include task business data
      Returns:
      list of matched tasks
      Throws:
      Exception - if there is a problem searching for tasks
    • countAllTasksIndexed

      public static int countAllTasksIndexed(String user, TaskSearchQueryV2 taskSearchQuery, boolean businessData) throws Exception
      Return the total result count for a task search against all tasks
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      businessData - Specify true if the task search query requires examination of task business data
      Returns:
      the number of tasks that would be returned by the user inbox task search
      Throws:
      Exception - if there is a problem searching for tasks
    • searchUserTasksIndexed

      public static Task[] searchUserTasksIndexed(String user, TaskSearchQueryV2 taskSearchQuery, boolean businessData) throws Exception
      Return a subset of user inbox search results.
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      includeTaskData - whether result should include task business data
      Returns:
      list of matched tasks
      Throws:
      Exception - if there is a problem searching for tasks
    • countUserTasksIndexed

      public static int countUserTasksIndexed(String user, TaskSearchQueryV2 taskSearchQuery, boolean businessData) throws Exception
      Return the total result count for a user inbox task search
      Parameters:
      user - (optional) UserID on behalf of whom tasks will be searched. If null, then portal client session context userID will be used
      taskSearchQuery - (optional) task search query. If null all tasks will be returned
      businessData - Specify true if the task search query requires examination of task business data
      Returns:
      the number of tasks that would be returned by the user inbox task search
      Throws:
      Exception - if there is a problem searching for tasks
    • formFlowTaskNotify

      public static void formFlowTaskNotify(String correlationID, String result, boolean localOnly) throws Exception
      Notify a task flow that a transition has occured
      Parameters:
      correctionID - the unique identifier of the form flow
      result - the result string to return to the task flow, usually the URL that the flow should navigate to next
      localOnly - only notify the local machine, do not sent notification events to other nodes in the MWS cluster
      Throws:
      Exception
    • setInstancesStatus

      public static String[] setInstancesStatus(String user, String taskTypeId, String status, Boolean logInFile, Integer batchSize) throws Exception
      Updates all instances status for specific task type
      Parameters:
      user - (required) UserID on behalf of whom task will be updated. If null, then portal client session context userID will be used
      taskTypeId - (required) taskTypeId which instances to be updated
      status - (required) new status
      logInFile - (optional) whether result should be logged in file or returned as response
      batchSize - (optional) the total number of tasks instances that will be processed together
      Throws:
      Exception - if there is an error updating all tasks status
    • startVoteRecalculation

      public static void startVoteRecalculation(String user, String taskTypeID) throws Exception
      Recalculates voting strategy for given task type and attempts a status transition where needed for each task instance of said type
      Parameters:
      user - (required) UserID on behalf of whom task will be updated. If null, then portal client session context userID will be used
      taskTypeId - (required) taskTypeId which Task Type to be recalculated
      Throws:
      Exception - if there is an error during recalculation
    • stopVoteRecalculation

      public static void stopVoteRecalculation(String user, String taskTypeID) throws Exception
      Cancels the ongoing voting strategy recalculation for a given task type
      Parameters:
      user - (required) UserID on behalf of whom task will be updated. If null, then portal client session context userID will be used
      taskTypeID - (required) taskTypeId which Task Type to be recalculated
      Throws:
      Exception
    • voteTask

      public static void voteTask(String taskID, String status, String user)
      Vote with a specific status for a certain task.
      Parameters:
      taskID -
      status -
      user -
    • getRecalculationStatus

      public static RecalculationStatus getRecalculationStatus(String taskTypeId) throws Exception
      Retrieve Recalculation status of task type
      Parameters:
      taskTypeId - (required) taskTypeId which instances to be updated
      Throws:
      Exception - if there is an error during information gathering