ALBPM Process API (PAPI)

fuego.papi
Interface ProcessServiceSession

All Superinterfaces:
ProcessServiceNESession, Serializable

public interface ProcessServiceSession
extends ProcessServiceNESession

ProcessServiceSession contains methods to store presentation and views, to add attachments and notes, and to process activities and instances. Methods for creating views and presentations as well as methods for getting activities, attachments, instances, notes, and processes are in ProcessServiceNESession.

Example:

        // Creates the ProcessService.
        ProcessService processService = ProcessService.create(...);

        // Creates the passport which will connect the user.
        ConnectionPassport passport = processService.createPassport("userId);

        // Sets the password of the user.
        passport.setPassword("userPassport");

        // Creates a new session with the passport and the user's host.
        ProcessServiceSession session = processService.createSession(passport, "userHost");
 


Method Summary
 void abortActivity(String instanceId, String activityName, int taskIn)
          Locates instance identified by instanceId in activity activityName and aborts the running task identified by taskIn.
 void addBookmarks(InstanceStamp[] instancesStamp)
          Adds bookmarks.
 void checkInAttachment(Attachment attachment, String remarks, File file)
          Checks in an attachment.
If successful, this will always generate a new attachment version.
 void checkOutAttachment(Attachment attachment, String directory)
          Writes the attachment to the specified directory.
 void checkOutAttachmentToStream(Attachment attachment, OutputStream stream)
          Writes the attachment to the specified output stream.
 InstanceInfo commitExternalActivity(String instanceStampId, int taskIn, Arguments args)
          Executes the commit method of an external activity using the specified InstanceStampId and task identification number.
 InstanceInfo commitExternalActivity(String instanceId, String activityName, Arguments args)
          Executes the commit method of the main task of an external activity using the specified instanceId and activityId.
 InstanceInfo commitExternalActivity(String instanceId, String activityName, int taskIn, Arguments args)
          Executes the commit method of an external activity using the specified instanceId, activityId, and task identification number.
 TaskExecution customRunActivity(String instanceId, String activityName, Arguments args)
          Executes the main task for this instance using an instanceId and activityId.
Allows a PAPI client to customize client-side invocations.
 TaskExecution customRunActivity(String instanceId, String activityName, int taskIn, Arguments args)
          Executes the task for this instance using an instanceId, activityId, and task identification number.
Allows a PAPI client to customize client-side invocations.
 TaskExecution customRunGlobal(String instanceId, String activityName, Arguments args)
          Executes the specified Global Activity for this instance using an instanceId and activityName.
Allows a PAPI client to customize client-side invocations.
 TaskExecution customRunTask(String instanceStampId, int taskIn, Arguments args)
          Executes the specified task for this instance using an instanceStampId and task identification number.
Allows a PAPI client to customize client-side invocations.
 TaskExecution customRunTask(String instanceId, String activityName, int taskIn, Arguments args)
          Deprecated. use customRunActivity(String,String,int,Arguments) instead
 List getDelegateParticipants(InstanceStamp instance)
          Gets a list of participants that this instance can be delegated to.
 List getEscalateParticipants(InstanceStamp instance)
          Gets a list of participants that this instance can be escalated to.
 InstanceInfo[] getGrabbableInstances(String activityId)
          Returns all the instances that can be grabbed from the activity specified by the activity ID.
 List getParticipantsForInstance(InstanceStamp instance)
          Gets a list of Participants that are in the role specified by the activity in the InstanceStamp.
 void instanceAttach(InstanceInfo instanceInfo, String name, String description, String remarks, File file)
          Attaches a file attachment to this process instance.
 void instanceAttach(InstanceInfo instanceInfo, String name, String description, String remarks, File file, String contentType)
          Attaches a file with the specified content type to this process instance.
 boolean instanceCanBeAborted(InstanceInfo instance)
          Returns true if the instance can be aborted.
 boolean instanceCanBeBack(InstanceInfo instance)
          Returns true if the instance can be routed back.
 boolean instanceCanBeDelegate(InstanceInfo instance)
          Returns true if the instance can be delegated.
 boolean instanceCanBeEscalate(InstanceInfo instance)
          Returns true if this instance can be escalated.
 boolean instanceCanBeProcessed(InstanceInfo instance)
          Returns true if the instance can be processed.
 boolean instanceCanBeReassign(InstanceInfo instance)
          Returns true if the instance can be reassigned.
 boolean instanceCanBeReassignedToPeer(InstanceInfo instance)
          Returns true if this instance can be reassigned to a peer.
 boolean instanceCanBeResumed(InstanceInfo instance)
          Returns true if the instance can be resumed.
 boolean instanceCanBeSelected(InstanceInfo instance)
          Returns true if the instance can be selected by the current participant.
 boolean instanceCanBeSent(InstanceInfo instance)
          Returns true if the instance can be sent.
 boolean instanceCanBeSuspended(InstanceInfo instance)
          Returns true if the instance can be suspended.
 boolean instanceCanBeUngrabbed(InstanceInfo instance)
          Returns true if the instance can be ungrabbed.
 boolean instanceCanBeUnselected(InstanceInfo instance)
          Returns true if the instance can be unselected by the current participant

An instance can be unselected if the instance is currently selected by the participant

 void instanceReassign(InstanceStamp instance, String participantId)
          Reassigns the instance to the specified participant.
 void instancesAbort(InstanceStamp[] instances)
          Aborts the specified instances.
 void instancesAddConsult(InstanceStamp[] instances, String remark, String toParticipant)
          Adds consultations for the specified instances for the specified participant.
 void instancesAddNote(InstanceStamp[] instances, String note)
          Adds a note to the specified instances.
 List instancesGetTargetActivities(InstanceStamp[] instances)
          Returns the activities that can receive the specified group of instances.
 Map instancesGetTargetParticipantsForActivity(InstanceStamp[] instances, String activityName, String filter, int max)
          Returns the participants who can receive the specified group of instances in the specified activity.
 void instancesGrab(InstanceStamp[] instances, String grabActivityName)
          Grabs a group of instances by the specified activity.
 void instancesResume(InstanceStamp[] instances)
          Resumes a group of instances.
 void instancesSelect(InstanceStamp[] instances)
          Selects a group of instances by the current participant.
 void instancesSend(InstanceStamp[] instances)
          Sends a group of instances.
 void instancesSendBack(InstanceStamp[] instances, boolean skip)
          Sends back a group of instances.
 void instancesSendTo(InstanceStamp[] instances, String activityName)
          Routes a group of instances to the specified activity.
 void instancesSendTo(InstanceStamp[] instances, String activityName, String participant)
          Routes a group of instances to the specified activity and participant.
 void instancesSuspend(InstanceStamp[] instances)
          Suspends a group of instances.
 ParticipantsForActivities instancesTargetParticipants(InstanceStamp[] instances)
          Returns the participants who can receive this array of instances.
 void instancesUngrab(InstanceStamp[] instances)
          Ungrabs a group of instances.
 void instancesUnselect(InstanceStamp[] instances)
          Unselects a group of instances.
 boolean isChangeParticipantPasswordSupported()
          Returns true if the directory supports changing the participant password.
 boolean isExclusive()
          Deprecated. now all sessions are not exclusive
 void obtainEditionLock(Attachment attachment)
          Obtains a version lock for the attachment.
 Arguments prepareExternalActivity(String instanceStampId, int taskIn, Arguments args)
          Executes the prepare method of an external activity for the task given an instanceStampId and task identification number.
 Arguments prepareExternalActivity(String instanceId, String activityName, Arguments args)
          Executes the prepare method for the main task of the activity given an instanceId and an activityId.
 Arguments prepareExternalActivity(String instanceId, String activityName, int taskIn, Arguments args)
          Executes the prepare method for the specified task of the activity given an instanceId, activityId, and task identification number.
 void releaseEditionLock(Attachment attachment)
          Releases the version lock for the attachment.
 void releaseEditionLock(Attachment attachment, File file)
          Releases the version lock for the attachment and deletes the specified file.
 void removeBookmarks(InstanceStamp[] instancesStamp)
          Removes bookmarks.
 void removePresentation(String presentationId)
          Removes the presentation specified by presentationId.
 void removeView(String viewId)
          Removes the view specified by viewId.
 InstanceInfo runActivity(String instanceStampId, Arguments args)
          Executes the main task for the instance given an instanceStampId.
 InstanceInfo runActivity(String instanceStampId, int taskIn, Arguments args)
          Executes the specified task for this instance given an instanceStampId and a task identification number.
 InstanceInfo runActivity(String instanceId, String activityName, Arguments args)
          Executes the main task for the instance given an instanceId and activity name.
 InstanceInfo runActivity(String instanceId, String activityName, int taskIn, Arguments args)
          Executes the specified Task for this instance given an instanceId, activity name, and task identification number.
 InstanceInfo runGlobal(String instanceId, String activityName, Arguments args)
          Runs a global activity.
 void runTask(String instanceStampId, int taskIn, Arguments args)
          Deprecated. use runActivity(String,int,Arguments) instead
 void runTask(String instanceId, String activityName, int taskIn, Arguments args)
          Deprecated. use runActivity(String, String, int, Arguments) instead
 void setCanReceiveMail(boolean canReceiveMail)
          Sets whether or not the user can receive mail.
 void storePresentation(Presentation presentation)
          Stores a presentation.
 void storeUserProperties(String category, Map properties)
          Stores user properties with the same behavior as ProcessServiceNESession.storeUserProperties.
 void storeView(View view)
          Stores the specified view.
 boolean taskCanBeProcessed(InstanceInfo instance, int taskNumber)
          Returns true if the specified task for this instance can be executed by the current participant.
 boolean taskCanBeSelected(InstanceInfo instance, int taskNumber)
          Returns true if the specified task for this instance can be selected by the current participant.
 boolean taskCanBeUnselected(InstanceInfo instance, int taskNumber)
          Returns true if the specified task for this instance can be unselected by the current participant.
 void tasksSelect(String instanceId, String activityName, int[] taskNumbers)
          Selects the instance.
 void tasksUnselect(String instanceId, String activityName, int[] taskNumbers)
          Unselects the instance.
 String toString()
          Returns the name of the class.
 void updateUserPassword(String oldPassword, String newPassword)
          Updates the user password.
 
Methods inherited from interface fuego.papi.ProcessServiceNESession
addHistories, clonePresentation, close, createPresentation, createProcessInstance, createProcessInstance, createView, customRunGlobalActivity, getActiveProcessId, getActiveProcessIdsByView, getActivityDocumentation, getActivityForView, getAllProcessVersions, getApplicationsByView, getAttachment, getAttachmentLastVersion, getAttachmentsByInstance, getAttachmentsByView, getAttachmentVersions, getBookmarks, getCalendar, getChildrenViews, getConsult, getConsults, getDefaultPresentation, getEditableView, getGlobalActivities, getGlobalActivities, getGlobalActivities, getGlobalActivities, getGrabActivitiesForInstance, getHost, getInstance, getInstance, getInstanceByCorrelation, getInstanceData, getInstanceEvents, getInstanceNotes, getInstances, getInstancesByFilter, getInstancesByView, getLocale, getNote, getNotes, getOrganization, getParentView, getParentViewId, getParticipant, getParticipant, getPresentation, getPresentation, getPresentationIds, getProcess, getProcess, getProcessDiagram, getProcessDiagram, getProcessDiagram, getProcessDocumentation, getProcesses, getProcesses, getProcessId, getProcessId, getProcessIds, getProcessIds, getProcessImage, getProcessIn, getSecureEngines, getTimeZone, getUserLocale, getUserTimeZone, getVar, getVars, getView, getViewIds, getVisibleActivities, getWorkingAttachments, hasNewInstances, hasNewInstances, instanceHasAttachments, instanceHasNotes, isOpened, refresh, retrieveRoleProperties, retrieveUserProperties, retrieveUserStringProperty, runGlobalActivity, runGlobalActivity, runProcess, searchParticipantsByName, sendNotification, sendNotification, sendNotification, sendNotification, setDefaultOrderByForViews, setLocale, setTimeZone, updateUserLocale, updateUserTimeZone
 

Method Detail

instanceCanBeDelegate

public boolean instanceCanBeDelegate(InstanceInfo instance)
Returns true if the instance can be delegated.

An instance can be delegated if the interactive activity has been defined as reassignable in Studio and the participant has been given permission to delegate in Process Administrator.

Parameters:
instance - InstanceInfo to check if the instance can be delegated
Returns:
true if the instance can be delegated

instanceCanBeEscalate

public boolean instanceCanBeEscalate(InstanceInfo instance)
Returns true if this instance can be escalated.

An instance can be escalated if the interactive activity has been defined as reassignable in Studio and the participant has been given permission to escalate in Process Administrator.

Parameters:
instance - InstanceInfo to check if the instance can be escalated
Returns:
true if the instance can be escalated

instanceCanBeReassignedToPeer

public boolean instanceCanBeReassignedToPeer(InstanceInfo instance)
Returns true if this instance can be reassigned to a peer.

An instance can be reassigned to a peer if the interactive activity has been defined as reassignable in Studio and the participant has been given permission for peer assignment in Process Administrator.

Parameters:
instance - InstanceInfo to check if the instance can be reassigned to a peer
Returns:
true if the instance can be reassigned to a peer

instancesGetTargetActivities

public List instancesGetTargetActivities(InstanceStamp[] instances)
                                  throws BatchOperationException
Returns the activities that can receive the specified group of instances.

Parameters:
instances - array of InstanceStamp with the instances to be queried
Returns:
list of activity names where the specified groups of instances can be sent
Throws:
BatchOperationException - if the session could not perform the operation for each instance
May be one of the following subclasses of BatchOperationException:

instancesGetTargetParticipantsForActivity

public Map instancesGetTargetParticipantsForActivity(InstanceStamp[] instances,
                                                     String activityName,
                                                     String filter,
                                                     int max)
                                              throws OperationException,
                                                     MaxSizeParticipantsExceededException,
                                                     NoParticipantMatchesRole
Returns the participants who can receive the specified group of instances in the specified activity.

Parameters:
instances - array of InstanceStamp with the instances to be queried
activityName - the activity name for the activity where the instance will be sent
filter - the pattern to execute the search for the participants
max - maximum number of participants to be returned; if it is exceeded, MaxSizeParticipantsExceededException will be thrown
Returns:
map with the Participant ID as key and the Participant as value
Throws:
OperationException - if the session could not perform the operation
May be one of the following subclasses of OperationException:
MaxSizeParticipantsExceededException - if the maximum number of participants is exceeded
NoParticipantMatchesRole - if there are not participants assigned to the role of the activity

setCanReceiveMail

public void setCanReceiveMail(boolean canReceiveMail)
                       throws OperationException
Sets whether or not the user can receive mail.

Parameters:
canReceiveMail - true if the user can receive mail
Throws:
OperationException

isChangeParticipantPasswordSupported

public boolean isChangeParticipantPasswordSupported()
Returns true if the directory supports changing the participant password.

Returns:
true if the directory supports changing the participant password

getDelegateParticipants

public List getDelegateParticipants(InstanceStamp instance)
                             throws OperationException,
                                    BatchOperationException
Gets a list of participants that this instance can be delegated to.

An instance can only be assigned if the interactive acitivity has been defined as assignable in Studio and only participants who have been given permission to delegate in Process Administrator can assign instances to participants with a lower category in the same role. Role category is also assigned in Process Administrator.

Parameters:
instance - InstanceStamp to get the list of participants; cannot be null
Returns:
list of participants that this instance can be delegated to or an empty list if there are no participants that this instance can be delegated to
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:
BatchOperationException - if the session could not perform the operation on the instance
May be one of the following subclasses of BatchOperationException:

getEscalateParticipants

public List getEscalateParticipants(InstanceStamp instance)
                             throws OperationException,
                                    BatchOperationException
Gets a list of participants that this instance can be escalated to.

An instance can only be assigned if the interactive acitivity has been defined as assignable in Studio and only participants who have been given permission to escalate in Process Administrator can assign instances to participants with a higher category in the same role. Role category is also assigned in Process Administrator.

Parameters:
instance - InstanceStamp to get the list of participants; cannot be null
Returns:
list of participants that this instance can be escalated to or an empty list if there are no participants that this instance can be escalated to
Throws:
OperationException - if the session could not perform the operation
May be one of the following subclasses of OperationException:
BatchOperationException - if the session could not perform the operation on the instance
May be one of the following subclasses of BatchOperationException:

isExclusive

public boolean isExclusive()
Deprecated. now all sessions are not exclusive

Always returns false.

Specified by:
isExclusive in interface ProcessServiceNESession

getGrabbableInstances

public InstanceInfo[] getGrabbableInstances(String activityId)
                                     throws OperationException,
                                            BatchOperationException
Returns all the instances that can be grabbed from the activity specified by the activity ID.

The complete activity ID or the consolidated activity ID can be used.

Complete activity ID => /OrganizationalUnit/ProcessName#Variation-Mayor.minor/ActivityName
Consolidated activity ID => /OrganizationalUnit/ProcessName/ActivityName

Parameters:
activityId - ID of the grab activity; cannot be null
Returns:
instances that can be grabbed from the activity specified by activityId or a zero-length array if there are no grabbable instances
Throws:
OperationException - if the session could not perform the operation
May be one of the following subclasses of OperationException:
BatchOperationException - if the session could not perform the operation on every activity
May be one of the following subclasses of BatchOperationException:

getParticipantsForInstance

public List getParticipantsForInstance(InstanceStamp instance)
                                throws OperationException,
                                       BatchOperationException
Gets a list of Participants that are in the role specified by the activity in the InstanceStamp.

Parameters:
instance - InstanceStamp to get the list of participants; cannot be null
Returns:
list of participants that are in the role specified by the activity in the InstanceStamp or an empty list if there are no matching participants
Throws:
OperationException - if the session could not perform the operation
May be one of the following subclasses of OperationException:
BatchOperationException - if the session could not perform the operation on the instance
May be one of the following subclasses of BatchOperationException:

addBookmarks

public void addBookmarks(InstanceStamp[] instancesStamp)
                  throws OperationException
Adds bookmarks.

Parameters:
instancesStamp - array of InstanceStamps; a bookmark will be added for each InstanceStamp; cannot be null.
Throws:
OperationException - if the session could not bookmark the instances

checkInAttachment

public void checkInAttachment(Attachment attachment,
                              String remarks,
                              File file)
                       throws OperationException
Checks in an attachment.
If successful, this will always generate a new attachment version.

Parameters:
attachment - the attachment to check in; cannot be null
remarks - version-specific remarks to add to the attachment; cannot be null; the maximum length of remarks is Attachment.REMARK_LENGTH
file - file to check in for the new attachment version; cannot be null
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

checkOutAttachment

public void checkOutAttachment(Attachment attachment,
                               String directory)
                        throws OperationException
Writes the attachment to the specified directory.

To check out the attachment, first call obtainEditionLock(Attachment).

Parameters:
attachment - attachment to write; cannot be null
directory - directory where the file will be written; this directory must already exist; if this is a relative directory, it is relative to where the PAPI program is running
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

checkOutAttachmentToStream

public void checkOutAttachmentToStream(Attachment attachment,
                                       OutputStream stream)
                                throws OperationException
Writes the attachment to the specified output stream.

To check out the attachment, first call obtainEditionLock(Attachment).

Simplified example within a servlet:

      //get a process service session
      ProcessServiceSession processSession = ...;

      //get the attachment id, probably from an InstanceInfo
      String attachmentId = ...;

      //get the attachment associated with this attachmentId
      Attachment attachment = processSession.getAttachment(attachmentId);

      //check out the attachment
      processSession.obtainEditionLock(attachment);

      //get the output stream
      OutputStream outputStream = response.getOutputStream;

      //set the appropriate headers
      response.setContentType(attachment.getContentType());

      //put the filename in quotes
      response.setHeader("Content-Disposition", "attachment; filename=\"" + attachment.getName() + "\"");

      //write the file to the output stream
      processSession.checkOutAttachmentToStream(attachment, outputStream);
 

Parameters:
attachment - attachment to write; cannot be null
stream - OutputStream to write the attachment to; cannot be null
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

commitExternalActivity

public InstanceInfo commitExternalActivity(String instanceStampId,
                                           int taskIn,
                                           Arguments args)
                                    throws OperationException
Executes the commit method of an external activity using the specified InstanceStampId and task identification number.

Parameters:
instanceStampId - instance stamp that identifies the target instance; cannot be null
taskIn - identification number of task to execute
args - arguments to be passed to the commit method of the external activity; null means no arguments
Returns:
InstanceInfo with the state of the instance after the commit method has executed
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

commitExternalActivity

public InstanceInfo commitExternalActivity(String instanceId,
                                           String activityName,
                                           Arguments args)
                                    throws OperationException
Executes the commit method of the main task of an external activity using the specified instanceId and activityId.

Parameters:
instanceId - instance ID that identifies the target instance; cannot be null
activityName - Activity name that identifies the activity to execute; cannot be null
args - arguments to be passed to the commit method of the external activity; null means no arguments
Returns:
InstanceInfo with the state of the instance after the commit method has executed
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

commitExternalActivity

public InstanceInfo commitExternalActivity(String instanceId,
                                           String activityName,
                                           int taskIn,
                                           Arguments args)
                                    throws OperationException
Executes the commit method of an external activity using the specified instanceId, activityId, and task identification number.

Parameters:
instanceId - instance ID that identifies the target instance; cannot be null
activityName - activity name that identifies the activity to execute; cannot be null
taskIn - identification number of task to execute
args - arguments to be passed to the commit method of the external activity null means no arguments
Returns:
InstanceInfo with the state of the instance after the commit method has executed
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

customRunActivity

public TaskExecution customRunActivity(String instanceId,
                                       String activityName,
                                       int taskIn,
                                       Arguments args)
                                throws OperationException
Executes the task for this instance using an instanceId, activityId, and task identification number.
Allows a PAPI client to customize client-side invocations.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.setMatchAll(true);
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));
     filter.addAttribute(session.getVar(VarDefinition.ACTIVITY_ID, Comparison.IS, "ActivityToExecute");

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Select the task to execute.
     Activity activity = instance.getActivity();
     Task task = activity.getTask("TaskToExecute");

     // Execute the activity.
     TaskExecution execution = session.customRunActivity(instance.getId(), instance.getActivityName(),
                                                         task.getIn(), arguments);

     for (Invocation inv = execution.next(); inv != null; inv = execution.next()) {
         execution.setInvocationResult(inv.invoke());
     }

     // Call getArguments() so argument replacement is performed
     execution.getArguments();

     // Get the output arguments
     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceId - instance ID that identifies the InstanceInfo to execute; cannot be null.
activityName - activity name that identifies the target activity to execute; cannot be null
taskIn - task identification number of the task to execute
args - arguments to pass to the task; null means no arguments
Returns:
TaskExecution object used to continue execution
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

customRunActivity

public TaskExecution customRunActivity(String instanceId,
                                       String activityName,
                                       Arguments args)
                                throws OperationException
Executes the main task for this instance using an instanceId and activityId.
Allows a PAPI client to customize client-side invocations.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.setMatchAll(true);
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));
     filter.addAttribute(session.getVar(VarDefinition.ACTIVITY_ID, Comparison.IS, "ActivityToExecute");

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Execute the activity.
     TaskExecution execution = session.customRunActivity(instance.getId(), instance.getActivityName(), arguments);

     for (Invocation inv = execution.next(); inv != null; inv = execution.next()) {
         execution.setInvocationResult(inv.invoke());
     }

     // Call getArguments() so argument replacement is performed
     execution.getArguments();

     // Get the output arguments
     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceId - instance ID that identifies the InstanceInfo to execute; cannot be null
activityName - activity name that identifies the target activity to execute; cannot be null
args - arguments to pass to the task; null means no arguments
Returns:
TaskExecution object used to continue execution
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

customRunGlobal

public TaskExecution customRunGlobal(String instanceId,
                                     String activityName,
                                     Arguments args)
                              throws OperationException
Executes the specified Global Activity for this instance using an instanceId and activityName.
Allows a PAPI client to customize client-side invocations.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.setMatchAll(true);
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Execute the activity.
     TaskExecution execution = session.customRunActivity(instance.getId(),
                                                         "GlobalInstanceActivityToExecute",
                                                         arguments);

     for (Invocation inv = execution.next(); inv != null; inv = execution.next()) {
         execution.setInvocationResult(inv.invoke());
     }

     // Call getArguments() so argument replacement is performed
     execution.getArguments();

     // Get the output arguments
     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceId - instance ID that identifies the InstanceInfo to execute; cannot be null
activityName - activity name that identifies the target activity to execute; cannot be null
args - arguments to pass to the task; null means no arguments
Returns:
TaskExecution object used to continue execution
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

customRunTask

public TaskExecution customRunTask(String instanceId,
                                   String activityName,
                                   int taskIn,
                                   Arguments args)
                            throws OperationException
Deprecated. use customRunActivity(String,String,int,Arguments) instead

Executes the specified task for this instance using an instanceId, activityName, and task identification number.
Allows a PAPI client to customize client-side invocations.

Parameters:
instanceId - instance ID that identifies the InstanceInfo to execute; cannot be null
activityName - activity name that identifies the target activity to execute; cannot be null
taskIn - task identification number of the task to execute
args - arguments to pass to the task; null means no arguments
Returns:
TaskExecution object used to continue execution
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

customRunTask

public TaskExecution customRunTask(String instanceStampId,
                                   int taskIn,
                                   Arguments args)
                            throws OperationException
Executes the specified task for this instance using an instanceStampId and task identification number.
Allows a PAPI client to customize client-side invocations.

Parameters:
instanceStampId - instance stamp that identifies the target instance; cannot be null
taskIn - identification number of task to execute
args - arguments to pass to the task; null means no arguments
Returns:
TaskExecution object used to continue execution
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

instanceAttach

public void instanceAttach(InstanceInfo instanceInfo,
                           String name,
                           String description,
                           String remarks,
                           File file)
                    throws NoPermissionException,
                           OperationException,
                           IOException
Attaches a file attachment to this process instance.

The content type is set to null.

Parameters:
instanceInfo - InstanceInfo to attach the file to; cannot be null
name - name of the attachment; cannot be null; the maximum length of the name is Attachment.FILENAME_LENGTH
description - brief description of the attachment; cannot be null; the maximum length of the description is Attachment.DESCRIPT_LENGTH
remarks - version-specific remarks to add to the attachment; cannot be null; the maximum length of remarks is Attachment.REMARK_LENGTH
file - file to attach to this instance; cannot be null
Throws:
NoPermissionException - if this participant does not have permission to attach the file to the instance
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:
IOException - if an I/O error occurs

instanceAttach

public void instanceAttach(InstanceInfo instanceInfo,
                           String name,
                           String description,
                           String remarks,
                           File file,
                           String contentType)
                    throws NoPermissionException,
                           OperationException,
                           IOException
Attaches a file with the specified content type to this process instance.

Parameters:
instanceInfo - InstanceInfo to attach the file to; cannot be null
name - name of the attachment; cannot be null; the maximum length of the name is Attachment.FILENAME_LENGTH
description - brief description of the attachment; cannot be null; the maximum length of the description is Attachment.DESCRIPT_LENGTH
remarks - version-specific remarks to add to the attachment; cannot be null; the maximum length of remarks is Attachment.REMARK_LENGTH
file - file to attach to this instance; cannot be null
contentType - content type of the file, e.g. "text/html" or "application/ms-word"; cannot be null
Throws:
NoPermissionException - if this participant does not have permission to attach the file to the instance
OperationException - if the session could not perform the operation.
May be one of the following subclasses of OperationException:
IOException - if an I/O error occurs

instanceCanBeAborted

public boolean instanceCanBeAborted(InstanceInfo instance)
Returns true if the instance can be aborted.

An instance can be aborted if the interactive activity has been defined as abortable in Studio and the participant has been given permission to abort in the Process Administrator.

Parameters:
instance - InstanceInfo to verify that the instance can be aborted
Returns:
true if the instance can be aborted

instanceCanBeBack

public boolean instanceCanBeBack(InstanceInfo instance)
Returns true if the instance can be routed back.

An instance can be routed back if it is outside of the main process flow in an exception flow, grab flow, or interruption flow.

Parameters:
instance - InstanceInfo to verify that the instance can be routed back
Returns:
true if the instance can be routed back

instanceCanBeProcessed

public boolean instanceCanBeProcessed(InstanceInfo instance)
Returns true if the instance can be processed.

Processed means that the main task associated with this instance can be executed.

Parameters:
instance - InstanceInfo to verify that the instance can be processed
Returns:
true if the instance can be processed

instanceCanBeReassign

public boolean instanceCanBeReassign(InstanceInfo instance)
Returns true if the instance can be reassigned.

An instance can be reassigned if the interactive activity has been defined as reassignable in Studio and the participant has been given permission to reassign in Process Administrator, or if the instance is selected and the participant has been given permission to escalate or delegate in Process Administrator.

Parameters:
instance - InstanceInfo to verify that the instance can be reassigned
Returns:
true if the instance can be reassigned

instanceCanBeResumed

public boolean instanceCanBeResumed(InstanceInfo instance)
Returns true if the instance can be resumed.

An instance can be resumed if the instance is suspended and the participant has been given permission to suspend in Process Administrator.

Parameters:
instance - InstanceInfo to verify that the instance can be resumed
Returns:
true if the instance can be resumed

instanceCanBeSelected

public boolean instanceCanBeSelected(InstanceInfo instance)
Returns true if the instance can be selected by the current participant.

An instance can be selected if all items of the instance are currently unselected or selected by the current participant.

Parameters:
instance - InstanceInfo to verify that the instance can be selected
Returns:
true if the instance can be selected by the current participant

instanceCanBeSent

public boolean instanceCanBeSent(InstanceInfo instance)
Returns true if the instance can be sent.

An instance can be sent if all mandatory items of the instance are currently completed and the articipant has been given permission to route in Process Administrator.

Parameters:
instance - InstanceInfo to verify that the instance can be sent
Returns:
true if the instance can be sent

instanceCanBeSuspended

public boolean instanceCanBeSuspended(InstanceInfo instance)
Returns true if the instance can be suspended.

An instance can be suspended if the interactive activity has been defined as suspendable in Studio, the instance is running, and the participant has been given permission to suspend in Process Administrator.

Parameters:
instance - InstanceInfo to verify that the instance can be suspended
Returns:
true if the instance can be suspended

instanceCanBeUngrabbed

public boolean instanceCanBeUngrabbed(InstanceInfo instance)
Returns true if the instance can be ungrabbed.

An instance can be ungrabbed if the instance is grabbed and the participant has been given permission to grab in Process Administrator.

Parameters:
instance - InstanceInfo to verify that the instance can be ungrabbed
Returns:
true if the instance can be ungrabbed

instanceCanBeUnselected

public boolean instanceCanBeUnselected(InstanceInfo instance)
Returns true if the instance can be unselected by the current participant

An instance can be unselected if the instance is currently selected by the participant

Parameters:
instance - InstanceInfo to verify that the instance can be unselected
Returns:
true if the instance can be unselected by the current participant

instanceReassign

public void instanceReassign(InstanceStamp instance,
                             String participantId)
                      throws OperationException,
                             BatchOperationException
Reassigns the instance to the specified participant.

An instance can be reassigned if the interactive activity has been defined as reassignable in Studio and the current participant has been given permission to reassign in Process Administrator.

Parameters:
instance - InstanceStamp of instance to be reassigned; cannot be null
participantId - UID of participant to reassign the instance to; cannot be null
Throws:
OperationException - if the session could not perform the operation.
May be one of the following subclasses of OperationException:
BatchOperationException - if the session could not perform the operation on every object May be one of the following subclasses of BatchOperationException:

instancesAbort

public void instancesAbort(InstanceStamp[] instances)
                    throws OperationException,
                           BatchOperationException
Aborts the specified instances.

An instance can be aborted if the interactive activity has been defined as abortable in Studio and the participant has been given permission to abort in Process Administrator.
Note that only instances in interactive activities can be aborted.

Parameters:
instances - array of InstanceStamp specifying the instances to be aborted; cannot be null
Throws:
OperationException - if the session could not perform the operation.
May be one of the following subclasses of OperationException:
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesAddConsult

public void instancesAddConsult(InstanceStamp[] instances,
                                String remark,
                                String toParticipant)
                         throws OperationException,
                                BatchOperationException
Adds consultations for the specified instances for the specified participant.

Parameters:
instances - consult will be added to each InstanceStamp in this array; cannot be null
remark - remark to include in consult; cannot be null
toParticipant - UID of participant to be consulted; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesAddNote

public void instancesAddNote(InstanceStamp[] instances,
                             String note)
                      throws OperationException,
                             BatchOperationException
Adds a note to the specified instances.

Parameters:
instances - note will be added to each InstanceStamp in this array; cannot be null
note - note content; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesGrab

public void instancesGrab(InstanceStamp[] instances,
                          String grabActivityName)
                   throws OperationException,
                          BatchOperationException
Grabs a group of instances by the specified activity.

An instance can be grabbed if it is running, the interactive activity has been defined as grabbable in Studio, and the participant has been given permission to grab in Process Administrator.

Parameters:
instances - array of InstanceStamps to grab; cannot be null
grabActivityName - name of the grab activity; cannot be null
Throws:
OperationException - if the session could not perform the operation.
May be one of the following subclasses of OperationException:
BatchOperationException - if the session could not perform the operation for each instance.
May be one of the following subclasses of BatchOperationException:

instancesResume

public void instancesResume(InstanceStamp[] instances)
                     throws OperationException,
                            BatchOperationException
Resumes a group of instances.

An instance can be resumed if it is suspended and the participant has been given permission to suspend in Process Administrator.

Parameters:
instances - array of InstanceStamps to resume; cannot be null
Throws:
OperationException - if the session could not perform the operation.
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesSelect

public void instancesSelect(InstanceStamp[] instances)
                     throws OperationException,
                            BatchOperationException
Selects a group of instances by the current participant.

An instance can be selected if all items of the instance are currently unselected or selected by the current participant.
Note that only instances in interactive activities can be selected.

Parameters:
instances - array of InstanceStamps to select; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesSend

public void instancesSend(InstanceStamp[] instances)
                   throws OperationException,
                          BatchOperationException
Sends a group of instances.

An instance can be sent if all mandatory items of the instance are currently completed and the articipant has been given permission to route in Process Administrator.
Note that only instances in interactive activities can be sent.

Parameters:
instances - array of InstanceStamps to route; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesSendBack

public void instancesSendBack(InstanceStamp[] instances,
                              boolean skip)
                       throws OperationException,
                              BatchOperationException
Sends back a group of instances.

An instance can be sent back if it is outside of the main process flow in an exception flow or an interruption flow.

Parameters:
instances - array of InstanceStamps to route; cannot be null
skip - if true, skip the activity which threw the exception or the activity which was interrupted
Throws:
OperationException - if the session could not perform the operation.
BatchOperationException - if the session could not perform the operation for each instance.
May be one of the following subclasses of BatchOperationException:

instancesSendTo

public void instancesSendTo(InstanceStamp[] instances,
                            String activityName,
                            String participant)
                     throws OperationException,
                            BatchOperationException
Routes a group of instances to the specified activity and participant.

An instance can be sent if all mandatory items of the instance are currently completed and the participant has been given permission to route in Process Administrator.
Note that only instances in interactive activities can be sent.

Parameters:
instances - array of InstanceStamps to route; cannot be null
activityName - name of activity to route to; cannot be null
participant - UID of participant to route to; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesSendTo

public void instancesSendTo(InstanceStamp[] instances,
                            String activityName)
                     throws OperationException,
                            BatchOperationException
Routes a group of instances to the specified activity.

An instance can be sent if all mandatory items of the instance are currently completed and the participant has been given permission to route in Process Administrator.
Note that only instances in interactive activities can be sent.

Parameters:
instances - array of InstanceStamps to route; cannot be null
activityName - name of activity to route to; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesSuspend

public void instancesSuspend(InstanceStamp[] instances)
                      throws OperationException,
                             BatchOperationException
Suspends a group of instances. An instance can be suspended if the interactive activity has been defined as suspendable in Studio, the instance is running, and the participant has been given permission to suspend in Process Administrator
Note that only instances in interactive activities can be suspended.

Parameters:
instances - array of InstanceStamps to suspend; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesTargetParticipants

public ParticipantsForActivities instancesTargetParticipants(InstanceStamp[] instances)
                                                      throws OperationException,
                                                             BatchOperationException
Returns the participants who can receive this array of instances.

Parameters:
instances - array of InstanceStamps to check for participants; cannot be null
Returns:
ParticipantsForActivities that contain the participants for the activities defined in instanceStamps
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesUngrab

public void instancesUngrab(InstanceStamp[] instances)
                     throws OperationException,
                            BatchOperationException
Ungrabs a group of instances.

An instance can be ungrabbed if the instance is grabbed and the participant has been given permission to grab in Process Administrator.

Parameters:
instances - array of InstanceStamps to ungrab; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

instancesUnselect

public void instancesUnselect(InstanceStamp[] instances)
                       throws OperationException,
                              BatchOperationException
Unselects a group of instances.

An instance can be unselected if the instance is currently selected by the current participant.

Parameters:
instances - array of InstanceStamps to unselect; cannot be null
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation for each instance May be one of the following subclasses of BatchOperationException:

obtainEditionLock

public void obtainEditionLock(Attachment attachment)
                       throws OperationException
Obtains a version lock for the attachment.

To write the checked-out attachment to a file, use checkOutAttachment(Attachment, String).
To write the checked-out attachment to an OutputStream, use checkOutAttachmentToStream(Attachment, java.io.OutputStream).

Parameters:
attachment - attachment to receive the lock; cannot be null
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

prepareExternalActivity

public Arguments prepareExternalActivity(String instanceStampId,
                                         int taskIn,
                                         Arguments args)
                                  throws OperationException
Executes the prepare method of an external activity for the task given an instanceStampId and task identification number.

Parameters:
instanceStampId - instance stamp ID that identifies the target instance; cannot be null
taskIn - task identification number of the task to execute
args - input arguments passed to the external activity; null means no arguments
Returns:
Arguments returned by the external activity
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

prepareExternalActivity

public Arguments prepareExternalActivity(String instanceId,
                                         String activityName,
                                         Arguments args)
                                  throws OperationException
Executes the prepare method for the main task of the activity given an instanceId and an activityId.

Parameters:
instanceId - ID that identifies the target instance; cannot be null
activityName - name of the target activity; cannot be null
args - input arguments passed to the external activity; null means no arguments
Returns:
Arguments returned by the external activity
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

prepareExternalActivity

public Arguments prepareExternalActivity(String instanceId,
                                         String activityName,
                                         int taskIn,
                                         Arguments args)
                                  throws OperationException
Executes the prepare method for the specified task of the activity given an instanceId, activityId, and task identification number.

Parameters:
instanceId - ID that identifies the target instance; cannot be null
activityName - name of the target activity; cannot be null
taskIn - task identification number of the task to execute
args - input arguments passed to the external activity; null means no arguments
Returns:
Arguments returned by the external activity
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

releaseEditionLock

public void releaseEditionLock(Attachment attachment,
                               File file)
                        throws OperationException
Releases the version lock for the attachment and deletes the specified file. Releasing a version lock is also known as undo checkout.

Parameters:
attachment - the version lock on the attachment will be released; cannot be null
file - local file to be removed; cannot be null
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

releaseEditionLock

public void releaseEditionLock(Attachment attachment)
                        throws OperationException
Releases the version lock for the attachment. Releasing a version lock is also known as undo checkout.

Parameters:
attachment - the version lock will be released for the attachment; cannot be null
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

removeBookmarks

public void removeBookmarks(InstanceStamp[] instancesStamp)
                     throws OperationException
Removes bookmarks.

Parameters:
instancesStamp - array of InstanceStamps to remove from the bookmarks; cannot be null
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

removePresentation

public void removePresentation(String presentationId)
                        throws OperationException
Removes the presentation specified by presentationId.

Parameters:
presentationId - ID of presentation to remove; if the ID does not match a presentation, this method will have no effect; if a view referenced the specified presentationId, the view will be set to use the default presentation ID; default presentation IDs cannot be removed
Throws:
OperationException - if the session could not perform the operation

removeView

public void removeView(String viewId)
                throws OperationException
Removes the view specified by viewId.

Parameters:
viewId - ID of the view to remove; default views cannot be removed; if the current participant is not the owner of the view, the view will not be removed
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

runActivity

public InstanceInfo runActivity(String instanceStampId,
                                Arguments args)
                         throws OperationException
Executes the main task for the instance given an instanceStampId.

The task cannot interact with the end user. For interactive tasks, use customRunActivity.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.setMatchAll(true);
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));
     filter.addAttribute(session.getVar(VarDefinition.ACTIVITY_ID, Comparison.IS, "ActivityToExecute");

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Execute the activity.
     InstanceInfo instance = session.runActivity(instance.getStamp(), arguments);

     // Get the output arguments
     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceStampId - ID of the InstanceStamp that contains the instance and activity name; cannot be null
args - arguments to pass to the task; null means no arguments
Returns:
InstanceInfo after task completion
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

runActivity

public InstanceInfo runActivity(String instanceStampId,
                                int taskIn,
                                Arguments args)
                         throws OperationException
Executes the specified task for this instance given an instanceStampId and a task identification number.

The task cannot interact with the end user. For interactive tasks, use customRunActivity.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.setMatchAll(true);
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));
     filter.addAttribute(session.getVar(VarDefinition.ACTIVITY_ID, Comparison.IS, "ActivityToExecute");

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Select the task to execute.
     Process process = session.getProcess("/OU/MyProcess#Variation-1.0");
     Activity activity = process.getActivity("ActivityToExecute");
     Task task = activity.getTask("TaskToExecute");

     // Execute the activity.
     InstanceInfo instance = session.runActivity(instance.getStamp(), task.getIn(), arguments);

     // Get the output arguments
     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceStampId - ID of the InstanceStamp that contains the instance and activity name; cannot be null
taskIn - task identification number of the task to execute
args - arguments to pass to the task; null means no arguments
Returns:
InstanceInfo after task completion
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

runActivity

public InstanceInfo runActivity(String instanceId,
                                String activityName,
                                Arguments args)
                         throws OperationException
Executes the main task for the instance given an instanceId and activity name.

The task cannot interact with the end user. For interactive tasks, use customRunActivity.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.setMatchAll(true);
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));
     filter.addAttribute(session.getVar(VarDefinition.ACTIVITY_ID, Comparison.IS, "ActivityToExecute");

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Execute the activity.
     InstanceInfo instance = session.runActivity(instance.getId(), instance.getActivityName(), arguments);

     // Get the output arguments
     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceId - ID of the instance to execute; cannot be null
activityName - name of the activity; cannot be null; the main task of this activity will be executed
args - arguments to pass to the task; null means no arguments
Returns:
InstanceInfo after task completion
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

abortActivity

public void abortActivity(String instanceId,
                          String activityName,
                          int taskIn)
                   throws OperationException
Locates instance identified by instanceId in activity activityName and aborts the running task identified by taskIn.

Parameters:
instanceId - Id of the instance. Cannot be null.
activityName - name of activity. Cannot be null.
taskIn - task identification number of the Task to be aborted.
Throws:
OperationException - if the session could not perform the operation.

runActivity

public InstanceInfo runActivity(String instanceId,
                                String activityName,
                                int taskIn,
                                Arguments args)
                         throws OperationException
Executes the specified Task for this instance given an instanceId, activity name, and task identification number.

The task cannot interact with the end user. For interactive tasks, use customRunActivity.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.setMatchAll(true);
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));
     filter.addAttribute(session.getVar(VarDefinition.ACTIVITY_ID, Comparison.IS, "ActivityToExecute");

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Select the task to execute.
     Activity activity = instance.getActivity();
     Task task = activity.getTask("TaskToExecute");

     // Execute the activity.
     InstanceInfo instance = session.runActivity(instance.getId(), instance.getActivityName(),
                                                 task.getIn(), arguments);

     // Get the output arguments
     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceId - ID of the instance to execute; cannot be null
activityName - name of the activity; cannot be null; the main task of this activity will be executed
taskIn - task identification number of the task to execute
args - arguments to pass to the task; null means no arguments
Returns:
InstanceInfo after task completion
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

runGlobal

public InstanceInfo runGlobal(String instanceId,
                              String activityName,
                              Arguments args)
                       throws OperationException
Runs a global activity.

The global activity cannot interact with the end user. For interactive tasks, use customRunGlobal.

Ex.

     // Define the arguments of the activity.
     Arguments arguments = Arguments.create();
     argument.putArgument("MyStringArgument", "StringValue");
     argument.putArgument("MyIntegerArgument", 1000);

     // Search the instance to execute.
     Filter filter = ProcessService.createFilter();
     filter.addAttribute(session.getVar("OrderNumber"), Comparison.IS, new Integer(12345));

     InstanceInfo[] instances = session.getInstancesByFilter(new String[] { "/OU/MyProcess" }, filter);
     Instance instance = instances[0];

     // Execute the activity.
     InstanceInfo instance = session.runActivity(instance.getId(), "GlobalInstanceActivityToExecute", arguments);

     String myOutputStringArgument = (String) arguments.getArgument("MyOutputStringArgument");
     String result = (String) arguments.getArgument(Arguments.RESULT);
 

Parameters:
instanceId - ID of instance to execute; cannot be null
activityName - name of activity to execute; cannot be null
args - arguments to pass to the activity; null means no arguments
Returns:
InstanceInfo after the execution of the global activity
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

runTask

public void runTask(String instanceId,
                    String activityName,
                    int taskIn,
                    Arguments args)
             throws OperationException
Deprecated. use runActivity(String, String, int, Arguments) instead

Executes the specified task given an instanceId, activityName, and task identification number.

Parameters:
instanceId - ID of the instance to execute; cannot be null
activityName - name of the activity; cannot be null
taskIn - task identification number of the task to execute
args - arguments to pass to the task; null means no arguments
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

runTask

public void runTask(String instanceStampId,
                    int taskIn,
                    Arguments args)
             throws OperationException
Deprecated. use runActivity(String,int,Arguments) instead

Executes the specified task, given an instanceStampId and task identification number. The task cannot interact with the end user. For interactive tasks, use customRunTask.

Parameters:
instanceStampId - ID of the InstanceStamp that contains the instance and activity name Cannot be null.
taskIn - task identification number of the task to execute
args - arguments to pass to the task; null means no arguments
Throws:
OperationException - if the session could not perform the operation May be one of the following subclasses of OperationException:

storePresentation

public void storePresentation(Presentation presentation)
                       throws OperationException
Stores a presentation.

Parameters:
presentation - presentation to store; cannot be null
Throws:
OperationException - if the session could not perform the operation

storeUserProperties

public void storeUserProperties(String category,
                                Map properties)
                         throws OperationException
Stores user properties with the same behavior as ProcessServiceNESession.storeUserProperties.

Specified by:
storeUserProperties in interface ProcessServiceNESession
Parameters:
category - properties category
properties - properties map, where the key is the property key and the value is the property value
Throws:
OperationException - if the session could not perform the operation

storeView

public void storeView(View view)
               throws OperationException
Stores the specified view.

Until a view is stored, View.isTransient() will return true and the view will not be retrievable using ProcessServiceNESession.getView(String).

Parameters:
view - view to store; cannot be null
Throws:
OperationException - if the session could not perform the operation

taskCanBeProcessed

public boolean taskCanBeProcessed(InstanceInfo instance,
                                  int taskNumber)
Returns true if the specified task for this instance can be executed by the current participant.

A task can be executed if the task is not completed or it has been defined as repeatable in Studio.

Parameters:
instance - InstanceInfo to check; cannot be null
taskNumber - task identification number to check
Returns:
true if the specified task for this instance can be executed by the current participant

taskCanBeSelected

public boolean taskCanBeSelected(InstanceInfo instance,
                                 int taskNumber)
Returns true if the specified task for this instance can be selected by the current participant. Note that only process instance items in interactive activities can be selected.

Parameters:
instance - InstanceInfo to check; cannot be null
taskNumber - task identification number to check
Returns:
true if the specified task for this instance can be selected by the current participant

taskCanBeUnselected

public boolean taskCanBeUnselected(InstanceInfo instance,
                                   int taskNumber)
Returns true if the specified task for this instance can be unselected by the current participant. Note that only process instance items in interactive activities can be unselected.

Parameters:
instance - InstanceInfo to check; cannot be null
taskNumber - task identification number to check
Returns:
true if the specified task for this instance can be unselected by the current participant

tasksSelect

public void tasksSelect(String instanceId,
                        String activityName,
                        int[] taskNumbers)
                 throws OperationException,
                        BatchOperationException
Selects the instance.

Selected instances can only be processed by the participant who has selected them.
Repeatable process instances can be selected even if they have already been completed.
Note: Status is not changed to SELECTED when selecting a COMPLETED process instance.

Parameters:
instanceId - ID of the instance for which tasks will be selected; cannot be null
activityName - name of the activity that containf the tasks to select; cannot be null
taskNumbers - array of task identification numbers to select
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation on every task May be one of the following subclasses of BatchOperationException:
    • TasksException if the session could not perform the operation on every task

tasksUnselect

public void tasksUnselect(String instanceId,
                          String activityName,
                          int[] taskNumbers)
                   throws OperationException,
                          BatchOperationException
Unselects the instance.

Instances that are not selected by a participant can be processed by any participant assigned to the role for the current activity.
Repeatable instances can be selected even if they have already been completed.
Note: Status is not changed to PENDING when unselecting a COMPLETED instance.

Parameters:
instanceId - ID of instance for which tasks will be unselected; cannot be null
activityName - name of the activity that contains the tasks to unselect; cannot be null
taskNumbers - array of task identification numbers to unselect
Throws:
OperationException - if the session could not perform the operation
BatchOperationException - if the session could not perform the operation on every task May be one of the following subclasses of BatchOperationException:
    • TasksException if the session could not perform the operation on every task

toString

public String toString()
Returns the name of the class.

Returns:
name of the class

updateUserPassword

public void updateUserPassword(String oldPassword,
                               String newPassword)
                        throws OperationException
Updates the user password.

This method has no effect if isChangeParticipantPasswordSupported() returns false.

Parameters:
oldPassword - old participant password; cannot be null
newPassword - new participant password; cannot be null
Throws:
OperationException - if the session could not perform the operation

ALBPM Process API (PAPI)

© Copyright 1996/2005 Fuego Inc. All Rights Reserved