com.smartgwt.client.util.workflow

## Class ServiceTask

- java.lang.Object
- - com.smartgwt.client.core.BaseClass
  - - com.smartgwt.client.util.workflow.ProcessElement
    - - com.smartgwt.client.util.workflow.Task
      - - com.smartgwt.client.util.workflow.ServiceTask

- All Implemented Interfaces:
    com.google.gwt.event.shared.HasHandlers

      public class ServiceTask
      extends Task

  A ServiceTask is an element of a `Process` which calls a DataSource operation, optionally using part of the `process state` as inputs or storing outputs in the process state.

  By default a ServiceTask takes the data indicated by `Task.inputField` and uses it as `DSRequest.data`. This means the input data becomes `Criteria` for a "fetch" operation, new record values for an "add" operation, etc.

  Alternatively, you can set `criteria` for a "fetch" operation, or `values` for other operationTypes. In both cases, you have the ability to use simple expressions like $input.fieldName to take portions of the input data and use it as part of the criteria or values.

  As a special case, if the `inputField` is an atomic value (just a String or Number rather than a Record) and operationType is "fetch", it will be assumed to be value for the primary key field of the target DataSource if `criteria` is not explicitly specified

  OutputData and outputFieldList work as filters. You should determine which properties should be fetched into the process state. If you want to load all data without defining every property manually you can pass a name started with '$' and fetched record or records will be placed as a record or an array of records by the name without this specific symbol.

  For example if you specify 'id' and 'name' in outputFieldList, only these properties will be fetched in the process state. If you pass '$record' in outputField a whole record will be stored in process state under the 'record' key. Also you can use javascript syntax there. For example '$record.item[0]'.

- - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.core.BaseClass

      `config, configOnly, factoryCreated, factoryProperties, id, scClassName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceTask()`
    `ServiceTask(com.google.gwt.core.client.JavaScriptObject jsObj)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.google.gwt.core.client.JavaScriptObject` | `create()`
    `Criteria` | `getCriteria()` Criteria (including AdvancedCriteria) to use for a "fetch" operation.
    `DataSource` | `getDataSource()` DataSource ID or DataSource instance to be used.
    `Criteria` | `getFixedCriteria()` Criteria to be submitted as part of the DSRequest, regardless of inputs to the task.
    `Record` | `getFixedValues()` Values to be submitted as part of the DSRequest, regardless of inputs to the task.
    `DSOperationType` | `getOperationType()` Type of operation to invoke
    `static ServiceTask` | `getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `Record` | `getValues()` Values to be submitted for "update", "add" and "remove" operations.
    `void` | `setCriteria(Criteria criteria)` Criteria (including AdvancedCriteria) to use for a "fetch" operation.
    `void` | `setDataSource(DataSource dataSource)` DataSource ID or DataSource instance to be used.
    `void` | `setDataSource(java.lang.String dataSource)` DataSource ID or DataSource instance to be used.
    `void` | `setFixedCriteria(Criteria fixedCriteria)` Criteria to be submitted as part of the DSRequest, regardless of inputs to the task.
    `void` | `setFixedValues(Record fixedValues)` Values to be submitted as part of the DSRequest, regardless of inputs to the task.
    `void` | `setOperationType(DSOperationType operationType)` Type of operation to invoke
    `void` | `setValues(Record values)` Values to be submitted for "update", "add" and "remove" operations.

    - ### Methods inherited from class com.smartgwt.client.util.workflow.Task

      `getInputField, getInputFieldList, getOutputField, getOutputFieldList, setInputField, setInputFieldList, setOutputField, setOutputFieldList`

    - ### Methods inherited from class com.smartgwt.client.util.workflow.ProcessElement

      `convertToJavaScriptArray, getID, getJsObj, getNextElement, getOrCreateJsObj, getProcessElements, isCreated, onInit, setAttribute, setID, setJavaScriptObject, setNextElement`

    - ### Methods inherited from class com.smartgwt.client.core.BaseClass

      `applyFactoryProperties, asSGWTComponent, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getRef, getScClassName, getTestInstance, hasAutoAssignedID, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setProperty, setProperty, setProperty, setProperty, setScClassName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ServiceTask

          public ServiceTask()

    - #### ServiceTask

          public ServiceTask(com.google.gwt.core.client.JavaScriptObject jsObj)

  - ### Method Detail

    - #### getOrCreateRef

          public static ServiceTask getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### create

          public com.google.gwt.core.client.JavaScriptObject create()

      Overrides:
        `create` in class `Task`

    - #### setCriteria

          public void setCriteria(Criteria criteria)
                           throws java.lang.IllegalStateException

      Criteria (including AdvancedCriteria) to use for a "fetch" operation.

      Data values in this criteria prefixed with "$" will be treated as dynamic expressions which can access the inputs to this task as $input - see `TaskInputExpression`. Specifically, this means that for simple criteria, any property value that is a String and is prefixed with "$" will be assumed to be an expression, and for AdvancedCriteria, the same treatment will be applied to `Criterion.value`.

      If any data value should not be treated as dynamic (for example, a "$" should be taken as literal), you can place it in `fixedCriteria` instead.

      Ignored for any operationType other than "fetch". Update or delete operations should place the primary key to update in `values`.

      Parameters:
        `criteria` - Default value is null
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created
      See Also:
        `TaskIO overview and related methods`

    - #### getCriteria

          public Criteria getCriteria()

      Criteria (including AdvancedCriteria) to use for a "fetch" operation.

      Data values in this criteria prefixed with "$" will be treated as dynamic expressions which can access the inputs to this task as $input - see `TaskInputExpression`. Specifically, this means that for simple criteria, any property value that is a String and is prefixed with "$" will be assumed to be an expression, and for AdvancedCriteria, the same treatment will be applied to `Criterion.value`.

      If any data value should not be treated as dynamic (for example, a "$" should be taken as literal), you can place it in `fixedCriteria` instead.

      Ignored for any operationType other than "fetch". Update or delete operations should place the primary key to update in `values`.

      Returns:
        Criteria
      See Also:
        `TaskIO overview and related methods`

    - #### setFixedCriteria

          public void setFixedCriteria(Criteria fixedCriteria)
                                throws java.lang.IllegalStateException

      Criteria to be submitted as part of the DSRequest, regardless of inputs to the task. Will be combined with the data from the `Task.inputField` or with `criteria` if specified, via `DataSource.combineCriteria()`.
      Parameters:
        `fixedCriteria` - Default value is null
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getFixedCriteria

          public Criteria getFixedCriteria()

      Criteria to be submitted as part of the DSRequest, regardless of inputs to the task. Will be combined with the data from the `Task.inputField` or with `criteria` if specified, via `DataSource.combineCriteria()`.
      Returns:
        Criteria

    - #### setFixedValues

          public void setFixedValues(Record fixedValues)
                              throws java.lang.IllegalStateException

      Values to be submitted as part of the DSRequest, regardless of inputs to the task. Will be combined with the data from the `Task.inputField` or with `values` if specified, via simple copying of fields, with `fixedValues` overwriting values provided by the `inputField`, but explicitly specified `values` overriding `fixedValues`.
      Parameters:
        `fixedValues` - Default value is null
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getFixedValues

          public Record getFixedValues()

      Values to be submitted as part of the DSRequest, regardless of inputs to the task. Will be combined with the data from the `Task.inputField` or with `values` if specified, via simple copying of fields, with `fixedValues` overwriting values provided by the `inputField`, but explicitly specified `values` overriding `fixedValues`.
      Returns:
        Record

    - #### setOperationType

          public void setOperationType(DSOperationType operationType)
                                throws java.lang.IllegalStateException

      Type of operation to invoke
      Parameters:
        `operationType` - Default value is "fetch"
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getOperationType

          public DSOperationType getOperationType()

      Type of operation to invoke
      Returns:
        DSOperationType

    - #### setValues

          public void setValues(Record values)
                         throws java.lang.IllegalStateException

      Values to be submitted for "update", "add" and "remove" operations.

      Similar to `Criteria`, data values prefixed with "$" will be treated as a `TaskInputExpression`. Use `fixedValues` for any values that start with "$" but should be treated as a literal.

      Parameters:
        `values` - Default value is null
      Throws:
        `java.lang.IllegalStateException` - this property cannot be changed after the underlying component has been created

    - #### getValues

          public Record getValues()

      Values to be submitted for "update", "add" and "remove" operations.

      Similar to `Criteria`, data values prefixed with "$" will be treated as a `TaskInputExpression`. Use `fixedValues` for any values that start with "$" but should be treated as a literal.

      Returns:
        Record

    - #### getDataSource

          public DataSource getDataSource()

      DataSource ID or DataSource instance to be used.
      Returns:
        DataSource

    - #### setDataSource

          public void setDataSource(java.lang.String dataSource)

      DataSource ID or DataSource instance to be used.
      Parameters:
        `dataSource` - dataSource Default value is null

    - #### setDataSource

          public void setDataSource(DataSource dataSource)

      DataSource ID or DataSource instance to be used.
      Parameters:
        `dataSource` - dataSource Default value is null