bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > WebLogic Platform > WebLogic Integration > BPM Topics > Programming BPM Client Apps > Creating and Managing Workflow Template Definitions |
Programming BPM Client Apps
|
Creating and Managing Workflow Template Definitions
A workflow template definition specifies the operations of a business process. One or more definitions can be created for each workflow template.
This section explains how to create and manage workflow template definitions, including the following topics:
For more information about the methods described in this section, see the com.bea.wlpi.server.admin.Admin Javadoc. For information about managing workflow templates definitions using the WebLogic Integration Studio, see Defining Workflow Templates in Using the WebLogic Integration Studio.
Creating a Template Definition
To create a workflow template definition, use one of the following com.bea.wlpi.server.admin.Admin methods.
Method 1
public java.lang.String createTemplateDefinition(
java.lang.String templateId,
java.lang.String name,
java.lang.String xml
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
Method 2
public java.lang.String createTemplateDefinition(
java.lang.String templateId,
java.lang.String name,
java.lang.String xml,
java.lang.Object transactionId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The first method can be used in a nonclustered environment. The second method is recommended for use in a clustered environment. In this case, using the specified transaction ID, the system tracks the method execution status so that the method is not reissued after the transaction is committed, or in the event of a server crash or failover.
The following table describes the createTemplateDefinition() method parameters for which you must specify values.
The method returns the ID of the new template definition. For example, the following code creates a new template definition named Order Processing based on the orderprocessing.xml file. In this example, admin represents the EJBObject reference to the Admin EJB. The template ID is obtained using the methods associated with the com.bea.wlpi.common.TemplateInfo object, template. The template object can be obtained using the methods described in Getting a Template. For more information about the createTemplateDefinition() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
String id = admin.createTemplateDefinition(
template.getId(),"Order Processing", "orderprocessing.xml");
Getting Template Definition Information
To get a workflow template definition, use the following com.bea.wlpi.server.admin.Admin method:
public com.bea.wlpi.common.TemplateDefinitionInfo getTemplateDefinition(
java.lang.String templateDefinitionId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the getTemplateDefinition() method parameter for which you must specify a value.
The method returns a com.bea.wlpi.common.TemplateDefinitionInfo object. To access information about the template definition, use the TemplateDefinitionInfo object methods described in TemplateDefinitionInfo Object. For example, the following code gets the template definition associated with the specified ID. In this example, admin represents the EJBObject reference to the Admin EJB. For more information about the getTemplateDefinition() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
TemplateDefinitionInfo info =
admin.getTemplateDefinitions(templateDefinitionID);
Getting Definitions for a Template
To get the definitions for a specific workflow template, use the following com.bea.wlpi.server.admin.Admin method:
public java.util.List getTemplateDefinitions(
java.lang.String templateId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the getTemplateDefinitions() method parameter for which you must specify a value.
This method returns a list of com.bea.wlpi.common.TemplateDefinitionInfo objects. To access information about each template, use the TemplateDefinitinoInfo object methods described in TemplateDefinitionInfo Object. For example, the following code gets all templates associated with the Order Processing template. In this example, admin represents the EJBObject reference to the Admin EJB. For more information about the getTemplateDefinitions() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
List tempdefs = admin.getTemplateDefinitions("Order Processing");
Getting the Template Definition Content
To get the content of a template definition, use the following com.bea.wlpi.server.admin.Admin method:
public java.lang.String getTemplateDefinitionContent(
java.lang.String templateDefinitionId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the getTemplateDefinitionContent() method parameter for which you must specify a value.
This method returns an XML document that is compliant with the Template Definition DTD, as described in Template Definition DTD. For example, the following code gets the contents for the specified template definition. In this example, admin represents the EJBObject reference to the Admin EJB. The template definition ID is obtained using the methods associated with the com.bea.wlpi.common.TemplateDefinitionInfo object, definition. The definition object can be obtained using the methods described in Getting Definitions for a Template. For more information about the getTemplateDefinitionContent() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
String content =
admin.getTemplateDefinitionContent(tempDef.getId());
Setting the Template Definition Content
To set the template definition content, use the following com.bea.wlpi.server.admin.Admin method:
public void setTemplateDefinitionContent(
java.lang.String templateDefinitionId,
java.lang.String xml
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the setTemplateDefinitionContent() method parameter for which you must specify a value.
For example, the following code sets the contents for the specified template definition using the contents of the specified XML file, new.xml. In this example, admin represents the EJBObject reference to the Admin EJB. The template definition ID is obtained using the methods associated with the com.bea.wlpi.common.TemplateDefinitionInfo object, definition. The definition object can be obtained using the methods described in Getting Definitions for a Template. For more information about the setTemplateDefinitionContent() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
admin.setTemplateDefinitionContent(tempDef.getId(), "new.xml");
Getting the Template Definition Owner
To get the current owner of a workflow template definition, use the following com.bea.wlpi.server.admin.Admin method:
public java.lang.String getTemplateOwner(
java.lang.String templateDefinitionId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the getTemplateOwner() method parameter for which you must specify a value.
This method returns the ID of the current template definition owner. For example, the following code gets the template definition owner ID and assigns the result to the owner string. In this example, admin represents the EJBObject reference to the Admin EJB. For more information about the getTemplateOwner() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
String owner = admin.getTemplateOwner(templateDef.getId());
Getting Callable Workflow
To get a list of callable workflows, use the following com.bea.wlpi.server.admin.Admin method:
public java.util.List getCallableWorkflows(
java.lang.String orgId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the getCallableWorkflows() method parameter for which you must specify a value.
This method returns a list of callable workflows. For example, the following code gets the a list of callable workflows for the organization specified by the value of the OrgID variable. In this example, admin represents the EJBObject reference to the Admin EJB. For more information about the getCallableWorkflows() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
List callablewf = admin.getCallableWorkflows(orgId);
Finding a Callable Workflow
To return a list of the most appropriate (active and effective) callable workflow, use the following com.bea.wlpi.server.admin.Admin method:
public java.util.List findCallableWorkflows(
java.lang.String templateName
java.lang.String templateID
java.lang.String orgId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the getTemplateOwner() method parameter for which you must specify a value.
This method returns a list of callable workflows. For example, the following code finds a list of the most appropriate callable workflows for the specified template. In this example, admin represents the EJBObject reference to the Admin EJB. For more information about the findCallableWorkflows() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
List callablewf = admin.findCallableWorkflows(templateName, templateID, orgId);
Locking and Unlocking a Template Definition
You can place a persistent write lock on a workflow template definition to protect it from unwanted edits. To lock and unlock template definitions, use the following com.bea.wlpi.server.admin.Admin methods, respectively:
public void lockTemplate(
java.lang.String templateDefinitionId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
public void unlockTemplate(
java.lang.String templateDefinitionId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
Note: To get the current template definition owner, use the getTemplateOwner() method described in Getting the Template Definition Owner.
The following table describes the parameter for which you must specify a value for the lockTemplate() and unlockTemplate() methods.
For example, the following code locks the specified template definition. In this example, admin represents the EJBObject reference to the Admin EJB. The following code unlocks the specified template definition: For more information about the lockTemplate() and unlockTemplate() methods, see the com.bea.wlpi.server.admin.Admin Javadoc.
admin.lockTemplate(templateDef.getId());
admin.unlockTemplate(templateDef.getId());
Deleting a Template Definition
To delete a template definition, use the following com.bea.wlpi.server.admin.Admin method:
public void deleteTemplateDefinition(
java.lang.String templateDefinitionId
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException
The following table describes the deleteTemplateDefinition() method parameter for which you must specify a value.
For example, the following code deletes the specified template definition. In this example, admin represents the EJBObject reference to the Admin EJB. The template definition ID is obtained using the methods associated with the com.bea.wlpi.common.TemplateDefinitionInfo object, definition. The definition object can be obtained using the methods described in Getting Definitions for a Template. For more information about the deleteTemplateDefinition() method, see the com.bea.wlpi.server.admin.Admin Javadoc.
admin.deleteTemplateDefinition(definition.getId());
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |