OutputAttribute class

OutputAttribute is used by the state to store output resulting from processing the state.

Syntax

public class OutputAttribute

Remarks

This could be the results from external web service call, status code, error message, error code, etc. The value set to the output attribute will be automatically saved to the session variable so that it can be used even when the state is out of scope, or no longer in the processing mode.

On the State Editor, the OutputAttribute is referred to as "Output Variable" and is represented with the following UI components:
  • A checkbox. Checked and not editable.
  • Textbox field for specifying the session variable name to store the output value. By default, it is set to this output attribute ID.
  • A description of the output attribute
  • Mouse-hover showing the description, and the default session variable name

The output attribute has only one type, the InputType#SESSION type.

There are two mechanisms to set value on the output attribute: "<i>set and persist</i>", and "<i>set and hold</i>". The "set and persist" using one of the setValue() methods will set the value and immediately persist it to the session variable. This is good if there are only a few output attributes to set, because each calls will result in an independent call to the datasource.

If there are many output attributes to set, the later mechanism (set and hold) is more efficient because the value is temporarily held in the output attribute until an explicit bulk save is called by the state implementation as shown on the following. 

	outAttrib1.setHoldValue("value1");
	outAttrib2.setHoldValue("value2");
	outAttrib3.setHoldValue("value3");
	

	// The following helper method belongs to the SmappStatePlugin
	// This method will also call the resetHoldValue() method
	// of each output attributes, after a successful save. 
	saveOutputAttributes();