bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Programming BPM Client Apps

 Previous Next Contents Index View as PDF  

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.

Table 14-1 createTemplateDefinition() Method Parameters  

Parameter

Description

Valid Values

templateId

ID of the template for which you want to create a template definition.

String specifying a valid template ID.

To get the template ID, use the following com.bea.wlpi.common.TemplateInfo method:

public final java.lang.String
getId()

For information about getting the TemplateInfo object, see Getting a Template. For more information about the methods available to the TemplateInfo object, see TemplateInfo Object.

name

Name of the new template definition.

Non-null string.

xml

Name of the XML document that defines the template definition and that is compliant with the Template Definition DTD, as described in Template Definition DTD.

Non-null string.

transactionId

ID of the transaction.

Note: This parameter is required only in a clustered environment.

Object specifying a unique transaction ID.

To generate a unique transaction ID, create a new com.bea.wlpi.client.common.GUID object using the following constructor:

GUID transactionId = new GUID();

For more information about the GUID class, see the com.bea.wlpi.client.common.GUID Javadoc.


 

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.

String id = admin.createTemplateDefinition(
template.getId(),"Order Processing", "orderprocessing.xml");

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.

 


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.

Table 14-2 getTemplateDefinition() Method Parameters  

Parameter

Description

Valid Values

templateDefinitionId

ID of the template definition that you want to retrieve.

String specifying a valid template definition ID.


 

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.

TemplateDefinitionInfo info =
admin.getTemplateDefinitions(templateDefinitionID);

For more information about the getTemplateDefinition() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


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.

Table 14-3 getTemplateDefinitions() Method Parameter  

Parameter

Description

Valid Values

templateId

ID of the template for which you want to retrieve template definitions.

String specifying a valid template ID.

To get the template ID, use the following com.bea.wlpi.common.TemplateInfo method:

public final java.lang.String
getId()

For information about getting the TemplateInfo object, see Getting a Template. For more information about the methods available to the TemplateInfo object, see TemplateInfo Object.


 

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.

List tempdefs = admin.getTemplateDefinitions("Order Processing");

For more information about the getTemplateDefinitions() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


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.

Table 14-4 getTemplateDefinition() Method Parameters  

Parameter

Description

Valid Values

templateDefinitionId

ID of the template definition for which you want to get the content.

String specifying a valid template definition ID.

To get the template definition ID, use the following com.bea.wlpi.common.TemplateDefinitionInfo method:

public final java.lang.String
getId()

For information about getting the TemplateDefinitionInfo object, see Getting Definitions for a Template. For more information about the methods available to the TemplateDefinitionInfo object, see TemplateDefinitionInfo Object.


 

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.

String content = 
admin.getTemplateDefinitionContent(tempDef.getId());

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.

 


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.

Table 14-5 setTemplateDefinition() Method Parameters  

Parameter

Description

Valid Values

templateDefinitionId

ID of the template definition for which you want to set the content.

String specifying a valid template definition ID.

To get the template definition ID, use the following com.bea.wlpi.common.TemplateDefinitionInfo method:

public final java.lang.String
getId()

For information about getting the TemplateDefinitionInfo object, see Getting Definitions for a Template. For more information about the methods available to the TemplateDefinitionInfo object, see TemplateDefinitionInfo Object.

xml

New template definition contents.

XML file that is compliant with the Template Definition DTD, as described in Template Definition DTD.


 

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.

admin.setTemplateDefinitionContent(tempDef.getId(), "new.xml");

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.

 


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.

Table 14-6 getTemplateOwner() Method Parameter  

Parameter

Description

Valid Values

templateDefinitionId

ID corresponding to the template definition for which you want to get the owner.

String specifying a valid template definition ID.

To get the template definition ID, use the following com.bea.wlpi.common.TemplateDefinitionInfo method:

public final java.lang.String
getId()

For information about getting the TemplateDefinitionInfo object, see Getting Definitions for a Template. For more information about the methods available to the TemplateDefinitionInfo object, see TemplateDefinitionInfo Object.


 

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.

String owner = admin.getTemplateOwner(templateDef.getId());

For more information about the getTemplateOwner() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


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.

Parameter

Description

Valid Values

orgId

ID of the organization for which you want to get callable workflows.

String specifying a valid organization ID.

For information about getting a list of all organization IDs, see Getting All Organizations.


 

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.

List callablewf = admin.getCallableWorkflows(orgId);

For more information about the getCallableWorkflows() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


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.

Parameter

Description

Valid Values

templateName

Name of the template for which you want to find callable workflows.

Valid template name.

To get the template name, use the following com.bea.wlpi.common.TemplateInfo method:

public final java.lang.String
getId()

For information about getting the TemplateInfo object, see Getting a Template. For more information about the methods available to the TemplateInfo object, see TemplateInfo Object.

templateID

ID of the template for which you want to find callable workflows.

String specifying a valid template ID.

To get the template ID, use the following com.bea.wlpi.common.TemplateInfo method:

public final java.lang.String
getId()

For information about getting the TemplateInfo object, see Getting a Template. For more information about the methods available to the TemplateInfo object, see TemplateInfo Object.

orgId

ID of the organization for which you want to find callable workflows.

Valid organization ID.

For information about getting a list of all organization IDs, see Getting All Organizations.


 

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.

List callablewf = admin.findCallableWorkflows(templateName, templateID, orgId);

For more information about the findCallableWorkflows() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


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.

Table 14-7 lockTemplate() and unlockTemplate() Method Parameter  

Parameter

Description

Valid Values

templateDefinitionId

ID corresponding to the template definition that you want to lock or unlock.

String specifying a valid template definition ID.

To get the template definition ID, use the following com.bea.wlpi.common.TemplateDefinitionInfo method:

public final java.lang.String
getId()

For information about getting the TemplateDefinitionInfo object, see Getting Definitions for a Template. For more information about the methods available to the TemplateDefinitionInfo object, see TemplateDefinitionInfo Object.


 

For example, the following code locks the specified template definition. In this example, admin represents the EJBObject reference to the Admin EJB.

admin.lockTemplate(templateDef.getId());

The following code unlocks the specified template definition:

admin.unlockTemplate(templateDef.getId());

For more information about the lockTemplate() and unlockTemplate() methods, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


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.

Table 14-8 getTemplateDefinition() Method Parameters  

Parameter

Description

Valid Values

templateDefinitionId

ID of the template definition that you want to delete.

String specifying a valid template definition ID.

To get the template definition ID, use the following com.bea.wlpi.common.TemplateDefinitionInfo method:

public final java.lang.String
getId()

For information about getting the TemplateDefinitionInfo object, see Getting Definitions for a Template. For more information about the methods available to the TemplateDefinitionInfo object, see TemplateDefinitionInfo Object.


 

For example, the following code deletes the specified template definition. In this example, admin represents the EJBObject reference to the Admin EJB.

admin.deleteTemplateDefinition(definition.getId());

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.

 

Back to Top Previous Next