Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

Passing data from one Flux state to another

Of course, your Flux actions are not limited to services that just consume data, you could take that input and process it by passing it around to other states. For this example, let's say you have two states. The first state is set to the action StringMethods.upperCase(String); the second state is set to call LoggerMethods.println(String); and there is a blank transition between them. Let us also say, that there is a single Flux input called input that is of type String.

  1. Click your first state. Once the state is selected, Flux Input/Output will become State Input/Output.
  2. Add an output string property named upperCased.
  3. In Mapper, map input to the action's input str.
  4. In Mapper still, map the action's output output to upperCased.

Passing data between states - first state

Passing data between states - first state

  1. Click your second state.
  2. Under the State Input/Output view, create an input of type string with the name toPrint.
  3. Going back to Mapper, map toPrint to message.
  4. Finally, click on the transition arrow and in Mapper, map upperCased to toPrint.

Passing data between states - second state

Passing data between states - second state

What we've done here is send data between two states using a transition. Data becomes available via a state's inputs and outputs and the transition acts as the bridge for data between states. This way, each state is isolated. They perform their own action without having to rely on other states' implementations. Transitions act as adapters between states.

Map properties using only keyboard commands!

To make it easier for you, Martini has template proposals you can use to map property values accessible via the content-assist menu.

To map properties using template proposals in the Flux canvas:

  1. Select the state or transition by clicking on it.
  2. Press the key; a pop-up will show with proposals.
  3. Select Map property.
  4. If the selection is a state and its action is an invoke step, there will be an Input or Output proposal. Select either of these options, depending on whether you want to set an input property or output property. Otherwise, ignore this step.
  5. Select the property whose value you want to map.
  6. Select the property to map the previously selected property to.

Map property in Flux canvas using content assist

Map property in Flux canvas using content assist

You can also use content assist to map properties in the Mapper view.