Context doesn't change between multiple execution of the same service method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Context doesn't change between multiple execution of the same service method

Trenton Perceval
This post was updated on .
Hi.
I have a very strange problem.
There are two methods and one SECA for one of them.
Here is the code:

Methods declarations:
    <service name="createProject" engine="simple" default-entity-name="WorkEffort"
        location="component://zp/script/org/ofbiz/project/ProjectServices.xml" invoke="createProject">
        <description>Copy a project planning from a template.</description>
        <required-permissions join-type="AND">
            <check-permission permission="PROJECTMGR" action="_CREATE"/>
        </required-permissions>
        <implements service="interfaceWorkEffort"/>
        <auto-attributes mode="INOUT" include="pk" optional="true"/>
        <attribute name="projectId" type="String" mode="INOUT" optional="true"/>
        <attribute name="fromDate" type="Timestamp" mode="OUT" optional="true"/>
        <attribute name="workEffortId" type="String" mode="INOUT" optional="true"/>
        <attribute name="templateId" type="String" mode="IN" optional="true"/>
        <attribute name="quickAssignPartyId" type="String" mode="IN" optional="true"/>
        <attribute name="requirementId" type="String" mode="IN" optional="true"/>
        <attribute name="communicationEventId" type="String" mode="IN" optional="true"/>
        <attribute name="organizationPartyId" type="String" mode="IN" optional="true"/>
        <attribute name="clientBillingPartyId" type="String" mode="IN" optional="true"/>
        <attribute name="emailAddress" type="String" mode="IN" optional="true"/>
        <attribute name="createdByUserLogin" type="String" mode="IN" optional="true"/>
       
        <attribute name="projectReminderOffset" mode="IN" type="Long" optional="true"/>
        <attribute name="milestoneReminderOffset" mode="IN" type="Long" optional="true"/>
        <attribute name="taskReminderOffset" mode="IN" type="Long" optional="true"/>
       
        <override name="workEffortTypeId" optional="false"/>
        <override name="workEffortName" optional="false"/>
        <override name="currentStatusId" optional="false"/>
    </service>
       
    <service name="registerEvent" engine="java" invoke="registerEvent"
        auth="true" location="com.reezvt.ud.zp.EventRegisterCommunication">
        <attribute name="objectName" mode="IN" type="String" optional="true" />
        <attribute name="objectType" mode="IN" type="String" />
        <attribute name="contextObjectName" mode="IN" type="String"
            optional="true" />
        <attribute name="contextObjectType" mode="IN" type="String"
            optional="true" />
        <attribute name="subSystem" mode="IN" type="String" />
        <attribute name="operationCode" mode="IN" type="String" />
        <attribute name="description" mode="IN" type="String" />
        <attribute name="success" mode="IN" type="String" />
    </service>

SECA:
        <eca service="createProject" event="return">
                <action mode="sync" service="addProjectMetaData" run-as-user="system" />
                <set field-name="objectName" env-name='${bsh: return workEffortName;}' />
                <set field-name="objectType" value="WorkEffort" />
                <set field-name="subSystem" value="ZP" />
                <set field-name="operationCode" value="SomeCode" />
                <set field-name="description" env-name='${bsh: return("Project created: " + workEffortName)}' />
                <set field-name="success" value="true" />
                <action mode="sync" service="registerEvent" />
        </eca>

Desired action is to register event with information about new project created just after createProject is executed.
Such event has information about the project name.
The problem is that when I create for example three projects with names "ProjectA", "ProjectB", "ProjectC", there appears three events with description "Project created: ProjectA". Yes, ProjectA three times.
I made a breakpoint inside registerEvent method and I observed, that the context object always has the same values, but different id.
Could you, please, explain me what I did wrong? Where to find an error? Why context values are not being changed since the last "createProject" service execution?