You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Scott Gray <sc...@hotwaxmedia.com> on 2013/06/25 07:27:04 UTC

A couple of minilang improvement suggestions

A set-map operation that replaces this type of thing:
        <set field="partyRelationshipCtx.partyIdFrom" from-field="userLogin.partyId"/>
        <set field="partyRelationshipCtx.partyIdTo" from-field="partyId"/>
        <set field="partyRelationshipCtx.roleTypeIdFrom" value="OWNER"/>
        <set field="partyRelationshipCtx.roleTypeIdTo" value="ACCOUNT"/>
        <set field="partyRelationshipCtx.partyRelationshipTypeId" value="ACCOUNT"/>
        <call-service service-name="createPartyRelationship" in-map-name="partyRelationshipCtx"/>
with this:
        <set-map field="partyRelationshipCtx">
            <set field="partyIdFrom" from-field="userLogin.partyId"/>
            <set field="partyIdTo" from-field="partyId"/>
            <set field="roleTypeIdFrom" value="OWNER"/>
            <set field="roleTypeIdTo" value="ACCOUNT"/>
            <set field="partyRelationshipTypeId" value="ACCOUNT"/>
        </set-map>
        <call-service service-name="createPartyRelationship" in-map-name="partyRelationshipCtx"/>
Not a huge change but removes the annoyance of having to type partyRelationshipCtx repeatedly.

Add support for supplying service "in" parameters without having to define the map first:
        <call-service service-name="createPartyRelationship">
            <parameter field="partyIdFrom" from-field="userLogin.partyId"/>
            <parameter field="partyIdTo" from-field="partyId"/>
            <parameter field="roleTypeIdFrom" value="OWNER"/>
            <parameter field="roleTypeIdTo" value="ACCOUNT"/>
            <parameter field="partyRelationshipTypeId" value="ACCOUNT"/>
        </call-service>
I think this would help to simplify the code somewhat.  You could also replace the existing call-service.in-map attribute with an element and allow a mix of both styles.

Regards
Scott