Package com.documentum.fc.client

# Interface IDfWorkflowBuilder

public interface IDfWorkflowBuilder
This interface provides methods to help start a workflow.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DF_WB_CAN_START`
  The workflow can be started.
  `static final int`
  `DF_WB_NO_EXECUTE_PERMISSION`
  The user doesn't have Execute permission on the workflow.
  `static final int`
  `DF_WB_NO_RELATE_PERMISSION`
  The user doesn't have Relate permission on the workflow.
  `static final int`
  `DF_WB_UNINSTALLED_PROCESS`
  The workflow's associated process object is not installed.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `IDfId`
  `addPackage(String startActivityName, String inputPortName, String packageName, String packageType, String noteText, boolean notePersistent, IDfList componentIds)`
  Adds a package to a start activity in the workflow.
  `IDfProcess`
  `getProcess()`
  Returns the process object on which the workflow is based.
  `IDfList`
  `getStartActivityIds()`
  Returns the object IDs of the start activities in the workflow's definition.
  `IDfList`
  `getStartActivityNames()`
  Returns the names of the start activities in the workflow's definition.
  `int`
  `getStartStatus()`
  Indicates whether the user can start the workflow.
  `IDfWorkflow`
  `getWorkflow()`
  Returns the workflow object.
  `IDfId`
  `getWorkflowAliasSetId()`
  Returns the alias set object id of the workflow object.
  `IDfId`
  `initWorkflow()`
  Creates and saves the workflow object in the Documentum server.
  `boolean`
  `isRunnable()`
  Indicates whether the workflow's definition is in the installed state.
  `void`
  `removePackage(String activityName, String portName, String packagename)`
  Removes a package definition from an activity.
  `IDfId`
  `runWorkflow()`
  Executes the workflow object.
  `IDfId`
  `startWorkflow()`
  Deprecated.

- ## Field Details

  - ### DF_WB_CAN_START

    static final int DF_WB_CAN_START
    The workflow can be started.
    See Also:
      - Constant Field Values

  - ### DF_WB_UNINSTALLED_PROCESS

    static final int DF_WB_UNINSTALLED_PROCESS
    The workflow's associated process object is not installed.
    See Also:
      - Constant Field Values

  - ### DF_WB_NO_RELATE_PERMISSION

    static final int DF_WB_NO_RELATE_PERMISSION
    The user doesn't have Relate permission on the workflow.
    See Also:
      - Constant Field Values

  - ### DF_WB_NO_EXECUTE_PERMISSION

    static final int DF_WB_NO_EXECUTE_PERMISSION
    The user doesn't have Execute permission on the workflow.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getStartActivityIds

    IDfList getStartActivityIds() throws DfException
    Returns the object IDs of the start activities in the workflow's definition.

    Activities are defined as start, end, or step activities. These categories indicate the relative position of the activity in the workflow. A workflow can have multiple start and step activities, but only one end activity.

    For more information about start, step, and end activities, refer to Server Fundamentals.

    Returns:
      An IDfList object that contains the object IDs of the start activities
    Throws:
      `DfException` - if the server returns an error

  - ### getStartActivityNames

    IDfList getStartActivityNames() throws DfException
    Returns the names of the start activities in the workflow's definition.

    Activities are defined as start, end, or step activities. These categories indicate the relative position of the activity in the workflow. A workflow can have multiple start and step activities, but only one end activity.

    For more information about start, step, and end activities, refer to Server Fundamentals.

    Returns:
      An IDfList object that contains the names of the start activities
    Throws:
      `DfException` - if the server returns an error

  - ### getStartStatus

    int getStartStatus() throws DfException
    Indicates whether the user can start the workflow.

    To start a workflow, the dm_process object that contains its definition must be in the installed state. Additionally, the user starting the workflow must have Relate and Execute permissions on the process object.

    Relate permission is a base object-level permission. Execute permission is an extended object-level permission. For more information about process definition states and object-level permissions, refer to Server Fundamentals.

    Returns:
      Zero (0) if the logged-in user can start the workflow or an error code if the user cannot
    Throws:
      `DfException` - if the server returns an error

  - ### addPackage

    IDfId addPackage(String startActivityName, String inputPortName, String packageName, String packageType, String noteText, boolean notePersistent, IDfList componentIds) throws DfException
    Adds a package to a start activity in the workflow.

    Packages contain the objects on which the workflow activities perform work. You can add a package to a start activity if that activity has at least one input port and a defined pre-condition. The package must be a package that is already specified in the activity's definition. For more information about packages and adding packages to activities, refer to Server Fundamentals.

    The following code example demonstrates how to start routing objects to users by calling `addPackage` on the first activity's input port:

    >      // Create all activity and process objects first...
    >      IDfWorkflowBuilder wfBldrObj = sess.newWorkflowBuilder(procObj.getObjectId());
    >      IDfId wfId = wfBldrObj.startWorkflow();
    >      wfBldrObj.addPackage(actObj1.getObjectName(), actObj1.getPortName(0), sysObj.getObjectName(),
    >           "dm_sysobject", null, false, objList);

    Parameters:
      `startActivityName` - the name of one of the workflow's start activities.
      `inputPortName` - the name of an input port of the start activity.
      `packageName` - the name of an existing package in the activity.
      `packageType` - the object type of the package's components. This must be the real object type, not a supertype, and must match the object type specified in the package definition in the activity.
      `noteText` - defines a message to send to the package's recipients. This parameter can be empty if there is no note.
      `notePersistent` - set this to `true` if you want to send the note defined in `noteText` to the performers of all activities receiving this package. If you set it to `false`, the note is sent only to the performers of the activities that immediately follow the start activity.
      `componentIds` - an IDfList object that contains the object IDs of the package's components.
    Returns:
      an IDfId object for the package object.
    Throws:
      `DfException` - if the server returns an error.

  - ### removePackage

    void removePackage(String activityName, String portName, String packagename) throws DfException
    Removes a package definition from an activity.

    Packages represent the object on which the activity performs its work. This method removes a package from an activity in the workflow. For more information about removing packages, refer to Server Fundamentals.

    The following code example demonstrates how to remove a package from a start activity:

    >      // Create all activity and process objects first...
    >      IDfWorkflowBuilder wfBldrObj = sess.newWorkflowBuilder(procObj.getObjectId());
    >      IDfId wfId1 = wfBldrObj.initWorkflow();
    >      IDfId wfId2 = wfBldrObj.runWorkflow();
    >      // Packages are added here via addPackage()...
    >      // ...
    >      // Let's say at some point during processing we don't want a package to be
    >      // dealt with by a particular user, hence, the following call is made...
    >      wfBldrObj.removePackage(actObjN.getObjectName(), actObjN.getPortName(0), sysObj.getObjectName());

    Parameters:
      `activityName` - the name of the activity.
      `portName` - the name of the port with which the package is associated.
      `packagename` - the name of the package.
    Throws:
      `DfException` - if the server returns an error.

  - ### startWorkflow

    IDfId startWorkflow() throws DfException
    Deprecated.
    Starts a workflow.

    A workflow is a runtime instance of a dm_process object. Process objects store workflow definitions in the repository. To start a workflow, the process object must be in the installed state and the user must have Relate and Execute permissions on the process object. (Relate permission is a base object-level permission and Execute is an extended object-level permission.) To determine whether the workflow can be started, use `getStartStatus()` or `isRunnable()`.

    Starting a workflow generates a dm_workflow object. If this method is successful, it returns the object ID of the workflow object. THIS METHOD IS DEPRECATED -- use `initWorkflow` and then `runWorkflow` instead.

    Returns:
      An IDfId object that contains the object ID of the dm_workflow object
    Throws:
      `DfException` - if the server returns an error

  - ### isRunnable

    boolean isRunnable() throws DfException
    Indicates whether the workflow's definition is in the installed state.

    Workflow definitions are stored in the repository as dm_process objects. To start a runtime instance of the workflow, its corresponding process object must be in the installed state.

    For more information about process states, refer to Server Fundamentals.

    Returns:
      `true` if the process object is in the installed state; `false` if not
    Throws:
      `DfException` - if the server returns an error

  - ### getProcess

    IDfProcess getProcess() throws DfException
    Returns the process object on which the workflow is based.

    Workflow definitions are stored in the repository as dm_process objects.

    Returns:
      The IDfProcess object
    Throws:
      `DfException` - if the server returns an error

  - ### getWorkflow

    IDfWorkflow getWorkflow() throws DfException
    Returns the workflow object.

    A workflow object represents a runtime instance of a dm_process object.

    Returns:
      An IDfWorkflow object
    Throws:
      `DfException` - if the server returns an error

  - ### initWorkflow

    IDfId initWorkflow() throws DfException
    Creates and saves the workflow object in the Documentum server.

    After initializing the workflow via this method, you should call `runWorkflow` to starting the workflow.

    The following code example demonstrates how to initialize and start a workflow:

    >      // Create all activity and process objects first...
    >      IDfWorkflowBuilder wfBldrObj = sess.newWorkflowBuilder(procObj.getObjectId());
    >      IDfId wfId1 = wfBldrObj.initWorkflow();
    >      IDfId wfId2 = wfBldrObj.runWorkflow();

    Returns:
      an IDfId object that contains the object ID of the dm_workflow object.
    Throws:
      `DfException` - if the server returns an error.
    See Also:
      - `runWorkflow()`

  - ### runWorkflow

    IDfId runWorkflow() throws DfException
    Executes the workflow object.

    A workflow is a runtime instance of a dm_process object. Process objects store workflow definitions in the Documentum server. To start a workflow, the process object must be in the installed state and the user must have Relate and Execute permissions on the process object. To determine whether the workflow can be started, use `getStartStatus()` or `isRunnable()`.

    This call should occur after a call to `initWorkflow` which saves the workflow object in the Documentum server.

    The following code example demonstrates how to initialize and start a workflow:

    >      // Create all activity and process objects first...
    >      IDfWorkflowBuilder wfBldrObj = sess.newWorkflowBuilder(procObj.getObjectId());
    >      IDfId wfId1 = wfBldrObj.initWorkflow();
    >      IDfId wfId2 = wfBldrObj.runWorkflow();

    Returns:
      an IDfId object that contains the object ID of the dm_workflow object.
    Throws:
      `DfException` - if the server returns an error.
    See Also:
      - `initWorkflow()`

  - ### getWorkflowAliasSetId

    IDfId getWorkflowAliasSetId() throws DfException
    Returns the alias set object id of the workflow object.

    Returns:
      An IDfId object that contains the object ID of alias set object of the dm_workflow object
    Throws:
      `DfException` - if the server returns an error