Using Java methods in process snippets

Java methods can be used in snippets within a process to perform a variety of functions.

Such methods are typically used to read and write process variables and partners, but they can also be used for such things as raising faults and forcing the rollback of a microflow. The following table provides a list of the available Java methods:

Java method Function

getServiceRefFromPartnerLink

commonj.sdo.DataObject getServiceRefFromPartnerLink( String partnerLinkName, int role );

These methods can be used to either specify or retrieve the Service destination at the end of the named partner link.

The role value must be one of:
  • PARTNER_LINK_PARTNER_ROLE
  • PARTNER_LINK_MY_ROLE
A DataObject is returned that contains an EndpointReference object with the name "EndpointReference".

setServiceRefToPartnerLink

void setServiceRefToPartnerLink( String partnerLinkName, commonj.sdo.DataObject serviceRef);

getVariableData Use these methods to either specify or return the value of a variable.
setVariableData

getVariableProperty

Object getVariableProperty( String variableName, QName propertyName )

These methods either specify or return the value of a process variable's property. If either the property or the variable do not exist, a StandardFaultException of kind “selection failure” is thrown. If the value is not compatible to the type of the property, a StandardFaultException of kind “mismatch assignment failure” is thrown.

setVariableProperty

void setVariableProperty( String variableName, QName propertyName Object value)

getCorrelationSetProperty

<typeOfP> getCorrelationSet<cs>Property<p>( )

This method can be used to retrieve the properties of correlation sets that are declared at the process level. If either the property with name propertyName or the correlation set with name correlationSetName do not exist, a StandardFaultException of kind “selection failure” is thrown.

getProcessCustomProperty

String getProcessCustomProperty( String name) ;

Use these methods to access or define custom properties at the process level.

setProcessCustomProperty

void setProcessCustomProperty( String name, String value ) ;

getActivityCustomProperty

String getActivityCustomProperty( String activityName, String propertyName )

Use these methods to access or define custom properties at the activity level. If the activity does not exist, or activityName does not uniquely qualify an activity, a StandardFaultException of kind “selection failure” is thrown. If the value exceeds 254 bytes, an InvalidLengthException is thrown.

setActivityCustomProperty

void setActivityCustomProperty( String activityName String propertyName, String value )

getLinkStatus

boolean getLinkStatus(String linkName)

This method can be used in join conditions to access the state of the incoming links.

activityInstance

ActivityInstance activityInstance()

Use this method to return the current activity as an object in order to access its context.

processInstance

ProcessInstanceData processInstance();

Use this method to return the current process as an object in order to access its context.

raiseFault

raiseFault( QName faultName )

raiseFault( QName faultName, String variableName )

raiseFault( QName faultName, Serializable message )

Use this method to raise a fault in the surrounding process.

forceRollback

forceRollback( )

Use this to cause the compensation of the microflow. This method will not work with long running processes.

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.