基础管理 > 支持协作 > 工作流管理 > 工作流工具 > 工作流模板管理 > 工作流代码示例 > 路由示例 > 按文档类型分支
  
按文档类型分支
本主题提供了根据文档类型路由业务对象的一个示例。
参考工作流
BranchOnDocumentType.xml
说明
下面的表达式检查文档的类型,然后分支到四个路由事件中的一个事件。通常,文档可以是“需求”、“规范”、“文档”或“测试计划”。假定 primaryBusinessObject 由生命周期管理。
指示
使用要为工作流模板定义的路由事件替换 <routing event> 标记,并指定要从中创建分支的文档类型。
有关文档类型的详细信息,请参阅 wt.doc.DocumentTypeRB.java。
从下一行开始,复制以下代码:
//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>";