move an event from e services file to an event file

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@788593 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2009-06-26 05:54:30 +00:00
parent e911bc8f88
commit fb20874a48
3 changed files with 62 additions and 62 deletions
@@ -132,4 +132,65 @@ under the License.
<field-to-request field="my"/>
</simple-method>
<simple-method method-name="allocateMsgToParty" short-description="Allocate an emailaddress to an existing/new party, update the communication event accordingly">
<entity-one entity-name="CommunicationEvent" value-field="communicationEvent"/>
<if-empty field="communicationEvent">
<add-error><fail-message message="Communication Event ID: ${parameters.commnicationEventId} not found"/></add-error>
</if-empty>
<if-empty field="parameters.partyId">
<if-empty field="parameters.emailAddress">
<add-error><fail-message message="Email address is required"/></add-error>
</if-empty>
<if-empty field="parameters.lastName">
<add-error><fail-message message="Please enter a lastName"/></add-error>
</if-empty>
<if-empty field="parameters.firstName">
<add-error><fail-message message="Please enter a firstName"/></add-error>
<check-errors/>
</if-empty>
</if-empty>
<check-errors/>
<!-- create partyId if not provided -->
<if-empty field="parameters.partyId">
<set-service-fields service-name="createPerson" map="parameters" to-map="newParty"/>
<call-service service-name="createPerson" in-map-name="newParty">
<result-to-field result-name="partyId" field="parameters.partyId"/>
</call-service>
</if-empty>
<!-- allocate email to the party -->
<if-not-empty field="parameters.emailAddress">
<entity-one entity-name="Party" value-field="party"/>
<if-empty field="party">
<add-error>
<fail-message message="Party ID: ${parameters.partyId} not found"/>
</add-error>
<check-errors />
</if-empty>
<set field="newEmail.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
<set field="newEmail.partyId" from-field="parameters.partyId"/>
<set field="newEmail.emailAddress" from-field="parameters.emailAddress"/>
<call-service service-name="createPartyEmailAddress"
in-map-name="newEmail">
<result-to-field result-name="contactMechId" field="inCom.contactMechIdFrom"/>
</call-service>
</if-not-empty>
<!-- update the communication event -->
<set field="inCom.communicationEventId" from-field="parameters.communicationEventId"/>
<set field="inCom.partyIdFrom" from-field="parameters.partyId"/>
<set field="inCom.statusId" value="COM_ENTERED"/>
<call-service service-name="updateCommunicationEvent" in-map-name="inCom"/>
<field-to-request field="parameters.communicationEventId" request-name="communicationEventId"/>
<entity-one entity-name="PartyNameView" value-field="nameView"/>
<set field="_event_message_" value="Email addres: ${parameters.emailAddress} allocated to party: ${nameView.groupName}${nameView.firstName} ${nameView.middleName} ${nameView.lastName}[${parameters.partyId}]"/>
</simple-method>
</simple-methods>
@@ -475,67 +475,6 @@ under the License.
</iterate>
</simple-method>
<simple-method method-name="allocateMsgToParty" short-description="Allocate an emailaddress to an existing/new party, update the communication event accordingly">
<entity-one entity-name="CommunicationEvent" value-field="communicationEvent"/>
<if-empty field="communicationEvent">
<add-error><fail-message message="Communication Event ID: ${parameters.commnicationEventId} not found"/></add-error>
</if-empty>
<if-empty field="parameters.partyId">
<if-empty field="parameters.emailAddress">
<add-error><fail-message message="Email address is required"/></add-error>
</if-empty>
<if-empty field="parameters.lastName">
<add-error><fail-message message="Please enter a lastName"/></add-error>
</if-empty>
<if-empty field="parameters.firstName">
<add-error><fail-message message="Please enter a firstName"/></add-error>
<check-errors/>
</if-empty>
</if-empty>
<check-errors/>
<!-- create partyId if not provided -->
<if-empty field="parameters.partyId">
<set-service-fields service-name="createPerson" map="parameters" to-map="newParty"/>
<call-service service-name="createPerson" in-map-name="newParty">
<result-to-field result-name="partyId" field="parameters.partyId"/>
</call-service>
</if-empty>
<!-- allocate email to the party -->
<if-not-empty field="parameters.emailAddress">
<entity-one entity-name="Party" value-field="party"/>
<if-empty field="party">
<add-error>
<fail-message message="Party ID: ${parameters.partyId} not found"/>
</add-error>
<check-errors />
</if-empty>
<set field="newEmail.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
<set field="newEmail.partyId" from-field="parameters.partyId"/>
<set field="newEmail.emailAddress" from-field="parameters.emailAddress"/>
<call-service service-name="createPartyEmailAddress"
in-map-name="newEmail">
<result-to-field result-name="contactMechId" field="inCom.contactMechIdFrom"/>
</call-service>
</if-not-empty>
<!-- update the communication event -->
<set field="inCom.communicationEventId" from-field="parameters.communicationEventId"/>
<set field="inCom.partyIdFrom" from-field="parameters.partyId"/>
<set field="inCom.statusId" value="COM_ENTERED"/>
<call-service service-name="updateCommunicationEvent" in-map-name="inCom"/>
<field-to-request field="parameters.communicationEventId" request-name="communicationEventId"/>
<entity-one entity-name="PartyNameView" value-field="nameView"/>
<set field="_event_message_" value="Email addres: ${parameters.emailAddress} allocated to party: ${nameView.groupName}${nameView.firstName} ${nameView.middleName} ${nameView.lastName}[${parameters.partyId}]"/>
</simple-method>
<simple-method method-name="createCustRequestCommEvent" short-description="Create CustRequestCommEvent" >
<make-value value-field="newEntity" entity-name="CustRequestCommEvent"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
@@ -821,7 +821,7 @@ under the License.
<request-map uri="allocateMsgToParty">
<security https="true" auth="true"/>
<event type="simple" path="component://party/script/org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="allocateMsgToParty"/>
<event type="simple" path="component://party/script/org/ofbiz/party/communication/CommunicationEventEvents.xml" invoke="allocateMsgToParty"/>
<response name="success" type="view-home"/>
<response name="error" type="view" value="ViewCommunicationEvent"/>
</request-map>