EECAs

Entity Event Condition Actions (EECAs) are actions that are triggered by events on the database level. You can be quite specific as to what the event actually is (like before during or after an update has been performed on a particular row of a table) and how the action is going to be:

Annotation

java
@Eeca(
    entity = "MyEntity",
    operation = "create-store",
    event = "return",
    condition = "!empty(myParameter)",
    actions = {
        @EecaAction(service = "checkUpdateQuoteStatus", mode = "sync")
    }
)
public interface MyEntityReturnEeca {}

XML

text
<?xml version="1.0" encoding="UTF-8"?>
<entity-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entity-eca.xsd">
    <!-- Inventory Issue ECAs for Immediately Fulfilled Orders -->
    <eca entity="MyEntity" operation="create-store" event="return">
        <condition field-name="myParameter" operator="is-not-empty"/>
        <action service="checkUpdateQuoteStatus" mode="sync"/>
    </eca>
</entity-eca>

EECA Options#

TagAttributeDescription
ecaentityTable name
operationOperation performed by the database.

Available options:

  • create
  • store
  • remove
  • find
  • create-store
  • create-remove
  • store-remove
  • create-store-remove
  • any
eventTime of event.

Available options:

  • validate
  • run
  • return
  • cache-check
  • cache-put
  • cache-clear
run-on-errorContinue with event, even if the operation that is triggering the event results in error.

Available Options:

  • true
  • false
conditionfield-nameTable field to be validated
operatorAvailable options:
  • less
  • greater
  • less-equals
  • greater-equals
  • equals
  • not-equals
  • is-empty
  • is-not-empty
  • contains
valueField value
typeObject type (default:String)
Available Options:
  • PlainString
  • String
  • BigDecimal
  • Double
  • Float
  • Long
  • Integer
  • Date
  • Time
  • Timestamp
  • Boolean
  • Object
formatFormat value before validation.

Available options:

  • append
  • to-upper
  • to-lower
  • hash-code
  • long
  • double
  • upper-
    first-char
  • lower-first-char
  • db-to-java
  • java-to-db
setfield-nameTable field name
env-nameDefine variable name for this operation
formatFormat value before storing as part of the variable.Available options:
  • append
  • to-upper
  • to-lower
  • hash-code
  • long
  • double
  • upper-
    first-char
  • lower-first-char
  • db-to-java
  • java-to-db
valuevariable value
actionserviceRun service of name
modeDefinition of when to call the service – synchronous or asynchronous

Available options:

  • sync
  • async
abort-on-errorAbort the operation if an error occurs (affects entire transaction)

Available options:

  • true
  • false
persistRestart action if attempt failed on first try.

Available options:

  • true
  • false
rollback-on-errorRollback (revert) operation if an error occurs.

Available options:

  • true
  • false
run-as-userUser used to perform the operation
result-to-valueReturn operation result as value
value-attrif value-attr is specified the generic value object corresponding to the entity in question will be passed to the
action service

Ask the people who wrote it.

Support, development and training from the team that builds Scipio ERP.