Exploring additional features

This article describes advanced features of the flow editor, including the visual XSLT builder, encapsulation (for handling complex flows), and integration with Zero Resource Model.

Automatic layout

You can load a flow file that was not generated by the flow editor itself. The flow editor automatically lays out the flow for you on the canvas. You can use an editor of your choice to create the flow file and then edit it in the flow editor.

If a flow file is saved by the flow editor, the layout for it is saved also. The layout is resumed when you load the flow again. If you change the markup in another editor, the part you modified is automatically laid out while the other parts are kept the same as it was saved. If you are not satisfied with the flow layout, click the Layout command link on the tool bar and the flow editor automatically provides the flow layout.

Vertical encapsulation

A Block activity is provided in the tooling to help you easily build a complex flow. With this Vertical encapsulation, you can composite several activities inside a Block to provide an independent function. Use the following steps to use this feature:

  1. Create a Block activity, take the defaults, and use it in your flow, as shown in the following graphic.
    task
  2. Click Detail to open a new tab where you can edit the block. The activities listed on top and bottom are the activities related to the task you created in the top view. You can add new activities in the block and connect them to finish a function.

The following graphic shows the block with a flow created.


Vertical encapsulation edit

To go back to the top view, click the Editor tab. From this view, you can see your flow without the details of the block.

Annotation provides a way to explain a link. To add annotations on a link, click the link and click the Annotation icon, as shown in the following graphic.

link toolbar

After adding an annotation for a link, you can edit it inline, as shown in the following graphic.

edit annotation

To remove an annotation from a link, clear the text in the annotation and the annotation also is cleared.

REST Services are listed under the All Services category. You can switch to this category and all the REST services are listed in the palette, as shown in the following graphic.

Image of all service in palette

You can then drag the service and drop it on the canvas to list the required parameters, as shown in the following graphic.

Image of REST Service in canvas

You can also add optional parameters, by requirement.

You can use the webUI(Reference of webUI is under "Simple collaboration in Assemble flow" in zero.assemble.flow) activity to collaborate multiple persons in a common pattern. You can switch to the Collaboration category and drag the webUI activity to the canvas. Then you can select the data type for both incoming data and outgoing data for this webUI.

After selecting the data type, you can hover on each field and the following operation buttons are displayed on the right:

  • Moving up the field
  • Moving down the filed
  • Editing the field
  • Removing the field

The following graphic shows the WebUI Editor with these operation buttons displayed.

Image of webUI

When you finish editing the webUI, click the Save link to save the view of the webUI to a file. The path of the file is assigned to the view attribute of this activity.

Using models for script and template activities

Models simplify the task of knowing which inputs are required for the script and template activities. Models are patterned after the configuration used by Zero Resource Model but limited to two datatypes (string and date-time). Since the most common usage pattern for this model was for updating feeds, the date-time datatype formats the input field to a compliant Atom date format and the string is treated as it is.

A model file must be placed under the directory {app_root}/app/assemble/models of virtualized directories. An example models file for updating a Google calendar entry is show below with the associated template activity.

{
	"fields" : {
	 	"title" : {"type":"string"},
	 	"description" : {"type":"string", "max_length": 128},
	 	"location" : {"type":"string"},
	 	"start": {"type":"date-time"},
	 	"end" : {"type":"date-time"}
	}
}
    <template name="createCalendarEvent_0" file="samples/googleCalendar/GoogleCalendarCreateEvent.gt">
        <input name="title" value="Lunch with Sam"/>
        <input name="description" value="Lunch with Sam to discussion the bug 2678"/>
        <input name="location" value="Cafeteria"/>
        <input name="start" value="2008-10-05 22:00"/>
        <input name="end" value="2008-10-05 22:00"/>
    </template>

The discovery model for locating models is based on convention. In the previous example, the Groovy template is located in the /app/views/ directory, based on the convention for templates. It is under the following subdirectory: samples/googleCalendar. The models file is searched under the /app/assemble/models directory based on the convention for assemble models and is also searched under the /samples/googleCalendar subdirectory.

The final step in the discovery model is to substitute the file name extension (either .gt for template or .groovy for script) with the extension .json to discover the model. One of the following processes then occurs:

  • If an activity is associated with a model, the canvas displays the list of inputs that the model supports.
  • If the activity was created during a prior flow editing session and has already been associated with a model, the activity selects the active model from the option list and associates the given inputs with model inputs showing remaining inputs as blank values.

Modeling template activity with the tooling

The following graphic shows the template activity in the tooling:

template-model-activity-in-tooling

Visual XSLT builder

The visual XSLT builder is provided to support simple XML mapping. It can visualize the sample incoming and outgoing XML to an XML tree, and you can drag and drop to mapping the XML. The following steps shows an Amazon search result being converted into a feed.

  1. Create a XSLT activity into canvas. Switch the category in the palette to All activities.

    You can find the XSLT activity by entering a filter word.

    .
  2. Drag and Drop the XSLT item into the canvas to create a XSLT activity, as shown in the following graphic:

    xslt-activity-in-tooling

  3. Open the builder and paste the sample XML for visualizing incoming and outgoing XML.
  4. Click the Design link on the XSLT activity. The visual builder opens.
  5. Switch the tab on the bottom to XML Source and paste the sample XML source. as shown in the following graphic:

    XSLT-builder-paste-sample-XML-in-tooling

  6. For a target XML, click the Using Atom sample XML for target XML format link to quickly add an Atom sample XML for the target XML format, as shown in the following graphic.

    XSLT-builder-paste-sample-atom-XML-in-tooling

  7. Drag and drop to the mapping. To do this, drag the incoming XML node and drop it onto the outgoing XML node, as shown in the following example:

    XSLT-builder-mapping-XML-in-tooling

  8. Edit the mapping XPath expression, if necessary. To do this, click the editing icon on the right side of mapping node. The XPath Expression Editor opens. You can edit the XPath by selecting the function on the left side, as shown in the following graphic:

    XSLT-builder-expression-editing-in-tooling

  9. Preview the generated XSLT,and save it. To do this, click the Preview tab on the top of the XSLT builder. The generated XSLT source code is displayed. After you complete the design, click the OK link to save the XSLT, as shown in the following graphic:

    XSLT-builder-expression-editing-in-tooling

Version 1.1.0.0.19254