Developer

OutputAttribute class

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

Package

com.sybase365.mobiliser.brand.plugins.smapp.controls
Syntax
Syntax
public class OutputAttribute extends Attribute

Base class

Members

All members of OutputAttribute, including inherited members.

Constructors
Modifier and Type Constructor Description
public OutputAttribute(String, String) Constructor.
Methods
Modifier and Type Method Description
public String getHoldValue() The holdValue pending to bulk save.
public void resetHoldValue() Reset the holdValue to null.
public void setHoldValue(String) Set the holdValue to the given string.
public void setHoldValue(Long) Set the holdValue to the string value of the given Long value.
public void setHoldValue(Integer) Set the holdValue to the string value of the given Integer value.
public void setHoldValue(Boolean) Set the holdValue to the string value of the given Boolean value.
public void setValue(String) Set the value to this output attribute, and also persist the value to the session variable using the name specified in the output textbox field.
public void setValue(Long) Set the string value of given Long to this output attribute, and also persist the value to the session variable using the name specified in the output textbox field.
public void setValue(Integer) Set the string value of given Integer to this output attribute, and also persist the value to the session variable using the name specified in the output textbox field.
public void setValue(Boolean) Set the string value of given Boolean to this output attribute, and also persist the value to the session variable using the name specified in the output textbox field.
Inherited members from Attribute
Modifier and Type Member Description
public Attribute(String, String) Default value (if provided)
protected SmappStateProcessingContext getContext() Sets the processing engine context.
public String getDescription() Detailed description of the attribute.
public String getId() Attribute Id.
public String getText() The text that was entered in the input field on the state editor.
public void setContext(SmappStateProcessingContext) Sets the processing engine context.
public void setDescription(String) Detailed description of the attribute.
public void setId(String) Attribute Id.

Usage

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();