XML Actions can be embedded in various files, or put in a file of their own and run like a script. Like a script the parameters passed into the XML Actions will already be defined in the context.
Contains a single condition of any sort and evaluates to a boolean value. To combine the other if operations the and, or, and xor elements can be used.
If true runs the service asynchronously. Use persist to run async through a database record.
ignore-error
boolean
false
optional
in-map
xs:string
false
optional
Creates an in parameters with variables matching the names of service in-parameters elements, doing type conversions as needed. If false (default) does nothing. If true constructs an in-map from the context. Otherwise is the name of a Map in the context uses it as the source Map for the service context.
include-user-login
boolean
true
optional
Include the current user in the service call. If you don't want to pass that in set to false. Defaults to true.
multi
boolean
false
optional
name
xs:string
required
The combined service name, like: "${path}.${verb}${noun}". To explicitly separate the verb and noun put a hash (#) between them, like: "${path}.${verb}#${noun}".
out-map
xs:string
optional
Optional name in the method environment to use for the output (results) map. If empty then the output map will be ignored.
transaction
restriction of xs:token
use-or-begin
optional
transaction-timeout
xs:int
0
optional
Defines the timeout for the transaction, in seconds. This value is only used if this service begins a transaction (either require-new, or use-or-begin and there is no other transaction already in place).
If true runs the service asynchronously. Use persist to run async through a database record.
name
xs:string
required
The combined service name, like: "${path}.${verb}${noun}". To explicitly separate the verb and noun put a hash (#) between them, like: "${path}.${verb}#${noun}".
Runs the script at the specified location. You can also put a Groovy script inline under this element. If a location is specified the file can be a Groovy script or an xml-actions script. The script will run in the same context as the current operation.
Looks for all primary key fields by name in the context, and in the parameters map if not found in the context. Defaults to true. If a field-map sub-element is found this will default to false instead.
cache
boolean
optional
Look in the cache before finding in the datasource. The default for this comes from the cache attribute on the entity definition.
entity-name
xs:string
required
Name of the entity to find an instance of.
for-update
boolean
false
optional
Lock the selected record so only this transaction can change it until it is ended (committed or rolled back). This does not have to be set to true in order to update the record, it just keeps other transactions from updating it. In SQL this does a select for update. If this is true the cache will not be used, regardless of the cache attribute here and on the entity definition.
value-field
xs:string
required
Field to put result resulting EntityValue object in.
Like entity-and returns a list of entity values if any are found, otherwise returns an empty list. Use any combination of constraint, constraints and constraint-object.
Look in the cache before finding in the datasource. The default for this comes from the cache attribute on the entity definition.
distinct
boolean
false
optional
Get only distinct results, based on the combination of all fields selected. Defaults to false.
entity-name
xs:string
required
Name of entity to find instances of.
for-update
boolean
false
optional
Lock the selected record so only this transaction can change it until it is ended (committed or rolled back). This does not have to be set to true in order to update the record, it just keeps other transactions from updating it. In SQL this does a select for update. If this is true the cache will not be used, regardless of the cache attribute here and on the entity definition.
Adds econditions for the fields found in the input-fields-map. The fields and special fields with suffixes supported are the same as the *-find fields in the XML Forms. This means that you can use this to process the data from the various inputs generated by XML Forms. The suffixes include things like *_op for operators and *_ic for ignore case. For historical reference, this does basically what the Apache OFBiz prepareFind service does.
The map to get form fields from. If empty will look at the ec.web.parameters map if the web facade is available, otherwise the current context (ec.context).
paginate
xs:string
true
optional
Indicate if this find should set pagination options even if there are no pageSize and pageIndex parameters. Also adds a context field called "${entity-find.@list}Count" with a count of the total possible results (ie without the offset/limit). Defaults to true.
The field on the entity to constrain on. If from, value and to-field-name are all empty this is also used as the name of the context field to compare to.
from
xs:string
optional
Field expression in the context to compare the entity field to.
ignore
xs:string
false
optional
Ignore the econdition (leave out of the find) if set to true. Defaults to false.
ignore-case
boolean
false
optional
Ignore case when doing the compare. Defaults to false.
ignore-if-empty
boolean
false
optional
Leave out the constraint if the comparison value is empty or null. Defaults to false.
operator
operator-entity
equals
optional
Operator to apply to field-name on one side, and from, value, or to-field-name on the other side. For the between operator the from should be a Collection with exactly 2 values in it. For the in operator the from should be a Collection with 1 to many values in it. For the like operator use the standard SQL wildcards, including "%" for any number of characters (like *) and "_" for a single character (like ?), and escape them with a "!" in from of each character to escape). Defaults to equals.
to-field-name
xs:string
optional
Compare the field-name field to another field on the entity.
value
xs:string
optional
Comparison value, use ${} syntax to expand variables.
The econditions element contains a list of econditions that are combined with either and or or. The default is and. You can have econditions under econditions, for building fairly complex econdition trees, and you can also drop in econdition-objects at any point.
Specifies whether or not to use the EntityListIterator when doing the query. This is much more efficient for large data sets because the results are read incrementally instead of all at once. Note that when using this the use-cache setting will be ignored. Also note that an EntityListIterator must be closed when you are finished, but this is done automatically by the iterate operation. Must be true or false, defaults to false.
Look in the cache before finding in the datasource. The default for this comes from the cache attribute on the entity definition.
for-update
boolean
false
optional
Lock the selected record so only this transaction can change it until it is ended (committed or rolled back). This does not have to be set to true in order to update the record, it just keeps other transactions from updating it. In SQL this does a select for update. If this is true the cache will not be used, regardless of the cache attribute here and on the entity definition.
relationship-name
xs:string
required
Name of the relationship to use, consists of the relationship title and the related entity name, like: ${title}${related-entity-name}.
Find a list of values related to a specific value.
Attributes
QName
Type
Fixed
Default
Use
Annotation
cache
boolean
optional
Look in the cache before finding in the datasource. The default for this comes from the cache attribute on the entity definition.
for-update
boolean
false
optional
Lock the selected record so only this transaction can change it until it is ended (committed or rolled back). This does not have to be set to true in order to update the record, it just keeps other transactions from updating it. In SQL this does a select for update. If this is true the cache will not be used, regardless of the cache attribute here and on the entity definition.
list
xs:string
required
Name of the list to put the entity list result in.
map
xs:string
optional
A map containing extra constraints for the find.
order-by-list
xs:string
optional
A list of field names to order the results by.
relationship-name
xs:string
required
Name of the relationship to use, consists of the relationship title and the related entity name,like: ${title}${related-entity-name}.
The make-value tag uses the delegator to construct an entity value. The resulting value will not exist in the database, but will simply be assembled using the entity-name and fields map. The resulting EntityValue object will be placed in the method environment using the specified value-field.
Attributes
QName
Type
Fixed
Default
Use
Annotation
entity-name
xs:string
required
The name of the entity to construct an instance of.
map
xs:string
optional
The name of a map in the method environment that will be used for the entity fields.If the map is an EntityValue object then this will clone the value.
value-field
xs:string
required
The name of the field where the EntityValue object will be put.
The create-value tag persists the specified EntityValue object by creating a new instance of the entity in the datasource. An error will result if an instance of the entity exists in the datasource with the same primary key.
Attributes
QName
Type
Fixed
Default
Use
Annotation
or-update
boolean
false
optional
Update value if already exists instead of returning an error, defaults to false.
value-field
xs:string
required
The name of the field that contains the EntityValue object.
Given a value-field and a relationship-name, follows the relationship and deletes all related records. For a type one relationship it will remove a single record if it exists, and for a type many relationship it will remove all the records that are related to it. Instead of using cascading deletes you should have your code delete all related data with foreign keys pointing the the value-field record, and then delete the value-field.
Attributes
QName
Type
Fixed
Default
Use
Annotation
relationship-name
xs:string
required
Name of a relationship to use to delete related records.
value-field
xs:string
required
Field that contains an EntityValue object to delete related records from.
Looks for each field (pk, nonpk, or all) in the named map and if it exists there it will copy it into the named value object.
Attributes
QName
Type
Fixed
Default
Use
Annotation
include
restriction of xs:token
all
optional
map
xs:string
context
optional
The name of a map in the method environment that will be used for the entity fields. Defaults to the context root, which is where incoming parameters go by default.
prefix
xs:string
optional
If not null or empty will be pre-pended to each field name (upper-casing the first letter of the field name first), and that will be used as the fields Map lookup name instead of the field-name.
set-if-empty
boolean
true
optional
Specifies whether or not to set fields that are null or empty. Defaults to true.
Get the next guaranteed unique seq id for this entity, and set it in the primary key field. This will set it in the first primary key field in the entity definition, but it really should be used for entities with only one primary key field.
Given an entity value object with all primary key fields except one already set will generate an ID for the remaining primary key field by looking at all records with the partial primary key and then adding increment-by to the highest value.
The operations contained by the iterate tag will be executed for each of the entries in the list, and will make the current entry available in the method environment by the entry-name specified. This tag can contain any of the xml-action operations, including the conditional/if operations. Any xml-action operation can be nested under the iterate tag.
Each condition under the assert element will be checked and if it fails an error will be added to the given error list. Note that while the definitions for the if-* operations are used, the tags should be empty because of the differing semantics. This is mainly used for testing, and for writing xml-actions that are meant to be used as part of a test suite. This is mostly useful for testing because the messages are targeted at a programmer, and not really at an end user.
Used to process/consume an XML document. The document can be either a text file at a location or can be in a field in the current context that is either an XML text document or a org.w3c.dom.Document object or even a org.w3c.dom.Element object.
Process a single or list of XML elements looked up using an xpath expression relative to the current element (or root element if right under the xml-consume element). The sub-operations and xml-consume-element tags will be run for each element matching the xpath expression.
The name of the field the element/node object will go into for the operations under this tag.This object can be treated either as a org.w3c.dom.Element or as a Map.
Create a single XML element, added to a document under the named parent element field. The element created becomes the parent element for any child xml-produce-element operations encountered.
The name of the field the element/node object will go into for the operations under this tag. This object can be treated either as a org.w3c.dom.Element or as a Map to set attributes on the element.
name
xs:string
required
parent-element
xs:string
optional
This operation is usually nested somewhere under another xml-produce-element operation and under an xml-produce operation. In those cases there will be a default parent element field that will be automatically used if this is not specified, otherwise an element field must be specified here (with an object type org.w3c.dom.Element).
The if operation offers a flexible way of specifying combinations of conditions, alternate conditions, and operations to run on true evaluation of the conditions or to run otherwise. The other if operations are meant for a specific, simple condition when used outside of the condition sub-element of this operation. The attributes of the other if operations are the same when used inside this operation. Note that while the definitions for the if-* operations are used, the tags should be empty because of the differing semantics.
The else-if element can be used to specify alternate conditional execution blocks. Each else-if element must contain two sub-elements: condition and then. If the condition of the parent is evaluated to false, each condition of the else-if sub-elements will be evaluated, and the operations under the element corresponding to the first condition that evaluates to true will be run.
The else element can be used to contain operations that will run if the condition evaluates to false, and when under an if element when no else-if sub-conditions evaluate to true. It can contain any xml-actions operation.
To be true just one of the conditions underneath needs to be true. Will return true as soon as a condition is true, not evaluating remaining conditions.
To be true all of the conditions underneath need to be true. Will return false as soon as a condition evaluates to false, not evaluating remaining conditions. If no conditions evaluate to false will return true.
The operations contained by the if-compare tag will only be executed if the comparison returns true. This tag can contain any of the xml-action operations, including the conditional/if operations.
A boolean expression should be inline under this element (to avoid problems with character encoding, etc). When not under a condition element any xml-action operation can be nested under this tag, and will only be run if it evaluates to true.