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, its layout is saved as well. 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 on the toolbar and the flow editor automatically provides the flow layout.
Adding annotation on link
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 screen capture.
After adding an annotation for a link, you can edit it inline, as shown in the following screen capture.
To remove an annotation from a link, clear the text in the annotation and the annotation is also cleared.
REST service support
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 screen capture.
You can then drag the service and drop it on the canvas to list the required parameters, as shown in the following screen capture.
WebUI support
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 screen capture shows the WebUI Editor with these operation buttons displayed.
When you finish editing the webUI, click the OK button 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.
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.
- Create a XSLT activity into canvas. You can find the XSLT activity by entering a filter word.
- Drag and Drop the XSLT item into the canvas to create a XSLT activity.
- Click the Create XSLT file link on the XSLT activity property dialog. The visual builder opens.
- Open the builder and paste the sample XML for visualizing incoming and outgoing XML.
- Switch the tab on the bottom to XML Source and paste the sample XML source. as shown in the following screen capture:
-
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 screen capture.
- 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:
- 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 screen capture:
- 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 screen capture: