Gloop Mapper view
The Mapper view, visible at the bottom part of Coder by default, is used view and edit the map lines and set expressions of a map step or invoke step. If the Mapper view is not visible, go to the application menu Window > Show View > Mapper. You can also use the shortcut .
The Mapper view has two different layouts; which gets chosen is dependent on the currently selected step.
For map steps, the view is divided such that it contains the following components:
- The input model tree, which shows all the input properties available to the step
- The output model tree, which shows all the output properties available at that step
- The canvas displaying the map lines between the input and output model tree
For invoke steps, the view is divided such that it contains the following components:
- The input model tree, which shows all the input properties available to the step
- The invoke step input model tree, which shows all the input properties of the invoke step
- The canvas displaying the input map lines
- The invoke step output model tree, which shows all the output properties of the invoke step
- The output model tree, which shows all the output properties available to the step
- The canvas displaying the output map lines
Asynchronous invoke step
If an invoke step is configured to run asynchronously, only the input side of the Mapper will be visible.
Mapping
Mapping a property to another is very straight forward.
- Select a property in the model tree.
- Drag it over another property in the opposite model tree; a map line following the mouse will be visible
- Drop it on the other propery and then a map line is created
Illegal mappings
Certain model property types can only be mapped to strings, objects, or other model property types. In any case, Coder will display an error message when attempting to do an illegal mapping.
Multi-mapping
It is possible to map multiple properties at once. To do so, select all properties from the output model tree and then drag them to the opposite model tree and drop them; multiple map lines will be created.
It is also possible to map and create a property in one move. You can do this by selecting a property, and while pressing ⌃ in macOS (Alt in Windows or Linux), drag it to the opposite model tree and then drop it. The created property will either be at the input model or output model of the service. Alternatively, you can do this via context menus: just right-click a property then select the Add Property and Map menu item.
To make things easier and quicker for you, you could try mapping properties via content assist. You can do this either in the Mapper view or the step editor.
When mapping properties via the step editor, you must:
- Select a map step or invoke step in the step tree.
- Press the key.
- If it's an invoke step, select either Input or Output. Otherwise, ignore this step.
- Select the property to map.
- Select the property that maps the previous selected property.
Meanwhile, the steps for mapping properties via content assist in the Mapper view are:
- Select a property from the input or output tree.
- Press the key.
- Select Map to or Map from.
- Select the property to map it to or from.
Set expressions
Set expressions can be added on properties in both input and output invoke step trees. To add or edit a set expression:
- Select a property.
- Double-click it or press or .
- The Expression dialog will appear; enter the expression. Your expression is either a plain string or Groovy code (if the expression is to be evaluated).
- Click the OK button or press to save the expression.
If a property already has a set expression, it is decorated with an icon and the expression; if the expression is evaluated a yellow overlay icon is also visible.
Alternatively, you can add or edit a set expression using content assist. To do this:
- In the step editor, select a map step or invoke step.
- Press the key.
- Select Set expression.
- If it's an invoke step, select either Input or Output. Otherwise, ignore this step.
- Select a property whose expression you want to set.
- The Expression dialog will appear; enter the expression. Your expression can either be a plain string or Groovy code (which requires the expression to be evaluated).
- Click the OK button or press to save the expression.
Meanwhile, to delete a set expression:
- Select the target property of the set expression.
- Press or right click the property and then click the Delete Set Expression from the context menu.
Nested properties with set expressions
When a set expression is used on one of the properties of a Gloop model, a grayed expression icon will be visible next to it to indicate that one of the children properties has a set expression.
Setting the value of a Gloop model
The set expressions of Gloop model properties are evaluated by default, the reason being Gloop model properties can have their values set using a DSL. A DSL makes it very easy to set all the properties of a model; and to make things better, there's a template for generating DSLs for Gloop models.
- Select a Gloop model property.
- Open the Expression dialog.
- Press and then select the model DSL template proposal.
- The Groovy-based model DSL will be generated; press to jump from one value to another.
Declaring properties
Declaring model properties is only possible in the output model tree of the Mapper view. Declaring and deleting properties in Mapper is similar to adding and deleting properties in the Input/Output view. Shortcuts, context menus, and content assist are used in the same way to declare properties with one exception: it is only possible to declare a new property if the targeted model allows extra properties.
Declared properties are distinguished from regular properties by a green plus shaped overlay icon on the bottom left. If this overlay icon is orange, it means that the declared property was not declared within the selected step.
Map and declare in one go!
It is possible to map and declare a property in one move. To do so, select the property from the input model tree, and while pressing ⌥ in macOS (or Ctrl in Windows and Linux), drag it to the opposite model tree and drop it. The property is added as a declared property and a map line connecting to it is created. There is also a context menu that does this just by right-clicking a property then select Declare Property and Map menu item.
Unloading properties
To unload a declared property:
- Select one or more declared properties.
- Press or do a right click on the property (or on any of the properties, if multiple) and then click Unload Property.
The process is the same to reload the declared properties.
When a declared property is unloaded, a trash bin icon is displayed near the property.