Upload
ravi-badoni
View
94
Download
1
Tags:
Embed Size (px)
Citation preview
Documentum Developer Conference 2001 9/9/01 12:43
Pang 1
InsideInside Documentum DocumentumWorkflowWorkflow
Gladys PangGladys Pang
Documentum Developer Conference 2001 9/9/01 12:43
Pang 2
AgendaAgenda
�� ConceptsConcepts�� Workflow and LifecycleWorkflow and Lifecycle
�� Building a complex workflowBuilding a complex workflow�� Simple workflowSimple workflow�� Path selectionPath selection�� Dynamic performerDynamic performer
�� Advanced FeaturesAdvanced Features�� Automated activitiesAutomated activities�� Distributed workflowDistributed workflow
�� Workflow and LifecycleWorkflow and Lifecycle�� Lifecycle proceduresLifecycle procedures
Documentum Developer Conference 2001 9/9/01 12:43
Pang 3
Documentum WorkflowDocumentum Workflow
�� Mechanism to model a business processMechanism to model a business process�� A network of tasks performed by a user orA network of tasks performed by a user or
the systemthe system�� Flow of data from task to taskFlow of data from task to task�� Logic that governs the sequence of tasksLogic that governs the sequence of tasks
EditEdit Dept.Dept.ReviewReview
Engr.Engr.ApprovalApproval
PublishPublishMktg.Mktg.
ApprovalApproval
You can use Workflow to model a business process. Workflow is taskcentric. As in the example, there are Edit, Review, etc.
You can define tasks to be performed by user manually or by the systemautomatically. For example, you can make Publish an automatic task.
You can send different numbers of document in a workflow.
You can set up the logic in the workflow to control the flow of the tasks. As inthe Approval tasks, the next task can be forwarded to Publish or rejected toEdit.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 4
Documentum LifecycleDocumentum Lifecycle
�� Mechanism to specify the location, security,Mechanism to specify the location, security,ownership and other policies that govern theownership and other policies that govern thedocument in each phase of its existencedocument in each phase of its existence
�� Modeled as a sequence of states and theModeled as a sequence of states and thetransitions between themtransitions between them�� Entry CriteriaEntry Criteria�� ActionsActions�� Post ActionsPost Actions
AuthorAuthor ReviewReview PublishPublish RetireRetire
WithdrawnWithdrawn
Lifecycle is document centric.
Lifecycle is used to control the location, security, ownership etc for differentphases of the document.
To use Lifecycle, you define phases or states for a document. In each statethe document has different control parameters such as location, permissionand ownership.
You use Lifecycle to control the transition of the states and therefore thedocument's control parameters. You can define transition tests and actionsto be run as Entry Criteria, Action, or Post Action during the state transition.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 5
Workflow And LifecycleWorkflow And Lifecycle
�� A document can only have one Lifecycle at aA document can only have one Lifecycle at agiven timegiven time
�� It can participate in many Workflow processesIt can participate in many Workflow processes�� Lifecycle allows us to factor out the documentLifecycle allows us to factor out the document
policy from the business processpolicy from the business process�� Lifecycle and Workflow often work inLifecycle and Workflow often work in
conjunction to produce the desired systemconjunction to produce the desired systembehaviorbehavior
LifecycleLifecycle WorkflowWorkflow
A document can only have one Lifecycle at a given time. But it canparticipate in many Workflow processes.
Lifecycle allows us to factor out the document policy from the businessprocess.
Lifecycle and Workflow often work in conjunction to produce the desiredsystem behavior. We will go through this in more detail in the Workflow andLifecycle topic which comes in later of the presentation.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 6
Workflow ModelWorkflow ModelProcess DesignProcess Design
and Definitionand Definition
Build TimeBuild Time
ProcessProcessInstantiationInstantiationand Controland Control
Interaction withInteraction withUsers andUsers and
Application ToolsApplication Tools
Run TimeRun Time
Workflow ManagerWorkflow Manager
Server Workflow EngineServer Workflow Engine
ApplicationsApplicationsand IT Toolsand IT Tools
Workflow TemplatesWorkflow Templates
This is a high level picture for DCTM workflow model.
We have Workflow Manager to create the Workflow definition which is calledworkflow template.
At runtime we create a workflow instance which refers to the workflowtemplate.
The server workflow engine controls the flow logic according to the workflowdefinition in the workflow template.
User performs on the tasks through the client application. Or the task itselfbe performed by some applications.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 7
Workflow EnactmentWorkflow EnactmentWorkflow ManagerWorkflow Manager
Client's Inbox andClient's Inbox andTask ManagerTask ManagerSupervisorSupervisor
AdministrationAdministrationand Controland Control
Task ListTask List
ContentContentReferencesReferences
ApplicationsApplications
Through Through methodmethod
invocationinvocationupdateupdate
InvokesInvokes
Workflow TemplateWorkflow Template
Server WorkflowServer WorkflowEngineEngine
Interpreted byInterpreted byWorkflowWorkflow
Control DataControl DataMaintainsMaintains
Here we have a closer look at the Workflow functional components.Startingfrom the top, we have Workflow Manager which is used to create workflowtemplate. Workflow template can also reference alias set and LDAPintegration in its definition.
Coming to the center of the diagram is the workflow runtime control. In thecenter is the Server Workflow Engine, maintained by Workflow Supervisor. Itcontrols automated aspect of the business process
The Workflow Engine references the the routing document (content).
The Workflow Engine also maintains a set of workflow control data. It isused to control the processing of the existing tasks and to determine thenext tasks.
Going down to the bottom of the picture, task list is created for manualtasks. In this case, performer receives the task in the Inbox. He completesthe task through the Task Manager interface of the client.
For automatic tasks, the Workflow Engine will invoke the applicationsdirectly. Here the applications can talk to the Workflow Engine throughserver methods and/or DFC.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 8
Object Model And RelationshipObject Model And RelationshipBusiness ProcessBusiness Process
ActivityActivity
composed ofcomposed oftwo or moretwo or more
Activity DefinitionActivity Definitiondm_activitydm_activity
TaskTask
include oneinclude oneor moreor more
Work ItemWork Itemdmidmi__workitemworkitem
PackagePackagedmidmi_package_package
Queue ItemQueue Itemdmidmi_queue_item_queue_item
associate associate with onewith oneor moreor more
associate associate withwith
Workflow TemplateWorkflow Template
is defined in ais defined in a
Process Definition Process Definitiondm_processdm_process
is managed byis managed by
Workflow InstanceWorkflow InstanceWorkflow InstanceWorkflow Instance
dm_workflowdm_workflow
used to createused to createand manageand manage
during executionduring executionis represented byis represented by
Here is the object model in DCTM server.* Business Process - what is intended to happen* On the left is the Design Time Definition. Workflow Template is defined by - Process Definition - dm_process, representation of what’s intended tohappen - Activity Definition - dm_activity, representation of what’s intended toachieve at a logical step* On the right is the Run Time Management - Workflow Instance - dm_workflow, controls automated aspect of thebusiness process and record runtime information of workflow - Task - record run time information of activity - Work Item - dmi_workitem, task allocated to task performers - Queue Item - dmi_queue_item, peer item for work item for querying inInbox - Package - dmi_package, references documents and comments routedamong task
Documentum Developer Conference 2001 9/9/01 12:43
Pang 9
Client Object Model AndClient Object Model AndRelationshipRelationship
InboxInbox queries forqueries forTaskTask
Queue ItemQueue Itemdmidmi_queue_item_queue_item
Task ManagerTask Manager
invokesinvokes
manipulatesmanipulates
TaskTaskWork ItemWork Itemdmidmi__workitemworkitem
PackagePackagedmidmi_package_package
Queue ItemQueue Itemdmidmi_queue_item_queue_item
associate associate with onewith oneor moreor more
associate associate withwith
Here is the object model in DCTM client.* Inbox - provides a list of tasks you are responsible for* Task Manager - provides details of a task and allows user to perform thetask
Documentum Developer Conference 2001 9/9/01 12:43
Pang 10
AgendaAgenda
�� ConceptsConcepts�� Building a WorkflowBuilding a Workflow
�� Simple WorkflowSimple Workflow�� Path SelectionPath Selection�� Dynamic PerformerDynamic Performer
�� Advanced FeaturesAdvanced Features�� Workflow and LifecycleWorkflow and Lifecycle
Documentum Developer Conference 2001 9/9/01 12:43
Pang 11
Building A Simple WorkflowBuilding A Simple Workflow
�� Approve Activity - allow delegate and repeat; require sign offApprove Activity - allow delegate and repeat; require sign off
1) Basic process of building a workflow* Log on the Workflow Manager.* Drag and drop the activity from template to the drawing panel* Connect the activities using the flow tool* Set the parameters in Activity Inspector and Flow Inspector* Save, validate and install the workflow template
2) Build a simple workflow* Start with a simple linear workflow template that contains signoff, repeat,and delegate* Template detail: Approve - allow delegate and repeat, require sign off
Documentum Developer Conference 2001 9/9/01 12:43
Pang 12
Building A Simple WorkflowBuilding A Simple WorkflowActivity InspectorActivity Inspector
1) Basics of the Performer tab* Performer information* Delegate, reassign, and signoff information
2) Set Approve task for delegate, repeat, and signoff* Select the Approve activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Performer tab* Check the appropriate check boxes
Documentum Developer Conference 2001 9/9/01 12:43
Pang 13
Building A Simple WorkflowBuilding A Simple WorkflowFlow InspectorFlow Inspector
1) Basics of the Package tab* Package information* Port/link definition
2) Add the package to the flows* Multi-select all the flows* Bring up the Flow Inspector by double click, menu item, or toolbar* Go to Packages tab* Add new package* You can change to an optional package from the Version column* Check apply to all selected check box* Apply
Documentum Developer Conference 2001 9/9/01 12:43
Pang 14
Running A Simple WorkflowRunning A Simple WorkflowStart WorkflowStart Workflow
1) Invoke Start Workflow* Log on to Desktop Client* Navigate to the installed workflow template* Invoke Start Workflow by double click or Open menu item
2) Start Workflow Component* Add package* Add comment and define who to send the comment to
Documentum Developer Conference 2001 9/9/01 12:43
Pang 15
Running A Simple WorkflowRunning A Simple WorkflowStart WorkflowStart Workflow
(1) Start with workflow template(1) Start with workflow template(2) Create workflow instance(2) Create workflow instance(3) Execute workflow(3) Execute workflow
dm_workflow-----------------------
dormant
dm_activityPublish
dm_activityApprove
dm_processdm_activity
Review
dm_activitySubmit
dm_workflow-----------------------
running
What’s happening during Start Workflow1) Start with workflow template* The workflow template objects: dm_process, a list of dm_activity objects2) Create workflow instance* Create a dm_workflow object* dm_workflow points to the workflow template dm_process* Save dm_workflow* dm_workflow is in Dormant state3) Run the workflow* Execute dm_workflow* dm_workflow is in Running state
Documentum Developer Conference 2001 9/9/01 12:43
Pang 16
Running A Simple WorkflowRunning A Simple WorkflowStart WorkflowStart Workflow
dm_workflow
dm_process
dm_activitySubmit
dmi_workitemSubmit
------------------dormant
dmi_packageSubmit - Doc A
dmi_queue_itemSubmit
dm_notecomment
Add package to start activitiesAdd package to start activities
Inbox----------
ΤΤΤΤ Submit
Task
What’s happening when add package to the workflow1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process* dm_workflow is in Running state3) Adding package to workflow triggers the start activities* Workflow receives the package* Required packages of the start activities are fulfilled, ready to start* Workflow engine creates the task objects: The task objects contains: dmi_workitem, peer dmi_queue_item,dmi_package to hold the document, dm_note to hold the user comments ifany* Task is in Dormant state4) Task in Inbox* Client Inbox queries dmi_queue_item for the user
Documentum Developer Conference 2001 9/9/01 12:43
Pang 17
Workflow Runtime StatesWorkflow Runtime States
ResumeResume
DormantDormantExecuteExecute
AbortAbort
HaltHalt AbortAbort
HaltedHalted TerminatedTerminated
FinishedFinished
RestartRestart
RunningRunning
WorkflowWorkflowterminationterminationcriteria is metcriteria is met
Initial stateInitial state
This diagram shows the the workflow states and the related API calls.API calls are in italic.
Initially workflow is in Dormant state. Once execute, it’s in Running state. Ifthe workflow runs smoothly to the end, it goes to Finished state.
If there are any error during the execution of the workflow, it becomesHalted state. You can continue the workflow by restart or resume.
At any time, you can abort the workflow and it changes to Terminated state.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 18
Running A Simple WorkflowRunning A Simple WorkflowStart WorkflowStart Workflow
Use Use IDfWorkflowBuilderIDfWorkflowBuilder in DFC in DFC' Create IDfWorkflowBuilder object.Set wfBuilder = session.newWorkflowBuilder(processId)' Save workflow.wfBuilder.initWorkflow' Set the workflow to run.wfBuilder.runWorkflow
' Add package to each start activity.docIdList.appendId docObjIdwfBuilder.addPackage activityNameStr,
portNameStr, pkgNameStr, pkgTypeStr, noteText,
notePersistent, docIdList
' Create IDfWorkflowBuilder object.Set wfBuilder = session.newWorkflowBuilder(processId)' Save workflow only once.wfBuilder.initWorkflow' < Any alias set thing goes here. Not covered in presentation. >' Set the workflow to run.wfBuilder.runWorkflow' < Set dynamic performer here. Will be covered in later slides.>
' Get start activities and their names to IDfList objects.' So now we can find out the packages for the start activities.Set actList = wfBuilder.getStartActivityIds()Set actNameList = wfBuilder.getStartActivityNames()
A more complete example for start workflow:
' Add document to each package in the start activitiesFor actIndex = 0 to (actList.getCount() - 1) ' Find activity object_id and activity name in the template. Set actId = sActivities.getId(actIndex) actName = sActivityNames.getString(actIndex) Set activity = session.getObject(actId)
' Find the number of packages. pkgCount = activity.getPackageCount() ' Get all the packages and insert the INPUT type pkgs For pkgIndex = 0 To (pkgCount - 1) If activity.getPortType(pkgIndex) = "INPUT" Then ' We have an INPUT package
' Retrieve all the relative data for setting package info. pkgName = activity.getPackageName(pkgIndex) pkgLabel = activity.getPackageLabel(pkgIndex) pkgType = activity.getPackageType(pkgIndex)
' Add package to each start activity. docIdList.appendId docObjId wfBuilder.addPackage activityNameStr, portNameStr,
pkgNameStr, pkgTypeStr, noteText, notePersistent,
docIdList Next pkgIndexNext actIndex
Documentum Developer Conference 2001 9/9/01 12:43
Pang 19
Running A Simple WorkflowRunning A Simple WorkflowComplete TaskComplete Task
1) Navigate to Inbox* Log on to Desktop Client* Navigate to Inbox2) Invoke Task Manager* Select task in the Inbox Task is in Dormant (ready) state* Invoke Task Manager by double click or Open menu item3) Task Manager Component* Task information* Document information and action* Comment reviewing, adding, deleting* Finish or reassign (delegate)4) Finish Dialog of Task Manager* Finish the task or also have someone else repeat the task* Signoff requirement
Documentum Developer Conference 2001 9/9/01 12:43
Pang 20
dmi_workitemApprove
------------------dormant
dmi_packageApprove-DocA
dmi_queue_itemApprove
dm_note
Inbox----------
ΤΤΤΤ Approve
dmi_workitemApprove
------------------acquired
Running A Simple WorkflowRunning A Simple WorkflowComplete TaskComplete Task
dm_workflow
dm_process
dm_activityApprove
(1) Task in Inbox(1) Task in Inbox(2) Acquire task(2) Acquire task(3) Complete task(3) Complete task
dmi_workitemApprove
------------------finished
Inbox----------
What’s happening when perform task in Inbox1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) Task in Inbox* The task objects contains: dmi_workitem, peer dmi_queue_item,dmi_package to hold the document, dm_note to hold the user comments ifany* Task is in Dormant state4) Open task in Task Manager* Task Manager acquires the task automatically* Task is in Acquired state5) Finish task in Task Manager* Task Manager finishes the task* Task is in Finished state* Task is dequeued from Inbox
Documentum Developer Conference 2001 9/9/01 12:43
Pang 21
dm_note
dmi_packageApprove - DocA
dmi_queue_itemApprove
dmi_workitemApprove
Running A Simple WorkflowRunning A Simple WorkflowComplete TaskComplete Task
dm_process
dm_activityPublish
dm_workflow
dmi_workitemPublish
--------------dormant
dmi_packagePublish - DocA
dmi_queue_itemPublish
Inbox----------
ΤΤΤΤ Publish
Create next task Create next task (task transition)(task transition)
What’s happening when server finishes one task and creates the next task1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process* Workflow records the previous task is finished* Workflow Engine creates the new task and points to the new task3) Previous task* The task objects contains: dmi_workitem, peer dmi_queue_item,dmi_package to hold the document, dm_note to hold the user comments ifany* Task is in Finished state* Task objects hangs around4) Next task* The task objects contains: new dmi_workitem, new peer dmi_queue_item,new dmi_package to hold the document, existing dm_note to hold the usercomments if any* Task is in Dormant state* Task appears in Inbox
Documentum Developer Conference 2001 9/9/01 12:43
Pang 22
Work Item Runtime StatesWork Item Runtime States
Resume/Resume/ReassignReassign
AcquiredAcquiredDormantDormant
PausePause
PausedPaused
FinishedFinishedAcquireAcquire CompleteComplete
ReassignReassign
D/A/P PausedD/A/P Paused
WF:HaltWF:Halt RestartRestart
RestartRestart
WF:HaltWF:Halt
RestartRestart
WF:HaltWF:Halt
This diagram shows the the work item states and the related API calls.API calls are in italic.
Initially work item is in Dormant state. Once acquired, it goes to Acquiredstate. If the work item completes, it becomes Finished.
If there are any error during the execution of the work item, it becomesPaused state. You can continue the work item by resume.
If at any time the workflow containing the work item is halted, the work itembecomes DPaused, APaused, or PPaused depending on the original state ofthe work item. Once get into D, A, or P Paused state, the work item will goback to its original state only if the workflow is restarted.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 23
Running A Simple WorkflowRunning A Simple WorkflowComplete TaskComplete Task
Use Use IDfWorkitemIDfWorkitem in DFC in DFC' Acquire work item (IDfWorkitem) to accept task.If (witem.getRuntimeState() = 0) Then ' 0 = dormant witem.acquireEnd If
' Sign off if needed.If (witem.isSignOffRequired() = TRUE) Then witemPersistenObj.signoff userOSNameStr,
passwdStr, "signoff task"
End If
' Finish the task.witem.complete
' Show the attached documents in the task.' Get all the associated packages into IDfCollection collectionSet collection = m_workItem.getPackages("")While (collection.Next()) Set typeObject = collection ' Attached documents are stored in r_component_id. docCount =typeObject.getValueCount("r_component_id") ' Some information about the package. packageName =typeObject.getString("r_package_name") packageObjId = typeObject.getString("r_object_id") For docIndex = 0 To (docCount - 1) Set docObjId = typeObject.getRepeatingId(
"r_component_id", docIndex) Set docObj = session.getObject(docObjId) docObjType = docObj.getString("r_object_type") Next docIndexWendcollection.CloseSet collection = Nothing
' Acquire the work item (IDfWorkitem) to accept the task.If (witem.getRuntimeState() = 0) Then ' 0 = dormant witem.acquireEnd If
' Delegate the task to user or group if necessary.If (witem.isDelegatable() = TRUE And chooseToDelegate) Then witem.delegateTask(delegateUserNameStr) ' Done with the task - So exit function here. Exit SubEnd If
' < Set dynamic performer here. Will be covered in later slides. >' < Set next activities here. Will be covered in later slides. >
' Sign off if needed.If (witem.isSignOffRequired() = TRUE) Then witemPersistenObj.signoff userOSNameStr, passwdStr, "signoff task"End If
' Repeat the task if necessary.If (witem.isRepeatable() = TRUE) Then ' Add user names to the IDfList userNameList. userNameList.appendString userName witem.repeat(userNameList)End If
' Finish the task.witem.complete
A more complete example for complete task:
Documentum Developer Conference 2001 9/9/01 12:43
Pang 24
Running Running AA Simple Workflow Simple WorkflowDelegate TaskDelegate Task
(1) Task in Inbox(1) Task in Inbox(2) Acquire task(2) Acquire task(3) Delegate task(3) Delegate task
dmi_workitemApprove
------------------dormant
Manager David
dmi_packageApprove-DocA
dmi_queue_itemApprove-------------
Manager David
dm_note
Inbox (David)---------------ΤΤΤΤ Approve
dm_workflow
dm_process
dm_activityApprove
dmi_workitemApprove
------------------acquired
Manager David
Inbox (David)---------------ΤΤΤΤ Approve
dmi_queue_itemApprove-------------
Manager David
dmi_workitemApprove
------------------dormant
Manager Martin
Inbox (Martin)---------------ΤΤΤΤ Approve
dmi_queue_itemApprove-------------
Manager Martin
What’s happening when delegate task in Inbox1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) Open Task in Task Manager from Inbox* The task objects contains: dmi_workitem, peer dmi_queue_item,dmi_package to hold the document, dm_note to hold the user comments ifany* Task changes from Dormant to Acquired state4) Reassign task in Task Manager* Workflow Engine changes the performer name in dmi_workitem anddmi_queue_item* Task reset to Dormant state* Task removes from original performer Inbox and appears in the newperformer Inbox
Documentum Developer Conference 2001 9/9/01 12:43
Pang 25
Running Running AA Simple Workflow Simple WorkflowRepeat TaskRepeat Task
(1) Task in Inbox(1) Task in Inbox(2) Acquire task(2) Acquire task(3) Repeat task(3) Repeat task(4) Complete task(4) Complete task
dm_process
dm_activityApprove
dm_workflow
dm_note
dmi_packageApprove - DocA
dmi_queue_itemApprove
--------------Daviddmi_workitem
Approve----------------
David, Dormant
Inbox (David)--------------ΤΤΤΤ Approve
dmi_workitemApprove
----------------David, Acquired
dmi_queue_itemApprove
--------------Martin
Inbox (Martin)--------------ΤΤΤΤ Approve
dmi_workitemApprove
----------------David, CompleteMartin, Dormant
Inbox (David)--------------
What’s happening when repeat task in Inbox1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) Open task in Task Manager from Inbox* The task objects contains: dmi_workitem, peer dmi_queue_item,dmi_package to hold the document, dm_note to hold the user comments ifany* Task changes from Dormant to Acquired state4) Repeat and finish task in Task Manager* Workflow Engine marks the original performer done with the task* Workflow Engine adds the new performer name to the dmi_workitem andcreates new dmi_queue_item for the new performer* Task removes from original performer Inbox and appears in the newperformer Inbox
Documentum Developer Conference 2001 9/9/01 12:43
Pang 26
AgendaAgenda
�� ConceptsConcepts�� Building a WorkflowBuilding a Workflow
�� Simple WorkflowSimple Workflow�� Path SelectionPath Selection�� Dynamic PerformerDynamic Performer
�� Advanced FeaturesAdvanced Features�� Workflow and LifecycleWorkflow and Lifecycle
Documentum Developer Conference 2001 9/9/01 12:43
Pang 27
Adding Path SelectionAdding Path Selection
�� Transition logic at Submit and ReviewTransition logic at Submit and Review�� Trigger logic at ReviseTrigger logic at Revise�� Archive will wait on an event notification before it startsArchive will wait on an event notification before it starts
Adding Peer Review such that multiple persons can review the document.Adding multiple Approve so that there can be multiple persons to sign off.Adding Archive activity.
Changing the basic workflow template to multiple paths with decision logicfor trigger and transition1) Activities* Transition logic at Submit and Review Allow the performer of Submit and Review to determine the next tasks* Trigger logic at Revise Allow Revise to start when any of the previous activity has finished* Archive will wait on an event for notifying Publish is done before it starts2) Flows* Reject flow from Review to Revise
Documentum Developer Conference 2001 9/9/01 12:43
Pang 28
Adding Path SelectionAdding Path SelectionSetting Transition ConditionSetting Transition Condition
1) Basics of the Transition tab* Determine what to do when the task is completed* Transition types: - all - all next tasks will be started - manual transition - performer chooses the next tasks (forward or reject) - auto transition - server picks the next tasks based on the conditiondefined
2) Set Submit task for manual transition* Select the Submit activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Transition tab* Check the appropriate radio button
Documentum Developer Conference 2001 9/9/01 12:43
Pang 29
Adding Path SelectionAdding Path SelectionSetting Trigger ConditionSetting Trigger Condition
1) Basics of the Trigger tab* Determine when to start this task* Trigger conditions: - all - all previous tasks are done - some - certain number of previous tasks are done - event - the task will not start until a certain event arrives* Number of times the activity can run
2) Set Revise task for manual transition* Select the Revise activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Trigger tab* Check the appropriate radio button and specify 1 input
Documentum Developer Conference 2001 9/9/01 12:43
Pang 30
Adding Path SelectionAdding Path SelectionReject PathReject Path
There is no build-in reject path as compared to router. So you have to addthe reject paths explicitly.
1) Set Review task for manual transition* Select the Review activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Transition tab* Check the appropriate radio button
Documentum Developer Conference 2001 9/9/01 12:43
Pang 31
Adding Path SelectionAdding Path SelectionEvent TriggerEvent Trigger
1) Set Archive task for event transition* Select the Archive activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Trigger tab* Check the wait on event check box and specify an event name
Documentum Developer Conference 2001 9/9/01 12:43
Pang 32
Managing Path SelectionManaging Path SelectionSelect Next TasksSelect Next Tasks
1) Navigate to Inbox* Log on to Desktop Client* Navigate to Inbox2) Invoke Task Manager* Select task in the Inbox* Invoke Task Manager by double click or Open menu item* Task changes from Dormant to Acquired state3) Finish Dialog of Task Manager* Finish the task by selecting the next activities
Documentum Developer Conference 2001 9/9/01 12:43
Pang 33
Managing Path SelectionManaging Path SelectionSelect Next TasksSelect Next Tasks
(1) Acquire task (1) Acquire task as usualas usual
(2) Select next tasks(2) Select next tasks(3) Complete task (3) Complete task
as usualas usual
dmi_workitemReview
--------------
dmi_packageReview - DocA
dmi_queue_itemReview
Inbox----------
ΤΤΤΤ Review
dm_activityReview
dm_activityApprove2
dm_activityApprove1
dm_activityRevise
dm_process
dm_workflowdmi_workitem
Review--------------
Next Task = Revise
What’s happening during select next tasks1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) Open task in Task Manager from Inbox* The task objects contains: dmi_workitem, peer dmi_queue_item,dmi_package to hold the document, dm_note to hold the user comments ifany* Task changes from Dormant to Acquired state4) Select next tasks and finish* Workflow Engine marks the selected next tasks to the current work item* Task Manager finishes the task* Task is in Finished state* Task is dequeued from Inbox
Documentum Developer Conference 2001 9/9/01 12:43
Pang 34
Managing Path SelectionManaging Path SelectionSelect Next TasksSelect Next Tasks
Use Use IDfWorkitemIDfWorkitem::::setOutput setOutput in DFCin DFC' Acquire work item (IDfWorkitem) to accept task.If (witem.getRuntimeState() = 0) Then ' 0 = dormant witem.acquireEnd If
’ Determine transition type.If (witem.isManualTransition() = TRUE) Then ' Get the activity and add it to the IDfList of next acts. outList.append activityObj ' Add the forward/reject activities to the output. witem.setOutputByActivities outListEnd If
' Finish the task.witem.complete
' Acquire the work item (IDfWorkitem) to accept the task.If (witem.getRuntimeState() = 0) Then ' 0 = dormant witem.acquireEnd If
' < Set dynamic performer here. Will be covered in later slides. >
'Determine transition type.If (witem.isManualTransition() = TRUE) Then ' Get the possible forward activities into IDfList. Set forwardActObjs = witem.getForwardActivities() ' Get the rejectable activities into IDfList. Set rejectActObjs = witem.getRejectActivities()
' Loop the forward and reject activities and ' decide which paths to take.
' Get the activity and add it to the IDfList of next acts. outList.append activityObj ' Add the forward/reject activities to the output. witem.setOutputByActivities outListEnd If
' Sign off if needed.If (witem.isSignOffRequired() =TRUE) Then witemPersistenObj.signoffuserOSNameStr, passwdStr, "signofftask"End If
' Repeat the task if necessary.If (witem.isRepeatable() = TRUE)Then ' Add user names to the IDfListuserNameList. userNameList.appendStringuserName witem.repeat(userNameList)End If
' Finish the task.witem.complete
A more complete example with select output path:
Documentum Developer Conference 2001 9/9/01 12:43
Pang 35
Managing Path SelectionManaging Path SelectionTrigger And Transition SettingsTrigger And Transition Settings
(1) Determine next tasks:(1) Determine next tasks: - All, manual or auto transition - All, manual or auto transition(2) Trigger conditions (2) Trigger conditions
of next tasksof next tasks(3) Task transition(3) Task transition
dmi_packageCurrent
dmi_queue_itemCurrent
dmi_workitemCurrent-----------finished
dmi_packageNext
dmi_queue_itemNext Inbox
----------ΤΤΤΤ Next
dmi_workitemNext
-----------dormant
(3)Create New Task
dm_activityCurrent
dm_activityNext
dm_process
dm_workflow
(2)Fulfill Trigger Conditions?
(1)Transition Condition: All, Manual, Auto?
What’s happening during task transition and triggering1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) The current task is finished* Task is in Finished state* Check the corresponding activity definition* Determine if the transition is all, manual, or auto* Find out the next task based on the transition conditions4) Before creating the next task* Check the corresponding activity definition* Determine if the trigger conditions are fulfilled: number of previous finishedtasks, wait on event* Workflow Engine waits if the trigger conditions are not fulfilled5) Create the new task
Documentum Developer Conference 2001 9/9/01 12:43
Pang 36
Managing Path SelectionManaging Path SelectionSend Event to WorkflowSend Event to Workflow
Use Use IDfSessionIDfSession::queue in DFC::queue in DFCFunction MyPublishApplication … Publish Job here …
Set sysObject = workflowObject Set queueId = sysObject.queue(toUserName,
eventNameStr, priorityInt, sendMailBool,
dueDate, messageStr) ...End Function
This wait on event mechanism is useful when you have a task that has to beperformed externally to DCTM system.
You will have a task (Publish) to notify the external agent and then finish tothe next task. It will be the next task to wait for the finish event of theexternal agent. The external agent will perform its operation. When theexternal agent is done with the task, it simply notifies the workflow bysending a finish event. Once the workflow receives the event, the next task(Archive) will be triggered.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 37
AgendaAgenda
�� ConceptsConcepts�� Building a WorkflowBuilding a Workflow
�� Simple WorkflowSimple Workflow�� Path SelectionPath Selection�� Dynamic PerformerDynamic Performer
�� Advanced FeaturesAdvanced Features�� Workflow and LifecycleWorkflow and Lifecycle
Documentum Developer Conference 2001 9/9/01 12:43
Pang 38
Dynamic Performer SelectionDynamic Performer Selection
�� Submit chooses performer of Submit chooses performer of PeerReviewPeerReview�� Performer for Approve will be the manager of the performer ofPerformer for Approve will be the manager of the performer of
ReviewReview
Changing Peer Review and Review from multiple to one activity.Changing their performers to be assigned dynamically.
Changing the multi-path workflow template to single path with dynamicperformer1) Activities* Peer Review (performer to be chosen in Submit) Submit task performer will choose some users to perform on Peer Review* Review (performer to be resolved from previous task performer) Review will be performed by Revise performer’s manager
Documentum Developer Conference 2001 9/9/01 12:43
Pang 39
Dynamic Performer SelectionDynamic Performer SelectionPeer ReviewPeer Review
1) Basics of the Select Performer Wizard* performer types* Performer values: - Real user name - To be picked at runtime by some previous activities - To be resolved from alias set of document or previous performer
2) Set Peer Review performer to be select at runtime by Submit* Select the Peer Review activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Performer tab* Select Some Users from Group* Select to be assigned at runtime in activity Submit* Next to select a default group name* Define a real default group name
Documentum Developer Conference 2001 9/9/01 12:43
Pang 40
Managing Dynamic PerformerManaging Dynamic Performer
1) Navigate to Inbox* Log on to Desktop Client* Navigate to Inbox2) Invoke Task Manager* Select task in the Inbox* Invoke Task Manager by double click or Open menu item* Task changes from Dormant to Acquired state3) Finish Dialog of Task Manager* Select performers for Peer Performer task* Choose any number of users from the predefined group* Finish task
Documentum Developer Conference 2001 9/9/01 12:43
Pang 41
dm_workflow
dm_workflow----------------
PeerReview - UserAPeerReview - UserB
Managing Dynamic PerformerManaging Dynamic Performer
dmi_workitemSubmit
dmi_packageSubmit - DocA
dmi_queue_itemSubmit
Inbox----------
ΤΤΤΤ Submit
dm_activitySubmit
dm_activityPeerReview
dm_process---------------
Submit->PeerReview
(1) Acquire task as usual(1) Acquire task as usual(2) Select dynamic performers(2) Select dynamic performers(3) Complete task as usual(3) Complete task as usual
What’s happening during select dynamic performers1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) Open task in Task Manager from Inbox* The task objects contains: dmi_workitem, peer dmi_queue_item,dmi_package to hold the document, dm_note to hold the user comments ifany* Task changes from Dormant to Acquired state4) Select dynamic performer* Workflow Engine marks the selected performers for Peer Review indm_workflow object5) Finish task* Task Manager finishes the task* Task is in Finished state* Task is dequeued from Inbox
Documentum Developer Conference 2001 9/9/01 12:43
Pang 42
Managing Dynamic PerformerManaging Dynamic Performer
dm_workflow----------------
PeerReview - WriterGreenPeerReview - WriterCooley
dm_activitySubmit
dm_activityPeerReview
dm_process---------------
Submit->PeerReview
dmi_packagePeerReview -
DocA
dmi_queue_itemPeerReview
dmi_workitemPeerReview
-------------WriterGreen
dmi_packagePeerReview -
DocA
dmi_queue_itemPeerReview
dmi_workitemPeerReview--------------
WriterCooley
Inbox (WriterCooley)----------------
ΤΤΤΤ PeerReview
Inbox (WriterGreen)----------------
ΤΤΤΤ PeerReview
Task transition when using dynamic performerTask transition when using dynamic performer
What’s happening during task transition using dynamic performer1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) The next task is determined* See detail in Task Transition for Trigger and Transition in previous slides4) Before creating the next task* Check the corresponding activity definition* Determine if the performer is determined dynamically* Workflow Engine reads the performer selection from dm_workflow object5) Create the new tasks
Documentum Developer Conference 2001 9/9/01 12:43
Pang 43
Managing Dynamic PerformerManaging Dynamic Performer
Using Using IDfWorkflowIDfWorkflow::::setPerformerssetPerformers in DFC in DFC' Acquire the work item (IDfWorkitem) to accept the task.If (witem.getRuntimeState() = 0) Then ' 0 = dormant witem.acquireEnd If
' Set dynamic performer if required.nameList.appendString performerNameworkflow.setPerformers actName, nameList
' Finish the task.witem.complete
' Find the act_choose_by entries for the current activity name.actChooseCount = process.getActChooseByCount()For actChooseIndex = 0 To actChooseCount - 1 actChooseBy = processObj.getActChooseBy(actChooseIndex) If (StrComp(actChooseBy, currActivityName) = 0) Then actChooseFor =processObj.getActChooseFor(actChooseIndex)
' Find the "select from" group value. It's the performer_name ' in the activity object. If it's an alias name, need to resolve ' alias to figure out the group value.
' Obtain the activity object. Set processPersistentObj = processObj locateIndex = processPersistentObj.apiGet("locate", "r_act_name," & currActivityName) Set actObjId = processObj.getActivityDefId(locateIndex) Set actObj = session.GetObject(actObjId)
' Find out the performer type and name for the activity. perfType = actObj.getPerformerType groupValue = actObj.getPerformerName
' Find out the default group if choosing for "some users from group". If (perfType = 8 And InStr(groupValue, "%") = 1) Then ' Need to check if the default group is an alias name ' Then resolve alias before setting it.
' Try to resolve the alias. Set wfPerObj = workflow groupValue = session.resolveAlias(wfPerObj.getObjectId(), groupValue) End If defaultPerfGroup = groupValue
' Find out the user should choose "one or more user values" ' or a group value. If (perfType = 3) Then ' 3 = specific user chooseType = CHOOSE_SINGLE_USER_FROM_ALL_USERS ElseIf (perfType = 4) Then ' 4 = all users in group chooseType = CHOOSE_SINGLE_GROUP_FROM_ALL_GROUPS ElseIf (perfType = 5 Or perfType = 6) Then ' 5,6 = single user in group chooseType = CHOOSE_SINGLE_GROUP_FROM_ALL_GROUPS ElseIf (perfType = 8) Then ' 8 = some users in group chooseType = CHOOSE_ANY_FROM_DEFAULT_GROUP End If
' Provide interface for user to choose the dynamic performers.
End IfNext actChooseIndex
A more complete example for displaying dynamic performer to choose from:
Documentum Developer Conference 2001 9/9/01 12:43
Pang 44
Performer AliasPerformer AliasReviewReview
Assume the user has alias set which contains the manager alias.
1) Basics of the performer alias options in Select Performer Wizard* Workflow initiator defines* Resolve from specific alias set* Resolve from document’s alias set* Resolve from previous performer’s alias set
2) Set Review performer to be resolved at runtime from previous performer’salias set* Select the Review activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Performer tab* Select Specific User* Select to be resolved from alias set at runtime* Next to select resolve from previous performer
Documentum Developer Conference 2001 9/9/01 12:43
Pang 45
dmi_packageRevise - DocA
dmi_queue_itemRevise
dmi_workitemRevise
-------------WriterMary
Task transition when using performer aliasTask transition when using performer alias
Managing Performer AliasManaging Performer Alias
dm_activityRevise
Inbox----------
ΤΤΤΤ Review
dm_activityReview
-----------------%manager
resolved from prev perf
dm_user WriterMary
dm_alias_set--------------------------
manager = ManagerDavid
dmi_packageReview - DocA
dmi_queue_itemReview
dmi_workitemReview
----------------ManagerDavid
dm_process
dm_workflow
What’s happening during task transition using performer alias1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) The next task is determined* See detail in Task Transition for Trigger and Transition in previous slides4) Before creating the next task* Check the corresponding activity definition* Determine if the performer is determined from alias set* Workflow Engine resolves the alias name to a real user or group accordingto the resolution setting5) Create the new tasks
Documentum Developer Conference 2001 9/9/01 12:43
Pang 46
AgendaAgenda
�� ConceptsConcepts�� Building a Complex WorkflowBuilding a Complex Workflow�� Advanced FeaturesAdvanced Features
�� Automated ActivitiesAutomated Activities�� Distributed workflowDistributed workflow
�� Workflow and LifecycleWorkflow and Lifecycle
Documentum Developer Conference 2001 9/9/01 12:43
Pang 47
Automatic TaskAutomatic Task
�� Publish and Archive become autoPublish and Archive become autotaskstasks
�� Publish and Archive become autoPublish and Archive become autotaskstasks
�� Publish and Archive become auto tasksPublish and Archive become auto tasks
Changing Publish and Archive into automatic tasks1) Activities* Publish and Archive Change to auto task to run workflow methods
Documentum Developer Conference 2001 9/9/01 12:43
Pang 48
Adding Automatic TaskAdding Automatic Task
Assuming Publish will be done in the lifecycle Action during document promote==> Publish = Promote in WF
1) Basics of the Performer tab in Auto Mode* Performer* Execution method* Execution result* Execution time – how long the server should run the method before timing out* Error handling
2) Set Publish to automatic activity* Select the Publish activity* Bring up the Activity Inspector by double click, menu item, or toolbar* Go to Performer tab* Select perform automatically* Select user in Select Performer Wizard* Select Promote method, save result, 60 seconds, and stop execution (60 sechas to be between the min and max attribute values on dm_method)
Documentum Developer Conference 2001 9/9/01 12:43
Pang 49
Managing Automatic TaskManaging Automatic Task
Inbox----------
dm_methodPublishMethod
dm_sysobjectPublish -
Execution Log
dmi_workitemPublish
dmi_packagePublish - DocA
No Queue Item for Automatic Task!
Automatic taskAutomatic task
dm_activityPublish
dm_process
dm_workflow
What’s happening during select dynamic performers1) The usual workflow template objects* The workflow template objects: dm_process, a list of dm_activity objects2) The workflow instance* dm_workflow which points to the workflow template dm_process3) Automatic task is created* The task objects contains: dmi_workitem, dmi_package to hold thedocument, dm_note to hold the user comments if any* No peer dmi_queue_item* Task references its auto method4) Executing automatic task* Workflow Engine runs the method defined in dm_activity* Method acquires and completes the task* Workflow Engine saves execution log and handles error according to thedm_activity definition
Documentum Developer Conference 2001 9/9/01 12:43
Pang 50
Workflow Automatic ActivitiesWorkflow Automatic Activities
Basic code structureBasic code structureSub MyAutoMethod(ByVal stub1 As String, ByVal docbase As String, _ ByVal stub2 As String, ByVal user As String, _ ByVal stub3 As String, ByVal workItemId As String, _ ByVal stub4 As String, ByVal ticket As String, _ ByVal stub5 As String, ByVal mode As String) ' Session connection. ... ' Get work item object. Set workItem = session.GetObject(clientX.getId(workItemId)) ' Acquire the work item. workItem.acquire ' Custom operations go here. ... ' Complete the workitem. workItem.completeEnd Sub
Sub MyAutoMethod(ByVal stub1 As String, ByVal docbase As String, _ ByVal stub2 As String, ByVal user As String, _ ByVal stub3 As String, ByVal workItemId As String, _ ByVal stub4 As String, ByVal ticket As String, _ ByVal stub5 As String, ByVal mode As String)On Error GoTo MyAutoMethod_Error Dim clientX As Object 'dfclib.DfClientX Dim client As Object 'IDfClient Dim errorMsg as String Dim session As Object 'IDfSession Dim workItem As Object Dim workItemIdObj As Object
' Get a session. errorMsg = "Connecting to docbase" Set clientX = CreateObject("Documentum.Dfc") Set loginInfo = clientX.getLoginInfo() loginInfo.setUser user logininfo.setPassword ticket Set client = clientX.getLocalClient() Set session = client.getSharedSession(docbase, loginInfo,
"WF_Auto_Method")
' Get work item id object. errorMsg = "Getting work item id object" Set workItemIdObj = clientX.getId(workItemId) ' Get work item object. errorMsg = "Getting work item object" Set workItem = session.GetObject(workItemIdObj)
' Acquire the work item only when mode = "0" for not restarting. If mode = "0" Then errorMsg = "Acquiring work item" workItem.acquire End If
' My custom operations go here.
' Complete the workitem. Assume there is only ' one output port for this task. errorMsg = "Completing work item" workItem.complete
Exit SubMyAutoMethod_Error: Print errorMsg ' This message will go to the result log. dmExit (100)End Sub
A more complete example for writing a workflow method:
Documentum Developer Conference 2001 9/9/01 12:43
Pang 51
Workflow Automatic ActivitiesWorkflow Automatic Activities
�� Sample methodSample method�� Promote LifecyclePromote Lifecycle
Documentum Developer Conference 2001 9/9/01 12:43
Pang 52
' (c) Copyright Documentum, Inc., 2001' WF_PromoteLifeCycle' -- This method is used for Workflow. It acquires the work item,' promotes all documents of the current work item, and completes' the work item.Sub PromoteLifeCycle(ByVal stub1 As String, ByVal docbase As String, ByVal stub2 As String, _
ByVal user As String, ByVal stub3 As String, ByVal workItemId As String, _ ByVal stub4 As String, ByVal ticket As String, ByVal stub5 As String, ByVal mode As String)
On Error GoTo PromoteLifeCycle_Error Dim clientX As Object 'dfclib.DfClientX Dim client As Object 'IDfClient Dim doc, docIdObj, packageCollection, session, workItem As Object Dim docIdStr, errorMsg, lifeCycleState as String Dim lifeCycleOverride, lifeCycleTestOnly as Boolean
lifeCycleState = "" ' Promote to the next default state. lifeCycleOverride = False lifeCycleTestOnly = False
' Get a session. Set clientX = CreateObject("Documentum.Dfc") Set loginInfo = clientX.getLoginInfo() loginInfo.setUser user logininfo.setPassword ticket Set client = clientX.getLocalClient() Set session = client.getSharedSession(docbase, loginInfo, "WF_Auto_Method")
' Get work item object. Set workItem = session.GetObject(clientX.getId(workItemId)) ' Acquire the work item only when mode = "0" for not restarting. If mode = "0" Then workItem.acquire End If
' Promote document life cycle for each document. Set packageCollection = workItem.getPackages("") While packageCollection.Next docIdStr = packageCollection.getString("r_component_id") Set docIdObj = clientX.getId(docIdStr) Set doc = session.GetObject(docIdObj) doc.promote lifeCycleState, lifeCycleOverride, lifeCycleTestOnly Wend packageCollection.Close
' Complete the workitem. Assume there is only one output port for this task. workItem.complete
Exit SubPromoteLifeCycle_Error: Print errorMsg dmExit (100)End Sub
Documentum Developer Conference 2001 9/9/01 12:43
Pang 53
Workflow Automatic ActivitiesWorkflow Automatic Activities
�� When there is an execution error inWhen there is an execution error inautomatic taskautomatic task�� Stop Execution - Task will be put in PausedStop Execution - Task will be put in Paused
state and reassigned to Workflow Supervisorstate and reassigned to Workflow Supervisor�� Continue Execution - Task will be continuedContinue Execution - Task will be continued
to the next taskto the next task�� What should a Workflow Supervisor doWhat should a Workflow Supervisor do
when error occurswhen error occurs�� Check execution resultsCheck execution results�� Fix the problemFix the problem�� Rerun the task!Rerun the task!
Documentum Developer Conference 2001 9/9/01 12:43
Pang 54
Workflow Automatic ActivitiesWorkflow Automatic Activities
1) Navigate to Inbox* Log on to Desktop Client* Navigate to Inbox2) Invoke Task Manager* Select task in the Inbox* Invoke Task Manager by double click or Open menu item* Notice the add-on to the instruction by the Desktop Client Task Manager3) Finish task* Showing the execution log* Finish task by choosing either to - rerun the automatic method - no more human interaction - or, manually complete the task - get the normal Finish Dialog
Documentum Developer Conference 2001 9/9/01 12:43
Pang 55
AgendaAgenda
�� ConceptsConcepts�� Building a Complex WorkflowBuilding a Complex Workflow�� Advanced FeaturesAdvanced Features
�� Automated ActivitiesAutomated Activities�� Distributed workflowDistributed workflow
�� Workflow and LifecycleWorkflow and Lifecycle
Documentum Developer Conference 2001 9/9/01 12:43
Pang 56
Distributed WorkflowDistributed Workflow
�� DistributedDistributed�� route a foreign documentroute a foreign document�� route to a remote userroute to a remote user
�� Federated environmentFederated environment�� notion of home Docbasenotion of home Docbase�� users, groups, types, and users, groups, types, and ACLs ACLs are known to allare known to all
participating participating DocbasesDocbases�� Workflow definitions, workflow initiator, and allWorkflow definitions, workflow initiator, and all
runtime objects are all in single Docbaseruntime objects are all in single Docbase�� Only queue item is replicated to user’sOnly queue item is replicated to user’s
homehome DocbaseDocbase
When a work item is assigned to a remote user, a work item and the peerqueue item are generated in the Docbase where the process definition andthe containing workflow reside.
The notification agent for the source Docbase replicates the queue item inthe user’s home Docbase. Using these queue items, the home Inboxconnects to the source Docbase and retrieves all information necessary forthe user to perform the work item tasks. A remote user must be able toconnect to the source Docbase to work on a replicated queue item.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 57
AgendaAgenda
�� ConceptsConcepts�� Building a Complex WorkflowBuilding a Complex Workflow�� Advanced FeaturesAdvanced Features�� Workflow and LifecycleWorkflow and Lifecycle
�� Lifecycle ProceduresLifecycle Procedures
Documentum Developer Conference 2001 9/9/01 12:43
Pang 58
Workflow And LifecycleWorkflow And Lifecycle�� A Document can have only lifecycle at aA Document can have only lifecycle at a
given timegiven time�� It can participate in many workflow processesIt can participate in many workflow processes�� Lifecycle allows us to factor out the documentLifecycle allows us to factor out the document
policy from the processpolicy from the process�� Lifecycle and Workflow often work inLifecycle and Workflow often work in
conjunction to produce the desired systemconjunction to produce the desired systembehaviorbehavior
LifecycleLifecycle WorkflowWorkflow
Documentum Developer Conference 2001 9/9/01 12:43
Pang 59
Workflow And LifecycleWorkflow And LifecycleApplication 1Application 1
Start WFStart WF PromotePromote
In ReviewIn Review PublishedPublishedAuthorAuthor ArchivedArchived
ReviewReview
SS EEApproveApprove PublishPublishSubmitSubmit
In ReviewIn Review PublishedPublished
ReviewReview
ApproveApprove PublishPublish
Example using document Lifecycle to drive Workflow process* When document is promoted from Author to In Review state, the statetransition logic of In Review triggers to start workflow, providing thedocument as the content for the workflow* The workflow continues to Submit, Review, Approve and Publish* Publish invokes the promote Lifecycle method. The document is promotedto Published state from In Review state
Documentum Developer Conference 2001 9/9/01 12:43
Pang 60
Workflow And LifecycleWorkflow And LifecycleApplication 2Application 2
PromotePromote
In ReviewIn Review PublishedPublishedAuthorAuthor ArchivedArchivedIn ReviewIn Review PublishedPublished
Auto PromoteAuto Promote
ReviewReviewSS
ApproveApprove
PublishPublishSubmitSubmit ReviewReview
ApproveApprove
PublishPublish
PromotePromote
Auto PromoteAuto Promote
Example using Workflow process to drive document Lifecycle* Starting from a workflow, after the document is submitted, workflow runsan automatic promote Lifecycle task on the document* Document is promoted from Author to In Review state* The workflow continues to Review, Approve and Publish* Publish invokes the promote Lifecycle method. The document is promotedto Published state from In Review state
Documentum Developer Conference 2001 9/9/01 12:43
Pang 61
Lifecycle TransitionLifecycle TransitionPromotePromote
StartStart(Begin Transaction)(Begin Transaction)
Entry CriteriaEntry Criteria
Success?Success?
ActionAction
Post ActionPost Action
Success?Success?NoNo
NoNo
YesYes
YesYes
EndEnd(Abort Transaction)(Abort Transaction)EndEnd
(Commit Transaction)(Commit Transaction)
Change Lifecycle StateChange Lifecycle State
During the promote, server goes through a sequence of tests/standardactions/procedures as defined in a state of a Lifecycle. These steps aredone in a transaction.
For each state of a Lifecycle, there are Entry Criteria, Action, and PostAction. You can define the transition tests, standard actions and/orprocedures for each of these steps in DDS.
During a promotion, the Entry Criteria will be executed. If it fails, thetransaction will be aborted and the promotion fails.
If the Entry Criteria succeeds, the Lifecycle state of the document will bechanged to the next state. And then the Actions will be executed. If it fails,the transaction will be aborted and the promotion fails.
After Actions, the Post Actions will be executed and the transaction will becompleted. The promotion does not depend on the result of the PostActions.
Documentum Developer Conference 2001 9/9/01 12:43
Pang 62
Lifecycle ProceduresLifecycle Procedures
�� Sample procedureSample procedure�� launching Workflow from Lifecyclelaunching Workflow from Lifecycle
Documentum Developer Conference 2001 9/9/01 12:43
Pang 63
' (c) Copyright Documentum, Inc., 2001' Sample_Lifecycle_StartWF' -- This script launches the workflow Sample_WF_Lifecycle_Template' with the document attached to this document life cycle.' This function has to be called EntryCriteria.' This is used in the Entry Criteria procedure of life cycle' Sample_Lifecycle_For_WF.' The returned value of EntryCriteria will be false if error' is encountered; true, otherwise.Public Function EntryCriteria(ByVal SessionID As String, _ ByVal ObjectId As String, _ ByVal UserName As String, _ ByVal TargetState As String, _ ByRef ErrorStack As String) As BooleanOn Error GoTo EntryCriteria_Error Dim clientX as Object 'dfclib.DfClientX Dim client as Object 'IDfClient Dim session as Object 'IDfSession Dim process as Object 'IDfProcess Dim wfBuilder as Object 'IDfWorkflowBuilder Dim docId, actId, processId as Object 'IDfId Dim docIdList, actIdList, actNameList as Object 'IDfList Dim act as Object 'IDfActivity Dim actCount, actIndex, pkgCount, pkgIndex as Integer Dim actName, portName, portType, pkgName, pkgLabel, _ pkgType, queryString as String
' Get a session. ErrorStack = "Getting session" Set clientX = CreateObject("Documentum.Dfc") Set client = clientX.getLocalClient() Set session = client.adoptDMCLSession(SessionID)
' Get the workflow template object id. ErrorStack = "Getting workflow template id" queryString = "dm_process where object_name ='Sample_WF_Lifecycle_Template'" Set processId = session.getIdByQualification(queryString)
' Create workflow builder with corresponding process. ErrorStack = "Creating new workflow builder with process id = " + _ processId.toString() Set wfBuilder = session.newWorkflowBuilder(processId)
' Assume there is no performer aliasing in workflow. ErrorStack = "Initializing workflow" dfcVersion = clientX.getDFCVersion If InStr(1, dfcVersion, "4.1", 1) = 1 Then wfBuilder.initWorkflow ErrorStack = "Running workflow" wfBuilder.runWorkflow Else wfBuilder.startWorkflow ' For 4.0.X docbase End If
' Set package for workflow activities. ' Assume there is only one package going ' to all starting activities.
' Prepare the doc id list for add package. ErrorStack = "Creating document id list" Set docIdList = clientX.getList() Set docId = clientX.getId(ObjectId) docIdList.appendId docId
' Find out start activities id and names. ErrorStack = "Getting workflow start activity ids" Set actIdList = wfBuilder.getStartActivityIds() ErrorStack = "Getting workflow start activity names" Set actNameList = wfBuilder.getStartActivityNames()
' For each start activity/package, add package. ErrorStack = "Looping start activities to add package" actCount = actIdList.getCount For actIndex = 0 To actCount - 1 ErrorStack = "Getting workflow start activity index =" _ + Str(actIndex) Set actId = actIdList.getId(actIndex) Set act = session.getObject(actId)
actName = actNameList.getString(actIndex) pkgCount = act.getPackageCount() For pkgIndex = 0 To pkgCount - 1 portType = act.getPortType(pkgIndex) If portType = "INPUT" Then portName = act.getPortName(pkgIndex) pkgName = act.getPackageName(pkgIndex) pkgLabel = act.getPackageLabel(pkgIndex) pkgType = act.getPackageType(pkgIndex)
' Attach the current document. ErrorStack = "Adding package to activity=" + _ actName + ",pkgName=" + pkgName wfBuilder.addPackage actName, portName, _ pkgName, pkgType, _
"This is a note", False, _ docIdList End If Next pkgIndex Next actIndex
' Sucess and done. EntryCriteria = True Exit FunctionEntryCriteria_Error: ' Error handling. Print ErrorStack EntryCriteria = FalseEnd Function
Documentum Developer Conference 2001 9/9/01 12:43
Pang 64
Questions?Questions?
Documentum Developer Conference 2001 9/9/01 12:43
Pang 65
SummarySummary
�� Workflow featuresWorkflow features�� Build a complex workflowBuild a complex workflow�� Run workflow using DFCRun workflow using DFC�� Server runtime object detailServer runtime object detail
�� Using Workflow and LifecycleUsing Workflow and Lifecycletogethertogether
Documentum Developer Conference 2001 9/9/01 12:43
Pang 66
Workflow TeminologyActivity (design time)- task definition, included in a workflow templateDynamic Performer (both design and run time)- performer to be defined at runtimeFlow or Link (design time)- connects two activitiesPackage (both design and run time)- design time - store the definition for the routing documents- run time - a placeholder to store the routing documents and commentsPerformer (both design and run time)- user or group who works on the task in workflowPerformer Alias (both design and run time)- performer defined in an alias representationPort (design time)- part of the activity definition, placeholder for a link. From activity’s point ofview, it only sees ports but not linksTask (run time)- a logical step of work in a workflow at runtimeWorkflow Instance (run time)- workflow at runtimeWorkflow Template (design time)- workflow definition set up at design time