Using a Dynamic Transformation Control

This section describes two ways to use a Dynamic Transformation control. It contains the following topics:

Using the Base Methods in the Dynamic Transformation Control

Once you have created the Dynamic Transformation control, you can add a control instance to your business process and invoke its base methods from within your application.

To learn about adding an instance of the Dynamic Transformation control to your business process, see Create Control Nodes in Your Business Process.

The following methods are available:

The @jc:ddtf, @jc:xquery, @jc:xslt annotations control the behavior of these methods. Additional information is also available in the DynamicTransformation Interface.

Adding Methods to the Dynamic Transformation Control

This section describes how to add methods to the Dynamic Transformation control. It contains the following tasks:

Adding a New Method to the Dynamic Transformation Control

In the following steps, you add a new method to the Dynamic Transformation control. After you add the method, you need to define the type of transformation and its parameters.

To Add a New Method to the Dynamic Transformation Control

  1. In the Design View, in the Application pane, double-click the JCX file for the Dynamic Transformation control.
  2. A graphical representation of the control is displayed.

    image

  3. Right-click the box representing the control, then from the drop-down menu, select Add Method.
  4. A transformation method is created.

    image

  5. Right-click the method, then from the drop-down menu, select Rename and rename the method as appropriate.
Defining the New Method for an XQuery or MFL Transformation

In the following steps, you select the source and target types from the Source and Target panes of the Dynamic Transformation dialog box. Source types are the input data types for the data transformation—the data types that are transformed to the target data type.

To Define a Method for an XQuery Transformation

Note: To make the schema representations available in the Available Source Types and Available Target Types pane, the XSD and MFL files that contain these schemas must be imported into a Schemas project folder and the current application must have completed building. To learn more, see Creating Schema Projects.

  1. Right-click the method you created, then from the drop-down menu, select Add Transformation Method.
  2. The Dynamic Transformation dialog box is displayed.

  3. From the Transformation Type drop-down menu, select XQuery.
  4. Specify a source type by doing one of the following:
  5. To specify an XML, Non-XML, or Java primitives source type:

    1. In the Available Source Types pane, select the desired source type for the XML, NonXML, or Java options.
    2. Select a source element.
    3. Click Add.
    4. The element and its attributes are added to the Selected Source Types pane.

    To specify a Java class source type:

    1. The Java class for conversion must be available in the current project. To learn more about including a Java class in your project, see Using Existing Applications.
    2. In the Type field of the Available Source Types pane, enter the full package name of the Java class. For example, for a class named Book in the package named org.library, in the Type field, enter: org.library.Book.
    3. If desired, change the default name provided in the Name field. This field specifies the name the mapper uses to refer to this element.
    4. Click Add.
    5. Note: To learn more, see Using Java Classes in Transformations.

  6. Specify a target type by doing one of the following:
  7. Note: Only one target type can be specified.

    To specify an XML, Non-XML, or Java primitives target type:

    1. In the Available Target Types pane, select the desired source type for the XML, NonXML, or Java options.
    2. Select a target element.
    3. Click Add.
    4. The element and its attributes are added to the Selected Target Type pane.

    To specify a Java class target type:

    1. The Java class for conversion must be available in the current project. To learn more about including a Java class in your project, see Using Existing Applications.
    2. In the Type field of the Available Target Type pane, enter the full package name of the Java class. For example, for a class named Book in the package named org.library, in the Type field, enter: org.library.Book.
    3. If desired, change the default name provided in the Name field. This field specifies the name the mapper uses to refer to this element.
    4. Click Add.
    5. The element and its attributes are added to the Selected Target Type pane.

      Note: To learn more, see Using Java Classes in Transformations.

    The Dynamic Transformation dialog box should look similar to the following figure.

    image

  8. If desired, select the Schema Validate Parameter and/or Schema Validate Return check boxes.
  9. If a check box is selected, during run time, the parameters are validated against their schema types before the transformation is executed. To learn more, see Schema Validating During Run Time.

    Note: The Schema Validate Parameters and Schema Validate Return check boxes are only enabled if all the parameters and the return type are typed XML or typed MFL types.

  10. Click Create Transform.
  11. The transformation is created and the Dynamic Transformation dialog boxes closes. The new method is displayed in the control instance on the Data Palette.

    Note: To learn about adding a control instance to your business process with the method you created, see Create Control Nodes in Your Business Process.

    This completes the configuration of the method for the transformation. It links the transformation file with the selected method.

The @jc:ddtf and @jc:xquery annotations control the behavior of these methods. All of the attributes of these annotations are optional and have default values. For more information, see Dynamic Transformation Control Annotations.

Defining the New Method for an XSLT Transformation
  1. Right-click the method you created, then from the drop-down menu, select Add Transformation Method.
  2. The Dynamic Transformation dialog box is displayed.

  3. From the Transformation Type drop-down menu, select XSLT.
  4. If your XSLT accepts parameters, add the parameters to the transformation method:
    1. In the Name field, enter the name of the appropriate parameter.
    2. From the Type drop-down menu, select the data type of the parameter.
    3. Click Add. The parameter is added to the Parameters field.
    4. Notes: The parameter name entered in the Name field must match the parameter name specified in the XSLT file.

      The order of the parameters is not significant. The parameters of the XSLT are matched to the parameters of the transformation method by name.

    5. Click Create Transform.The transformation is created and the Dynamic Transformation dialog boxes closes. The new method is displayed in the control instance on the Data Palette.
    6. Note: To learn about adding a control instance to your business process with the method you created, see Create Control Nodes in Your Business Process.

      This completes the configuration of the method for the XSLT transformation. It links the XSLT file with the selected method in the transformation file. During run time, if the business process invokes this method, this XSLT is invoked.

The @jc:xslt tag controls the behavior of the Dynamic Transformation control. All of the attributes of the @jc:xslt tag are optional and have default values.

For more information on the @jc:xslt tag, see Dynamic Transformation Control Annotations.

Related Topics

Dynamic Transformation Control Annotations

Creating Schema Projects

Using Existing Applications

Using Java Classes in Transformations

Create Control Nodes in Your Business Process

Dynamic Transformation Interface

Previous Document Next Document