Branching on Document Type
This topic provides a sample for routing a business object based on the type of document.
Referenced Workflow
BranchOnDocumentType.xml
Description
The expression below checks for the type of the document and branches to one of four routing events. Typically, a document can be Requirements, Specification, Document, or TestPlan. The primaryBusinessObject is assumed to be life cycle managed.
Instructions
Replace the <routing event> tags with the routing events you want to define for your workflow template and specify the document type from which you want to branch.
For more information about document types, see wt.doc.DocumentTypeRB.java.
Copy the following code, beginning with next line:
//retrieve document type of the PBO wt.doc.DocumentType docType = ((( wt.doc.WTDocument )primaryBusinessObject). getDocType( ));
//check for document type of PBO . Note how the type is given as "$$Specification". This is how the type is stored in the //database.
if ( docType==wt.doc.DocumentType.toDocumentType( "$$Specification") )
result= "<routing event>";
else if ( docType==wt.doc.DocumentType.toDocumentType( "$$Requirements") )
result= "<routing event>";
else if ( docType==wt.doc.DocumentType.toDocumentType( "$$Document") )
result= "<routing event>"; else result= "<routing event>";