Mini-language Reference
The Apache Open For Business Project
This is a draft document. It can be modified at any time by any committer. Comments on the draft should be made on the dev mailing list.
Grammar version 2 (http://ofbiz.apache.org/dtds/simple-methods-v2.xsd
)
Attributes
Attribute Types
Type |
Description |
Example |
---|---|---|
constant |
A string constant. The string may not include an expression |
name="fooMethod" |
constant+expr |
A string constant. The string may include an expression, but an expression-only string is not allowed |
default="${foo}Method" |
expression |
A UEL expression without enclosing brackets |
from="item.quantity * item.priceEach" |
${expression} |
A UEL expression with enclosing brackets |
default="${parameters.itemId}" |
script |
A short script ("scriptlet") |
script="groovy:foo.bar();" |
The <simple-method>
element
<simple-method>
Contains a block of code.
A simple method can be called in either an event context from the Control
Servlet (or another event) or in a service context through the Service
Engine, or any other component that has access to a service dispatcher.
<simple-method method-name="fooMethod"> <!-- some mini-language code goes here --> </simple-method>
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
method-name |
constant |
required |
A name (preferably a legal Java identifier) for this method. |
Each simple method in a file must have a unique name. |
short-description |
constant |
optional |
A short description of the method. |
Used for documentation. |
login-required |
constant |
optional |
Require a user login to run this method. |
Defaults to "true". |
use-transaction |
constant |
optional |
Create a transaction if none exists for this thread. |
Defaults to "true". |
default-error-code |
constant |
optional |
The default error return code. |
Defaults to "error". |
default-success-code |
constant |
optional |
The default success return code. |
Defaults to "success". |
event-request-object-name |
constant |
optional |
The name of the field containing the |
Defaults to "request". |
event-response-object-name |
constant |
optional |
The name of the field containing the |
Defaults to "response". |
event-session-object-name |
constant |
optional |
The name of the field containing the |
Defaults to "session". |
event-response-code-name |
constant |
optional |
The name of the field containing the event response code. |
Defaults to "response_code". |
event-error-message-name |
constant |
optional |
The name of the field containing the event error message. |
Defaults to "error_message". |
event-error-message-list-name |
constant |
optional |
The name of the field containing the event message list. |
Defaults to "error_message_list". |
event-event-message-name |
constant |
optional |
The name of the field containing the event message. |
Defaults to "event_message". |
event-event-message-list-name |
constant |
optional |
The name of the field containing the event message list. |
Defaults to "event_message_list". |
service-response-message-name |
constant |
optional |
The name of the field containing the service response message. |
Defaults to "responseMessage". |
service-error-message-name |
constant |
optional |
The name of the field containing the service error message. |
Defaults to "errorMessage". |
service-error-message-list-name |
constant |
optional |
The name of the field containing the service error message list. |
Defaults to "errorMessageList". |
service-error-message-map-name |
constant |
optional |
The name of the field containing the service error message map. |
Defaults to "errorMessageMap". |
service-success-message-name |
constant |
optional |
The name of the field containing the service success message. |
Defaults to "successMessage". |
service-success-message-list-name |
constant |
optional |
The name of the field containing the service success message list. |
Defaults to "successMessageList". |
Draft Status
Final draft.
Assignment Operations
<add-error>
Adds a message to the error message list.
<add-error> <fail-message message="There was an error" /> </add-error>
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
error-list-name |
constant |
optional |
The name of a list that will contain the message. |
Defaults to "error_list". |
Child Elements
One of the following child elements is required:
Draft Status
Final draft.
<clear-field>
Sets the value of the specified field to null.
<clear-field field="foo" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to remove. |
|
Draft Status
Final draft.
<create-object>
Creates an instance of the specified class.
The string and field sub-elements are passed to the constructor method as arguments in the order they are specified.
A runtime exception will be thrown if the sub-elements do not match the constructor method arguments.
<create-object field="foo" class-name="com.acme.FooClass"> <string value="bar" /> <field field="foo" /> </create-object>
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field for the new object. |
|
class-name |
constant |
required |
The Java class name. |
|
Child Elements
Deprecated - use the <script>
element.
Draft Status
Final draft.
<fail-message>
Declares an error message.
<add-error> <fail-message message="There was an error." /> </add-error>
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
message |
constant+expr |
required |
The message text. |
|
Draft Status
Final draft.
<fail-property>
Declares an error message found in a properties file.
<add-error> <fail-property resource="ErrorMessages" property="FooError" /> </add-error>
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
resource |
constant |
required |
The name of the resource where the message can be found. |
|
property |
constant |
required |
The message property key. |
|
Draft Status
Final draft.
<field>
Specifies an environment field to be passed as an argument to an object method call.
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the environment field to use. |
|
type |
constant |
optional |
The Java class of the argument. |
Defaults to "java.lang.String". |
Draft Status
Final draft.
<field-to-list>
Appends an object to the specified list.
<field-to-list list="barList" field="foo" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The field to add to the list. |
If the field does not exist, the operation does nothing. |
list |
expression |
required |
Name of the list. |
If the list does not exist, one is created. |
Deprecated - use the <set>
element.
Draft Status
Final draft.
<field-to-request>
Copies a field to a servlet request attribute.
Valid only when the simple-method is called as an event, it is ignored otherwise.
<field-to-request field="foo" request-name="fooAttribute" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to copy. |
If the field does not exist, the operation does nothing. |
request-name |
constant, ${expression} |
optional |
The servlet request attribute name. |
Defaults to the value of field attribute. |
Draft Status
Final draft.
<field-to-result>
Copies a field to a service OUT attribute.
<field-to-result field="foo" result-name="fooAttribute" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to copy from, the source of the assignment. |
|
result-name |
expression |
optional |
The name of the result field to set, the target of the assignment. |
Defaults to the value of field attribute. |
Draft Status
Final draft.
<field-to-session>
Copies a field to a servlet session attribute.
Valid only when the simple-method is called as an event, it is ignored otherwise.
<field-to-session field="foo" session-name="fooAttribute" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to copy. |
If the field does not exist, the operation does nothing. |
session-name |
constant, ${expression} |
optional |
The servlet session attribute name. |
Defaults to the value of field attribute. |
Draft Status
Final draft.
<first-from-list>
Assigns the first (lowest order) entry in a list to a field.
<first-from-list entry-name="foo" list-name="fooList" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
entry-name |
expression |
required |
The name of the field to set. |
|
list-name |
expression |
required |
The name of the list that contains the object to copy. |
Defaults to a null value if the list does not exist or is empty. |
Deprecated - use the <set>
element.
Draft Status
Final draft.
<list-to-list>
Copies list elements to another list.
<list-to-list list-name="foo" to-list-name="fooList" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
list-name |
expression |
required |
The name of the list to copy from. |
Operation does nothing if the list does not exist. |
to-list-name |
expression |
required |
Name of the list to copy to. |
If the list does not exist, one will be created. |
Draft Status
Final draft.
<map-to-map>
Copies a map to another map.
<map-to-map map="oldMap" to-map="newMap" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
map |
expression |
required |
The name of the map to copy from. |
Operation does nothing if the map does not exist. |
to-map |
expression |
optional |
The name of the map to copy to. |
If this attribute is empty, the source map will be copied to the current environment. |
Draft Status
Final draft.
<now>
Sets a field to the current system time.
<now field="fooNow" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
type |
constant |
optional |
The field data type. |
Defaults to "java.sql.Timestamp". |
Draft Status
Final draft.
<now-date-to-env>
Sets a field to a java.sql.Date
object initialized to the current system time.
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
Deprecated - use the <now>
element.
Draft Status
Final draft.
<now-timestamp>
Sets a field to a java.sql.Timestamp
object initialized to the current system time.
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
Deprecated - use the <now>
element.
Draft Status
Final draft.
<order-by>
Defines a field or map key to sort on.
<order-map-list list="fooList"> <order-by field="fooKey" /> </order-map-list>
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field or map key to sort on. |
|
Draft Status
Final draft.
<order-map-list>
Sorts a list of maps.
Maps are sorted by the keys specified in the order-by sub-elements.
<order-map-list list="fooList"> <order-by field="fooKey" /> </order-map-list>
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
list |
expression |
required |
The name of the list to be sorted. |
Operation does nothing if the list is not found. |
Child Elements
Draft Status
Final draft.
<property-to-field>
Assigns a resource property value to a field.
<property-to-field field="foo" resource="fooResource.properties" property="fooKey" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
resource |
constant, ${expression} |
required |
The name of a properties resource. Can be a file on the classpath or a resource defined in the SystemProperty entity. |
|
property |
constant, ${expression} |
required |
The property key. |
|
default |
constant, ${expression} |
optional |
The default value to use if the property value is null or empty. |
|
no-locale |
constant |
optional |
Suppress property value localization. The user's/system locale will be ignored when retriving the property value. |
Default is "false". |
arg-list |
expression |
optional |
An argument list to be used with a formatting string. The argument list is applied to the property value. |
Does nothing if the argument list is not found. See the java.text.MessageFormat class for more information. |
Draft Status
Final draft.
<request-parameters-to-list>
Appends a servlet request parameter list to a list.
Valid only when the simple-method is called as an event, it is ignored otherwise.
<request-parameters-to-list list-name="fooList" request-name="fooParameter" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
request-name |
constant, ${expression} |
required |
The name of the servlet request parameter. All matching parameter values will be added to the list. |
|
list-name |
expression |
optional |
Name of the list. If the list does not exist, one is created. |
Defaults to the request-name attribute value. |
Draft Status
Final draft.
<request-to-field>
Copies a servlet request attribute to a field.
Valid only when the simple-method is called as an event, it is ignored otherwise.
<request-to-field field="foo" request-name="fooAttribute" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
request-name |
constant, ${expression} |
optional |
The servlet request attribute name. |
Defaults to the value of field attribute. |
default |
constant, ${expression} |
optional |
A default value to use if the request attribute does not exist. |
|
Draft Status
Final draft.
<session-to-field>
Copies a servlet session attribute to a field.
Valid only when the simple-method is called as an HTTP event, it is ignored otherwise.
<session-to-field field="foo" session-name="fooAttribute" />
Attributes
Name |
Type |
Requirements |
Description |
Note |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
session-name |
constant, ${expression} |
optional |
The servlet session attribute name. |
Defaults to the value of field attribute. |
default |
constant, ${expression} |
optional |
A default value to use if the session attribute does not exist. |
|
Draft Status
Final draft.
<set>
Assigns a field from an expression or script, or from a constant value.
<set field="foo" value="bar" /> <set field="baz" from="foo" /> <!-- Field "baz" contains the string "bar" -->
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
from |
expression, script |
required if value is empty |
An expression or script that returns an object or |
The script must be prefixed with the script language followed by a colon (":"). |
value |
constant+expr |
required if from is empty |
A constant value. |
Default type = "java.lang.String". |
default |
constant, ${expression} |
optional |
A default value - used if from evaluates to null. |
|
type |
constant |
optional |
The Java data type of field. |
"NewList" will create a new |
set-if-null |
constant |
optional |
Controls if field can be set to |
Defaults to "false". |
set-if-empty |
constant |
optional |
Controls if field can be set to an empty value. The meaning of "empty" depends on the Java data type. |
Defaults to "true". |
Draft Status
Final draft.
<set-calendar>
Adjusts a Timestamp by a specified time duration.
<set-calendar field="tomorrowStamp" from-field="nowTimestamp" day="1" /> <set-calendar field="yesterdayStamp" from-field="nowTimestamp" day="-1" />
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
from |
expression, script |
required if value is empty |
An expression or script that returns an object or |
The script must be prefixed with the script language followed by a colon (":"). |
value |
constant+expr |
required if from is empty |
A constant value. |
Default type = "java.lang.String". |
default |
constant, ${expression} |
optional |
A default value - used if from evaluates to null. |
|
type |
constant |
optional |
The Java data type of field. |
"NewList" will create a new |
set-if-null |
constant |
optional |
Controls if field can be set to |
Defaults to "false". |
set-if-empty |
constant |
optional |
Controls if field can be set to an empty value. The meaning of "empty" depends on the Java data type. |
Defaults to "true". |
years |
constant, ${expression} |
optional |
Add (optionally using +) or subtract (using -) a number of year(s). |
If an expression is used, it should evaluate to an integer. |
months |
constant, ${expression} |
optional |
Add (optionally using +) or subtract (using -) a number of month(s). |
If an expression is used, it should evaluate to an integer. |
days |
constant, ${expression} |
optional |
Add (optionally using +) or subtract (using -) a number of days(s). |
If an expression is used, it should evaluate to an integer. |
hours |
constant, ${expression} |
optional |
Add (optionally using +) or subtract (using -) a number of hour(s). |
If an expression is used, it should evaluate to an integer. |
minutes |
constant, ${expression} |
optional |
Add (optionally using +) or subtract (using -) a number of minute(s). |
If an expression is used, it should evaluate to an integer. |
seconds |
constant, ${expression} |
optional |
Add (optionally using +) or subtract (using -) a number of second(s). |
If an expression is used, it should evaluate to an integer. |
millis |
constant, ${expression} |
optional |
Add (optionally using +) or subtract (using -) a number of milli-second(s). |
If an expression is used, it should evaluate to an integer. |
period-align-start |
constant, ${expression} |
optional |
Align the adjusted date to the start of a period: "day", "week", "month", "year" |
|
period-align-end |
constant, ${expression} |
optional |
Align the adjusted date to the start of a period: "day", "week", "month", "year" |
|
locale |
constant, ${expression} |
optional |
The locale (calendar) to be used for the operation |
|
time-zone |
constant, ${expression} |
optional |
The time zone to be used for the operation |
|
Draft Status
Final draft.
<set-service-fields>
Copies elements from a source map that match a service's IN attributes to a target map.
<set-service-fields service-name="fooService" map="barMap" to-map="fooServiceAttributes" />
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
service-name |
constant, ${expression} |
required |
The name of the service. |
|
map |
expression |
required |
The name of the map to copy the matching IN attributes from. |
The operation does nothing if the map does not exist. |
to-map |
expression |
required |
The name of the map to copy the matching IN attributes to. |
If the map does not exist, a new one is created. |
Draft Status
Final draft.
<string-append>
Performs string concatenation and formatting.
The operation starts by applying an argument list (if found) to the string attribute value, the result is prepended by the prefix attribute value, and the suffix attribute value is appended to the result. If the string specified in the field attribute exists, the final result is appended to it, else the field is set to the final result.
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
string |
constant, ${expression} |
required |
The string to append to the field named in the field attribute. |
This can be a formatting string that is used with the argument list specified in the arg-list attribute. |
arg-list |
expression |
optional |
An argument list to be used with a formatting string. The argument list is applied to the string attribute value. |
Does nothing if the argument list is not found. See the java.text.MessageFormat class for more information. |
prefix |
constant, ${expression} |
optional |
A string that will be prepended to the string attribute value. |
|
suffix |
constant, ${expression} |
optional |
A string that will be appended to the string attribute value. |
|
Draft Status
Final draft.
<string-to-list>
Adds a string to a list of strings.
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
string |
constant, ${expression} |
required |
The string to add to the list specified in the list attribute. |
|
list |
expression |
required |
List to add the string to. |
If the list does not exist, one will be created. |
arg-list |
expression |
optional |
An argument list to be used with a formatting string. The argument list is applied to the string attribute value. |
Does nothing if the argument list is not found. See the java.text.MessageFormat class for more information. |
message-field |
constant |
optional |
Inserts a message above a field (used in conjunction with @fieldErrors FTL macro). |
|
Deprecated - use the <set>
element.
Draft Status
Final draft.
<to-string>
Converts an object to a string.
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
field |
expression |
required |
The name of the field containing the object to convert. |
The operation does nothing if the object is not found. |
format |
constant |
optional |
Format to use for the conversion. |
|
numeric-padding |
constant |
optional |
Left-pad the string with the specified number of zeroes. |
|
Deprecated - use the <set>
element.
Draft Status
Final draft.
<webapp-property-to-field>
Copies a property value from a properties file in a ServletContext resource to a field.
<webapp-property-to-field field="foo" resource="/WEB-INF/foo.properties" property="fooKey" />
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
field |
expression |
required |
The name of the field to set, the target of the assignment. |
|
resource |
constant, ${expression} |
required |
The resource location of the properties file inside the webapp, and relative to the root of the webapp (can be inside a war file). |
Example: "/WEB-INF/myprops.properties". |
property |
constant, ${expression} |
required |
The property key. |
|
default |
constant, ${expression} |
optional |
A default value to use if the property value is null or empty. |
|
Draft Status
Final draft.
Conditional/Looping Statements
<and>
Combines conditional elements using a boolean AND.
<if> <condition> <and> <if-compare field="colorModel" operator="equals" value="RYB" /> <or> <if-compare field="color" operator="equals" value="red" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="blue" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> <else> <set field="isPrimaryColor" value="false" type="Boolean" /> </else> </if>
<assert>
Evaluates each contained condition independently, and adds an error message to the error message list for each condition that does not evaluate to true
.
Attributes
title |
optional |
The assertion title - used in error messages to identify the assertion |
|
error-list-name |
optional |
The name of the error list |
Defaults to "error_list" |
Child Elements
Any |
optional |
A condition to test |
Proposed Changes
- Currently, the title attribute is optional. Keep the title attribute optional but have it default to the file location and line number.
- Eliminate the error-list-name attribute.
- Currently, the child element is optional. Require at least one child element.
<break>
Causes script execution to exit the nearest loop element.
<check-id>
Evaluates the specified field, and adds an error message to the error message list if the field's value is not a valid database ID value.
Attributes
field |
optional |
The name of the field to validate |
|
map-name |
optional |
The name of the map containing field |
|
error-list-name |
optional |
The name of the error list |
Defaults to "error_list" |
Child Elements
<fail-message> |
optional |
<fail-property> |
optional |
Proposed Changes
- Currently, the field attribute is optional. Require the field attribute.
- Eliminate the map-name and error-list-name attributes.
- Currently, the child elements are optional. Require one child element.
<check-errors>
Halts script execution if the error message list contains any messages. The error message list is returned to the calling process.
Attributes
error-code |
optional |
The error code to return |
Defaults to "error" |
error-list-name |
optional |
The name of the error list |
Defaults to "error_list" |
Proposed Changes
- Eliminate the error-list-name attribute.
<check-permission>
Checks if the user has the specified permission, and adds an error message to the error message list if the user does not have the specified permission.
Attributes
permission |
optional |
The permission to check |
|
action |
optional |
The action to be performed (permission scope) |
|
error-list-name |
optional |
The name of the error list |
Defaults to "error_list" |
Child Elements
<accept-userlogin-party> |
optional |
<alt-permission> |
optional |
<fail-message> |
optional |
<fail-property> |
optional |
Proposed Changes
- Currently, the permission and action attributes are optional. Require the permission and action attributes.
- Eliminate the error-list-name attribute.
<condition>
Combines a group of conditional elements into a single logical (true/false) expression.
<if> <condition> <and> <if-compare field="colorModel" operator="equals" value="RYB" /> <or> <if-compare field="color" operator="equals" value="red" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="blue" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> <else> <set field="isPrimaryColor" value="false" type="Boolean" /> </else> </if>
<continue>
Causes script execution to return to the beginning of the nearest enclosing loop element.
<else>
Contains a block of code to be executed when a condition evaluates to false
.
<if> <condition> <and> <if-compare field="colorModel" operator="equals" value="RYB" /> <or> <if-compare field="color" operator="equals" value="red" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="blue" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> <else> <set field="isPrimaryColor" value="false" type="Boolean" /> </else> </if>
<else-if>
Contains a block of code to be executed when a condition evaluates to false
.
<if> <condition> <and> <if-compare field="colorModel" operator="equals" value="RYB" /> <or> <if-compare field="color" operator="equals" value="red" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="blue" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> <else-if> <condition> <and> <if-compare field="colorModel" operator="equals" value="CYM" /> <or> <if-compare field="color" operator="equals" value="cyan" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="magenta" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> </else-if> <else> <set field="isPrimaryColor" value="false" type="Boolean" /> </else> </if>
<if>
Contains blocks of code that are executed based on a logical (true/false) condition.
<if> <condition> <and> <if-compare field="colorModel" operator="equals" value="RYB" /> <or> <if-compare field="color" operator="equals" value="red" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="blue" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> <else-if> <condition> <and> <if-compare field="colorModel" operator="equals" value="CYM" /> <or> <if-compare field="color" operator="equals" value="cyan" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="magenta" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> </else-if> <else> <set field="isPrimaryColor" value="false" type="Boolean" /> </else> </if>
Child Elements
<condition> |
optional |
<then> |
optional |
<else> |
optional |
<else-if> |
optional |
Proposed Changes
- Currently, the
<condition>
and<then>
child elements are optional. Require the<condition>
and<then>
child elements.
<if-compare>
Compares a field to a constant value.
Attributes
field |
optional |
The name of the field to test |
|
operator |
optional |
The comparison operator |
|
value |
optional |
A constant value |
|
type |
optional |
The Java data type of field |
Defaults to "String" |
format |
optional |
Object type conversion format |
|
map-name |
optional |
The name of the map containing field |
|
Proposed Changes
- Currently, the field and operator attributes are optional. Require the field and operator attributes.
- Eliminate the map-name attribute.
<if-compare-field>
Compares a field to another field.
Attributes
field |
optional |
The name of the field to test (the l-value) |
|
operator |
optional |
The comparison operator |
|
to-field |
optional |
The name of the field to test (the r-value) |
Defaults to field |
type |
optional |
The Java data type of field |
Defaults to "String" |
format |
optional |
Object type conversion format |
|
map-name |
optional |
The name of the map containing field |
|
to-map-name |
optional |
The name of the map containing to-field |
|
Proposed Changes
- Currently, the field, operator, and to-field attributes are optional. Require the field, operator and to-field attributes.
- Eliminate the map-name and to-map-name attributes.
<if-empty>
Contains blocks of code that are executed based on the size of a collection.
Attributes
field |
optional |
The name of the field to test |
map-name |
optional |
The name of the map containing field |
Child Elements
<else> |
optional |
Proposed Changes
- Currently, the field attribute is optional. Require the field attribute.
- Eliminate the map-name attribute.
<if-has-permission>
Contains blocks of code that are executed based on the user's permissions.
Attributes
permission |
optional |
The permission to check |
|
action |
optional |
The action to be performed (permission scope) |
|
Child Elements
<else> |
optional |
Proposed Changes
- Currently, the permission and action attributes are optional. Require the permission and action attributes.
<if-instance-of>
Contains blocks of code that are executed based on a field's class.
Attributes
field |
optional |
The name of the field to test |
class |
optional |
The name of the class |
map-name |
optional |
The name of the map containing field |
Child Elements
<else> |
optional |
Proposed Changes
- Deprecate and replace with scriptlet.
<if-not-empty>
Contains blocks of code that are executed based on the size of a collection.
Attributes
field |
optional |
The name of the field to test |
map-name |
optional |
The name of the map containing field |
Child Elements
<else> |
optional |
Proposed Changes
- Currently, the field attribute is optional. Require the field attribute.
- Eliminate the map-name attribute.
<if-regexp>
Contains blocks of code that are executed based on matching a regular expression to a field.
Attributes
field |
optional |
The name of the field to test |
expr |
optional |
The regular expression to match |
map-name |
optional |
The name of the map containing field |
Child Elements
<else> |
optional |
Proposed Changes
- Currently, the field and expr attributes are optional. Require the field and expr attributes.
- Eliminate the map-name attribute.
<if-validate-method>
Invokes a Java class method that returns a boolean value. Blocks of code are executed based on the boolean value.
Attributes
field |
optional |
The name of the field to use as a method argument |
class |
optional |
The name of the Java class |
method |
optional |
The name of the class method |
map-name |
optional |
The name of the map containing field |
Child Elements
<else> |
optional |
Proposed Changes
- Deprecate and replace with simple method call.
<iterate>
Contains a block of code that is executed once for each entry in a specified collection.
Attributes
list |
optional |
The name of the field containing the collection to iterate |
entry |
optional |
The name of the field that will contain the collection entry |
Proposed Changes
- Currently, both attributes are optional. Require both attributes.
<iterate-map>
Contains a block of code that is executed once for each entry in a MapEntry
set.
Attributes
map |
optional |
The name of the field containing the |
key |
optional |
The name of the field that will contain the |
value |
optional |
The name of the field that will contain the |
Proposed Changes
- Currently, all attributes are optional. Require the map attribute and one of the key or value attributes.
<loop>
Contains a block of code that is executed repeatedly until a maximum count is reached.
Attributes
field |
optional |
The name of the field containing the current count value |
|
count |
optional |
A maximum count expression |
Defaults to "0" (zero) |
Proposed Changes
- Currently, all attributes are optional. Require all attributes.
<not>
Inverts a conditional element using a boolean NOT.
<or>
Combines conditional elements using a boolean OR.
<if> <condition> <and> <if-compare field="colorModel" operator="equals" value="RYB" /> <or> <if-compare field="color" operator="equals" value="red" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="blue" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> <else> <set field="isPrimaryColor" value="false" type="Boolean" /> </else> </if>
<return>
Returns control (execution) to the calling process.
Attributes
response-code |
optional |
A response code to return to the calling process |
<then>
Contains a block of code to be executed when a <condition>
element evaluates to true
.
<if> <condition> <and> <if-compare field="colorModel" operator="equals" value="RYB" /> <or> <if-compare field="color" operator="equals" value="red" /> <if-compare field="color" operator="equals" value="yellow" /> <if-compare field="color" operator="equals" value="blue" /> </or> </and> </condition> <then> <set field="isPrimaryColor" value="true" type="Boolean" /> </then> <else> <set field="isPrimaryColor" value="false" type="Boolean" /> </else> </if>
<while>
Contains a block of code that is executed repeatedly while a <condition>
element evaluates to true
.
Child Elements
<condition> |
optional |
<then> |
optional |
Proposed Changes
- Currently, the
<condition>
and<then>
child elements are optional. Require the<condition>
and<then>
child elements.
<xor>
Combines conditional elements using a boolean XOR.
Call Operations
<call-bsh>
Executes a BSH script.
Proposed Changes
- Deprecate and replace with
<script>
.
<call-class-method>
Calls a Java class method using the given fields as parameters.
Proposed Changes
- Deprecate and replace with
<script>
.
<call-map-processor>
Invokes a Map
processing element.
Attributes
xml-resource |
optional |
The location of the |
processor-name |
optional |
The name of the |
in-map-name |
optional |
The name of the field that contains the |
out-map-name |
optional |
The name of the field that will receive the processed |
error-list-name |
optional |
The name of the field that will contain a list of error messages generated by the processor |
Child Elements
<simple-map-processor> |
optional |
Proposed Changes
- Deprecate and replace with a
<call-simple-method>
element.
<call-object-method>
Calls a Java object method using the given fields as parameters.
Proposed Changes
- Deprecate and replace with
<script>
.
<call-service>
Invokes an OFBiz service.
Attributes
service-name |
optional |
The name of the service to invoke |
in-map-name |
optional |
The name of the field that contains the service IN attributes |
include-user-login |
optional |
If "true" the current UserLogin |
break-on-error |
optional |
If "true" script execution stops if the called service returns an error |
error-code |
optional |
|
require-new-transaction |
optional |
|
transaction-timeout |
optional |
|
success-code |
optional |
|
Child Elements
<error-prefix> |
optional |
<error-suffix> |
optional |
<success-prefix> |
optional |
<success-suffix> |
optional |
<message-prefix> |
optional |
<message-suffix> |
optional |
<default-message> |
optional |
<results-to-map> |
optional |
<result-to-field> |
optional |
<result-to-request> |
optional |
<result-to-session> |
optional |
<result-to-result> |
optional |
Proposed Changes
- Currently, the service-name attribute is optional. Require the service-name attribute.
- Currently, the in-map-name
Map
is passed directly to the service. Have the in-map-name attribute behave like the<set-service-fields>
map attribute.
<call-service-asynch>
Invokes an OFBiz service asynchronously.
Attributes
service-name |
optional |
The name of the service to invoke |
in-map-name |
optional |
The name of the field that contains the service IN attributes |
include-user-login |
optional |
If "true" the current UserLogin |
Proposed Changes
- Deprecate and replace with
<call-service>
element. Add an async attribute ("true"/"false") to the<call-service>
element.
<call-simple-method>
Invokes a Mini-language simple method.
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
method-name |
constant |
required |
The name of the |
|
xml-resource |
constant |
optional |
The location of the |
Defaults to current file |
scope |
constant |
optional |
The memory scope to use |
Defaults to "inline" |
Draft Status
Final draft.
<script>
Executes a script.
Attributes
Name |
Type |
Requirements |
Description |
Notes |
---|---|---|---|---|
location |
constant |
required if script is empty |
The location of the script file |
Script functions/methods can be invoked by appending a hash (#) and the function/method name |
script |
script |
required if location is empty |
A short script (scriptlet). Can be used instead of a file |
|
Draft Status
Final draft.
Entity Operations
<clear-cache-line>
Removes an entity from the cache.
<clear-cache-line entity-name="Party" />
Attributes
entity-name |
optional |
The name of the entity to remove |
map-name |
optional |
The name of the map that contains entity-name |
Proposed Changes
- Currently, the entity-name attribute is optional. Require the entity-name attribute.
- Eliminate the map-name attribute.
<clear-entity-caches>
Removes all entities from the cache.
<clear-entity-caches />
<clone-value>
Copies a field containing a GenericValue
to a new GenericValue
.
Attributes
value-field |
optional |
The name of the field containing the existing |
new-value-field |
optional |
The name of the field that will contain the new |
Proposed Changes
- Deprecate and replace with the
<make-value>
element.
<condition>
Contains an entity find condition.
Child Elements
<condition-expr> |
optional |
<condition-list> |
optional |
<condition-object> |
optional |
<having-condition-list> |
optional |
Proposed Changes
- Currently, the child elements are optional. Require one child element.
<condition-expr>
Declares an entity find condition expression.
Attributes
field-name |
optional |
The entity field name (comparison l-value) |
operator |
optional |
The condition comparison operator |
from-field |
optional |
The name of the environment field (variable) to compare to (comparison r-value) |
value |
optional |
A string constant to compare to (comparison r-value) |
ignore-if-null |
optional |
When set to "true" ignores the expression if the r-value evaluates to |
ignore-if-empty |
optional |
When set to "true" ignores the expression if the r-value is empty |
ignore-case |
optional |
When set to "true" ignores case in string comparisons |
ignore |
optional |
When set to "true" ignores the expression |
Proposed Changes
- Currently, the field-name and operator attributes are optional. Require the field-name and operator attributes.
<condition-list>
Combines entity find conditions into a single expression.
Attributes
combine |
optional |
The operator used to combine the expressions |
Child Elements
<condition-expr> |
optional |
<condition-list> |
optional |
<condition-object> |
optional |
<condition-object>
Declares an environment field (variable) that contains an entity find condition expression object.
Attributes
field |
optional |
The name of the field that contains an entity find condition expression object |
Proposed Changes
- Currently, the field attribute is optional. Require the field attribute.
<create-value>
<entity-and>
<entity-condition>
<entity-count>
<entity-data>
<entity-one>
<field-map>
<filter-list-by-and>
<filter-list-by-date>
<find-by-and>
<find-by-primary-key>
<get-related>
<get-related-one>
<having-condition-list>
<make-next-seq-id>
<make-value>
<order-by>
<order-value-list>
<refresh-value>
<remove-by-and>
<remove-list>
<remove-related>
<remove-value>
<select-field>
<sequenced-id-to-env>
<set-current-user-login>
<set-nonpk-fields>
<set-pk-fields>
<store-list>
<store-value>
<transaction-begin>
<transaction-commit>
<transaction-rollback>
Calculate Operations
Proposed Changes
Deprecate and replace with UEL expression.