# Process Control Methods

To learn about the methods available on a Process control, see the ProcessControl Interface.

### Example: Process Control Declaration

When you create a new Process control using the control wizard and drag a method from the control onto a business process, its declaration appears in the JPD file. The following code snippet is an example of what the declaration looks like:

        /**
         * @common:control
         */
        private FunctionDemo.callprocess callProcess;

### Setting Process Control Properties

The Process control possesses the capability of dynamically binding some properties of the control. Dynamic binding of properties can be achieved:

- Using selectors
- Using the setProperties() API
- Using setter methods for individual properties, such as setTargetURI().

To retrieve the current property settings, except for username and password, use the getProperties() method.

Starting with the method with the highest precedence, the hierarchy of property settings is:

1. Properties dynamically bound using the jc:selector tag and the DynamicProperties.xml file
2. Properties set using the setProperties() method or other setter methods inherited from the Process control (setConversationID, setTargetURI, setPassword, and setUsername)
3. Properties set using static annotations

The ProcessControlProperties type is an XML Beans class that is generated out of the corresponding schema element defined in DynamicProperties.xsd. The DynamicProperties.xsd file is located in the system folder of New Process Applications or in the system folder of the Schemas project.

The setProperties() method uses this XML Bean class to set properties on a control instance. A selector on a Process control method returns an XML document that conforms to the ProcessControlProperties element. The following sample shows how to programmatically set the username property for a control. You add the bold code lines to the code generated when the control is created, overriding properties set using dynamic binding and static annotations:

    import com.bea.wli.control.dynamicProperties.
    ProcessControlPropertiesDocument;

    import com.bea.wli.control.dynamicProperties.
    ProcessControlPropertiesDocument.ProcessControlProperties;

        ProcessControlPropertiesDocument props= null;
        ProcessControlProperties sprops = null;

        public void sBC8InvokeSetProperties() throws Exception

        {

            props = ProcessControlPropertiesDocument.Factory.newInstance();
            sprops = props.addNewProcessControlProperties();

            sprops.setUsername("smith");

You construct the ProcessControlPropertiesDocument instance in the above section of code through a Data Transformation method or through XMLBean APIs. For more information on Data Transformations, see Guide to Data Transformation, and for more information on XML Beans, see "Getting Started with XML Beans" in Handling XML with XML Beans.

The following code provides a sample of a ProcessControlPropertiesDocument instance:

    this.pcp = ProcessControlPropertiesDocument.Factory.newInstance();

    this.pcp.addNewProcessControlProperties();

    this.pcp.getProcessControlProperties().setUsername("uname");

    this.pcp.getProcessControlProperties().setPassword("pword");

    this.pcp.getProcessControlProperties().setTargetURI("http://localhost:7001/";);

Some control properties can be specified dynamically or in annotations (statically) on the JCX file. For example, the Process control allows you to specify the target process in the jc:location annotation at the top of the JCX or dynamically using the TargetURI element in DynamicProperties.xml. In all such cases, a dynamically bound value for the property takes precedence over the static annotation.

If the domain is active, it is recommended that you use the WebLogic Integration Administration Console to perform dynamic binding. For more information on binding lookup values to dynamic properties using the WebLogic Integration Administration Console, see "Adding or Changing Dynamic Control Selectors" in Process Configuration in Managing WebLogic Integration Solutions, which is available at the following URL:

http://e-docs.bea.com/wli/docs81/manage/processconfig.html#1039959

Dynamic properties can also be specified by calling setProperties on the control, or by calling one of the setter methods, such as ProcessControl.setUsername().

Properties applied using selectors remained bound until one of the following conditions occurs:

- A method marked finish on the JCX is invoked
- A start method is invoked again
- The property is programmatically set by calling setProperties or a setter method.

ProcessControl.reset() resets all configured selector values.

You can also use the ControlContext interface for access to a control's properties at run time and for handling control events. Property values set by a developer who is using the control are stored as annotations on the control's declaration in a JWS, JSP, or JPD file, or as annotations on its interface, callback, or method declarations in a JCX file.

Related Topics

Service Broker Control

Using Dynamic Binding

ProcessControl Interface