public class ServiceTask extends Task
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]'.
config, configOnly, factoryCreated, factoryProperties, id, scClassName
Constructor and Description |
---|
ServiceTask() |
ServiceTask(com.google.gwt.core.client.JavaScriptObject jsObj) |
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.
|
getInputField, getInputFieldList, getOutputField, getOutputFieldList, setInputField, setInputFieldList, setOutputField, setOutputFieldList
convertToJavaScriptArray, getID, getJsObj, getNextElement, getOrCreateJsObj, getProcessElements, isCreated, onInit, setAttribute, setID, setJavaScriptObject, setNextElement
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
public ServiceTask()
public ServiceTask(com.google.gwt.core.client.JavaScriptObject jsObj)
public static ServiceTask getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setCriteria(Criteria criteria) throws java.lang.IllegalStateException
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
.
criteria
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdTaskIO overview and related methods
public Criteria getCriteria()
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
.
TaskIO overview and related methods
public void setFixedCriteria(Criteria fixedCriteria) throws java.lang.IllegalStateException
Task.inputField
or with criteria
if specified, via DataSource.combineCriteria()
.fixedCriteria
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic Criteria getFixedCriteria()
Task.inputField
or with criteria
if specified, via DataSource.combineCriteria()
.public void setFixedValues(Record fixedValues) throws java.lang.IllegalStateException
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
.fixedValues
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic Record getFixedValues()
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
.public void setOperationType(DSOperationType operationType) throws java.lang.IllegalStateException
operationType
- Default value is "fetch"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic DSOperationType getOperationType()
public void setValues(Record values) throws java.lang.IllegalStateException
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.
values
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic Record getValues()
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.
public DataSource getDataSource()
public void setDataSource(java.lang.String dataSource)
dataSource
- dataSource Default value is nullpublic void setDataSource(DataSource dataSource)
dataSource
- dataSource Default value is null