ilscipio/scipio-erp

View on GitHub
framework/entity/dtd/entity-eca.xsd

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="entity-eca">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" maxOccurs="unbounded" ref="eca"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="eca">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="AllConditionals" minOccurs="0" maxOccurs="unbounded"/><!-- SCIPIO -->
                <xs:choice minOccurs="1" maxOccurs="unbounded">
                    <xs:element ref="set"/>
                    <xs:element ref="action"/>
                </xs:choice>
            </xs:sequence>
            <xs:attributeGroup ref="attlist.eca"/>
        </xs:complexType>
    </xs:element>
    <xs:attributeGroup name="attlist.eca">
        <xs:attribute type="xs:string" name="entity" use="required"/>
        <xs:attribute name="operation" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="create"/>
                    <xs:enumeration value="store"/>
                    <xs:enumeration value="remove"/>
                    <xs:enumeration value="find"/>
                    <xs:enumeration value="create-store"/>
                    <xs:enumeration value="create-remove"/>
                    <xs:enumeration value="store-remove"/>
                    <xs:enumeration value="create-store-remove"/>
                    <xs:enumeration value="any"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="event" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="validate"/>
                    <xs:enumeration value="run"/>
                    <xs:enumeration value="return"/>
                    <xs:enumeration value="cache-check"/>
                    <xs:enumeration value="cache-put"/>
                    <xs:enumeration value="cache-clear"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="run-on-error" type="xs:boolean" default="false"/>
        <xs:attribute name="enabled" type="xs:boolean" default="true"/>
    </xs:attributeGroup>
    <xs:element name="AllConditionals" abstract="true" /><!-- SCIPIO: imported from screen widgets conditions -->
    <xs:element name="and" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" ref="AllConditionals" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="xor" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" ref="AllConditionals" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="or" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" ref="AllConditionals" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="not" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="AllConditionals" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="condition" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:attributeGroup ref="attlist.condition"/>
        </xs:complexType>
    </xs:element>
    <xs:attributeGroup name="attlist.condition">
        <xs:attribute type="xs:string" name="field-name">
            <xs:annotation><xs:documentation>
                Entity field name (static - no expressions).
            </xs:documentation></xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:string" name="context-field">
            <xs:annotation><xs:documentation>
                Context Field name or flexible expression (for nested fields such as userLogin.partyId).

                SCIPIO: 3.0.0: Added.
            </xs:documentation></xs:annotation>
        </xs:attribute>
        <xs:attribute name="operator" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="less"/>
                    <xs:enumeration value="greater"/>
                    <xs:enumeration value="less-equals"/>
                    <xs:enumeration value="greater-equals"/>
                    <xs:enumeration value="equals"/>
                    <xs:enumeration value="not-equals"/>
                    <xs:enumeration value="is-empty"/>
                    <xs:enumeration value="is-not-empty"/>
                    <xs:enumeration value="contains"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="value"/>
        <xs:attribute name="type" default="String">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="PlainString"/>
                    <xs:enumeration value="String"/>
                    <xs:enumeration value="BigDecimal"/>
                    <xs:enumeration value="Double"/>
                    <xs:enumeration value="Float"/>
                    <xs:enumeration value="Long"/>
                    <xs:enumeration value="Integer"/>
                    <xs:enumeration value="Date"/>
                    <xs:enumeration value="Time"/>
                    <xs:enumeration value="Timestamp"/>
                    <xs:enumeration value="Boolean"/>
                    <xs:enumeration value="Object"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="format"/>
    </xs:attributeGroup>
    <xs:element name="condition-field" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:attributeGroup ref="attlist.condition-field"/>
        </xs:complexType>
    </xs:element>
    <xs:attributeGroup name="attlist.condition-field">
        <xs:attribute type="xs:string" name="field-name" use="required"/>
        <xs:attribute name="operator" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="less"/>
                    <xs:enumeration value="greater"/>
                    <xs:enumeration value="less-equals"/>
                    <xs:enumeration value="greater-equals"/>
                    <xs:enumeration value="equals"/>
                    <xs:enumeration value="not-equals"/>
                    <xs:enumeration value="contains"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="to-field-name"/>
        <xs:attribute name="type" default="String">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="PlainString"/>
                    <xs:enumeration value="String"/>
                    <xs:enumeration value="BigDecimal"/>
                    <xs:enumeration value="Double"/>
                    <xs:enumeration value="Float"/>
                    <xs:enumeration value="Long"/>
                    <xs:enumeration value="Integer"/>
                    <xs:enumeration value="Date"/>
                    <xs:enumeration value="Time"/>
                    <xs:enumeration value="Timestamp"/>
                    <xs:enumeration value="Boolean"/>
                    <xs:enumeration value="Object"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="format"/>
    </xs:attributeGroup>
    <xs:attributeGroup name="attlist.condition-property"><!-- SCIPIO -->
        <xs:attribute type="xs:string" name="resource"/>
        <xs:attribute type="xs:string" name="property-name" use="required">
            <xs:annotation><xs:documentation>Property name from *.properties file, or if resource omitted, name of one of the
                properties in the map org.ofbiz.base.GeneralConfig.getCommonPropertiesMap(), such as "instanceId".</xs:documentation></xs:annotation>
        </xs:attribute>
        <xs:attribute name="operator" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="less"/>
                    <xs:enumeration value="greater"/>
                    <xs:enumeration value="less-equals"/>
                    <xs:enumeration value="greater-equals"/>
                    <xs:enumeration value="equals"/>
                    <xs:enumeration value="not-equals"/>
                    <xs:enumeration value="contains"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="value"/>
        <xs:attribute name="type" default="String">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="PlainString"/>
                    <xs:enumeration value="String"/>
                    <xs:enumeration value="BigDecimal"/>
                    <xs:enumeration value="Double"/>
                    <xs:enumeration value="Float"/>
                    <xs:enumeration value="Long"/>
                    <xs:enumeration value="Integer"/>
                    <xs:enumeration value="Date"/>
                    <xs:enumeration value="Time"/>
                    <xs:enumeration value="Timestamp"/>
                    <xs:enumeration value="Boolean"/>
                    <xs:enumeration value="Object"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="format"/>
        <xs:attribute name="scope"><!-- default="run" -->
            <xs:annotation>
                <xs:documentation>
                    The time at which the condition is evaluated (SCIPIO).
                    If set to "init" and the condition evaluates to false, this ECA will not be registered
                    in the system and will not run at runtime.
                </xs:documentation>
            </xs:annotation>
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="run"/>
                    <xs:enumeration value="init"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:attributeGroup>
    <xs:element name="condition-property" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:attributeGroup ref="attlist.condition-property"/>
        </xs:complexType>
    </xs:element>
    <xs:attributeGroup name="attlist.condition-property-field"><!-- SCIPIO -->
        <xs:attribute type="xs:string" name="resource"/>
        <xs:attribute type="xs:string" name="property-name" use="required">
            <xs:annotation><xs:documentation>Property name from *.properties file, or if resource omitted, name of one of the
                properties in the map org.ofbiz.base.GeneralConfig.getCommonPropertiesMap(), such as "instanceId".</xs:documentation></xs:annotation>
        </xs:attribute>
        <xs:attribute name="operator" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="less"/>
                    <xs:enumeration value="greater"/>
                    <xs:enumeration value="less-equals"/>
                    <xs:enumeration value="greater-equals"/>
                    <xs:enumeration value="equals"/>
                    <xs:enumeration value="not-equals"/>
                    <xs:enumeration value="contains"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="to-field-name"/>
        <xs:attribute name="type" default="String">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="PlainString"/>
                    <xs:enumeration value="String"/>
                    <xs:enumeration value="BigDecimal"/>
                    <xs:enumeration value="Double"/>
                    <xs:enumeration value="Float"/>
                    <xs:enumeration value="Long"/>
                    <xs:enumeration value="Integer"/>
                    <xs:enumeration value="Date"/>
                    <xs:enumeration value="Time"/>
                    <xs:enumeration value="Timestamp"/>
                    <xs:enumeration value="Boolean"/>
                    <xs:enumeration value="Object"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute type="xs:string" name="format"/>
    </xs:attributeGroup>
    <xs:element name="condition-property-field" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:attributeGroup ref="attlist.condition-property-field"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="set">
        <xs:complexType>
            <xs:attributeGroup ref="attlist.set"/>
        </xs:complexType>
    </xs:element>
    <xs:attributeGroup name="attlist.set">
        <xs:attribute type="xs:string" name="field-name" use="required"/>
        <xs:attribute type="xs:string" name="env-name"/>
        <xs:attribute type="xs:string" name="value"/>
        <xs:attribute name="format">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="append"/>
                    <xs:enumeration value="to-upper"/>
                    <xs:enumeration value="to-lower"/>
                    <xs:enumeration value="hash-code"/>
                    <xs:enumeration value="long"/>
                    <xs:enumeration value="double"/>
                    <xs:enumeration value="upper-first-char"/>
                    <xs:enumeration value="lower-first-char"/>
                    <xs:enumeration value="db-to-java"/>
                    <xs:enumeration value="java-to-db"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:attributeGroup>
    <xs:element name="condition-service" substitutionGroup="AllConditionals">
        <xs:complexType>
            <xs:attributeGroup ref="attlist.condition-service"/>
        </xs:complexType>
    </xs:element>
    <xs:attributeGroup name="attlist.condition-service">
        <xs:attribute type="xs:string" name="service-name"/>
    </xs:attributeGroup>
    <xs:element name="action">
        <xs:complexType>
            <xs:attributeGroup ref="attlist.action"/>
        </xs:complexType>
    </xs:element>
    <xs:attributeGroup name="attlist.action">
        <xs:attribute type="xs:string" name="service" use="required"/>
        <xs:attribute name="mode" use="required">
            <xs:simpleType>
                <xs:restriction base="xs:token">
                    <xs:enumeration value="sync"/>
                    <xs:enumeration value="async"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="result-to-value" type="xs:boolean" default="true"/>
        <xs:attribute name="abort-on-error" type="xs:boolean" default="false"/>
        <xs:attribute name="rollback-on-error" type="xs:boolean" default="false"/>
        <xs:attribute name="persist" type="xs:boolean" default="false"/>
        <xs:attribute type="xs:string" name="run-as-user" default="system"/>
        <xs:attribute type="xs:string" name="value-attr">
            <xs:annotation>
                <xs:documentation>
                    if value-attr is specified the generic value object corresponding to the entity in question will be passed 
                    to the action service
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="priority" type="xs:nonNegativeInteger">
            <xs:annotation><xs:documentation>The job priority, 0-100 (low-high), defaults to 50 (normal) (org.ofbiz.service.job.JobPriority#NORMAL) (SCIPIO)</xs:documentation></xs:annotation>
        </xs:attribute>
        <xs:attribute name="job-pool" type="xs:string">
            <xs:annotation><xs:documentation>If set and service is persist="false" (default), only runs the eca if the named
                pool is named as run-from-pool="[name]" in serviceengine.xml; if persist="true", creates the job using the named pool. (SCIPIO)</xs:documentation></xs:annotation>
        </xs:attribute>
        <xs:attribute type="xs:boolean" name="reload-value" default="false">
            <xs:annotation>
                <xs:documentation>
                    For "store" operation only: instead of passing the original entity value to be stored, which may
                    be incomplete, it will be reloaded from the data source by its primary key before being passed in
                    the attribute denoted by value-attr. SCIPIO: 2.1.0: Added.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:attributeGroup>
</xs:schema>