0 Replies Latest reply on Aug 25, 2010 7:06 PM by Sam Juvonen

    Best approach to add Task interaction processes using BeanShell in ExcecuteScript operation

    Sam Juvonen Level 1

      I am wondering if the following is the best way (thinking not) to accomplish the goal of determining the possible routes from a Task (Task ID is known) using BeanShell in the ExecuteScript operation in a short-lived LC process (taken from API docs and tweaked slightly).  The code does work, this is just a question of what would be optimal to build similar processes that can reach into more details.  I would like to know the best practice before building more such processes.

       

      import java.util.*;

      import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
      import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
      import com.adobe.idp.taskmanager.dsc.client.query.TaskRow;
      import com.adobe.idp.taskmanager.dsc.client.query.TaskSearchFilter;
      import com.adobe.idp.taskmanager.dsc.client.task.ParticipantInfo;
      import com.adobe.idp.taskmanager.dsc.client.task.TaskInfo;
      import com.adobe.idp.taskmanager.dsc.client.task.TaskManager;
      import com.adobe.idp.taskmanager.dsc.client.*;
      import com.adobe.idp.um.api.infomodel.Principal;
      import com.adobe.livecycle.usermanager.client.DirectoryManagerServiceClient;
      import java.util.List;

       

      Properties connectionProps = new Properties();
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://servername:1099");
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceC lientFactoryProperties.DSC_EJB_PROTOCOL);         
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
      connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
                   
      ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
      TaskManagerQueryService queryManager = TaskManagerClientFactory.getQueryManager(myFactory);
      TaskManager taskManager = TaskManagerClientFactory.getTaskManager(myFactory);

      long taskId = patExecContext.getProcessDataLongValue("/process_data/@taskId");
      TaskInfo taskInfo= taskManager.getTaskInfo(taskId);

      String [] routeNames = taskInfo.getRouteList();
      List routeNameList = patExecContext.getProcessDataListValue("/process_data/routes");

      for (int i=0; i<routeNames.length; i++) {
          String currentRouteName=(String)routeNames[i];
          routeNameList.add(currentRouteName);
      }

      patExecContext.setProcessDataListValue("/process_data/routes",routeNameList);