You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2008/07/22 02:52:17 UTC

svn commit: r678605 - in /ofbiz/trunk/applications: content/src/org/ofbiz/content/email/ party/data/ party/entitydef/ party/script/org/ofbiz/party/communication/ party/servicedef/

Author: hansbak
Date: Mon Jul 21 17:52:16 2008
New Revision: 678605

URL: http://svn.apache.org/viewvc?rev=678605&view=rev
Log:
first version of issue OFBIZ-1886: add statusId field to communicationrole,  more testing and additions will follow

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
    ofbiz/trunk/applications/party/data/PartyTypeData.xml
    ofbiz/trunk/applications/party/entitydef/entitymodel.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java?rev=678605&r1=678604&r2=678605&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java Mon Jul 21 17:52:16 2008
@@ -995,7 +995,10 @@
     				if (partyRole == null) {
     					dispatcher.runSync("createPartyRole", UtilMisc.<String, Object>toMap("partyId", partyId, "roleTypeId", roleTypeId, "userLogin", userLogin));
     				}
-    				Map input = UtilMisc.toMap("communicationEventId", communicationEventId, "partyId", partyId, "roleTypeId", roleTypeId, "userLogin", userLogin, "contactMechId", (String) result.get("contactMechId"));
+    				Map input = UtilMisc.toMap("communicationEventId", communicationEventId, 
+    						"partyId", partyId, "roleTypeId", roleTypeId, "userLogin", userLogin, 
+    						"contactMechId", (String) result.get("contactMechId"),
+    						"statusId", "COM_ROLE_CREATED");
     				dispatcher.runSync("createCommunicationEventRole", input);
     			}
     		}

Modified: ofbiz/trunk/applications/party/data/PartyTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/PartyTypeData.xml?rev=678605&r1=678604&r2=678605&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/data/PartyTypeData.xml (original)
+++ ofbiz/trunk/applications/party/data/PartyTypeData.xml Mon Jul 21 17:52:16 2008
@@ -326,6 +326,14 @@
     <StatusValidChange condition="" statusId="COM_RESOLVED" statusIdTo="COM_CANCELLED" transitionName="Cancel"/>
     <StatusValidChange condition="" statusId="COM_REFERRED" statusIdTo="COM_CANCELLED" transitionName="Cancel"/>
     <StatusValidChange condition="" statusId="COM_UNKNOWN_PARTY" statusIdTo="COM_CANCELLED" transitionName="Cancel"/>
+
+    <StatusType description="Communication Event Role" hasTable="N" parentTypeId="COM_EVENT_STATUS" statusTypeId="COM_EVENT_ROLE_STATUS"/>
+    <StatusItem description="Created" sequenceId="01" statusCode="ENTERED" statusId="COM_ROLE_CREATED" statusTypeId="COM_EVENT_ROLE_STATUS"/>
+    <StatusItem description="Read" sequenceId="02" statusCode="PENDING" statusId="COM_ROLE_READ" statusTypeId="COM_EVENT_ROLE_STATUS"/>
+    <StatusItem description="Completed" sequenceId="03" statusCode="READ" statusId="COM_ROLE_COMPLETED" statusTypeId="COM_EVENT_ROLE_STATUS"/>
+    <StatusValidChange condition="" statusId="COM_ROLE_CREATED" statusIdTo="COM_ROLE_READ" transitionName="Read"/>
+    <StatusValidChange condition="" statusId="COM_ROLE_CREATED" statusIdTo="COM_ROLE_COMPLETED" transitionName="Completed"/>
+    <StatusValidChange condition="" statusId="COM_ROLE_READ" statusIdTo="COM_ROLE_COMPLETED" transitionName="Completed"/>
     
     <StatusType description="Party Relationship" hasTable="N" parentTypeId="" statusTypeId="PARTY_REL_STATUS"/>
 

Modified: ofbiz/trunk/applications/party/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/entitydef/entitymodel.xml?rev=678605&r1=678604&r2=678605&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/party/entitydef/entitymodel.xml Mon Jul 21 17:52:16 2008
@@ -703,8 +703,9 @@
     <view-entity entity-name="CommunicationEventAndRole" package-name="org.ofbiz.party.communication" title="Communication Event And Role View Entity">
       <member-entity entity-alias="CR" entity-name="CommunicationEventRole"/>
       <member-entity entity-alias="CE" entity-name="CommunicationEvent"/>
-      <alias-all entity-alias="CR"/>
       <alias-all entity-alias="CE"/>
+      <alias entity-alias="CR" name="statusId" field="statusId" col-alias="roleStatusId" />
+      <alias entity-alias="CR" name="contactMechId"/>
       <view-link entity-alias="CR" rel-entity-alias="CE">
         <key-map field-name="communicationEventId"/>
       </view-link>
@@ -807,6 +808,7 @@
       <field name="partyId" type="id-ne"></field>
       <field name="roleTypeId" type="id-ne"></field>
       <field name="contactMechId" type="id"><description>For additional communication event participants this represents the contactMechId of the ContactMech used.</description></field>
+      <field name="statusId" type="id"></field>
       <prim-key field="communicationEventId"/>
       <prim-key field="partyId"/>
       <prim-key field="roleTypeId"/>
@@ -826,6 +828,9 @@
       <relation type="one" fk-name="COM_EVRL_CMCH" rel-entity-name="ContactMech">
         <key-map field-name="contactMechId"/>
       </relation>
+      <relation type="one" fk-name="COM_EVRL_STTS" rel-entity-name="StatusItem">
+        <key-map field-name="statusId"/>
+      </relation>
     </entity>
     <entity entity-name="CommunicationEventType"
             package-name="org.ofbiz.party.communication"

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=678605&r1=678604&r2=678605&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml Mon Jul 21 17:52:16 2008
@@ -90,8 +90,8 @@
         </if-compare-field>
         <store-value value-name="event"/>
     </simple-method>
+
     <simple-method method-name="deleteCommunicationEvent" short-description="Delete a CommunicationEvent">
-        
         <entity-one entity-name="CommunicationEvent" value-name="event"/>
         <!-- remove related links to content -->
         <get-related value-name="event" relation-name="CommEventContentAssoc" list-name="contentAssocs"/>
@@ -160,16 +160,29 @@
         <create-value value-name="newEntity"/>    
     </simple-method>
     <simple-method method-name="removeCommunicationEventPurpose" short-description="Remove a CommunicationEventPurpose">
-        
         <entity-one entity-name="CommunicationEventPurpose" value-name="eventPurpose"/>        
         <remove-value value-name="eventPurpose"/>
     </simple-method>
-    <simple-method method-name="createCommunicationEventRole" short-description="Create a CommunicationEventRole">
-        
-        <make-value value-name="newEntity" entity-name="CommunicationEventRole"/>
-        <set-pk-fields map-name="parameters" value-name="newEntity"/>
-        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>        
-        <create-value value-name="newEntity"/>    
+    <simple-method method-name="createCommunicationEventRole"
+        short-description="Create a CommunicationEventRole">
+        <!-- check if role already exist, then ignore -->
+        <entity-one entity-name="CommunicationEventRole" value-name="communicationEventRole" />
+        <if-empty field="communicationEventRole">
+            <make-value value-name="newEntity" entity-name="CommunicationEventRole" />
+            <set-pk-fields map-name="parameters" value-name="newEntity" />
+            <set-nonpk-fields map-name="parameters" value-name="newEntity" />
+            <if-empty field="newEntity.statusId">
+                <set field="newEntity.statusId" value="COM_ROLE_CREATED" />
+            </if-empty>
+            <create-value value-name="newEntity" />
+        </if-empty>
+    </simple-method>
+    <simple-method method-name="updateCommunicationEventRole" short-description="Create a CommunicationEventRole">
+        <entity-one value-name="eventRole" entity-name="CommunicationEventRole" />
+        <if-not-empty field="eventRole">
+            <set-nonpk-fields map-name="parameters" value-name="eventRole" />
+            <store-value value-name="eventRole" />
+        </if-not-empty>
     </simple-method>
     <simple-method method-name="removeCommunicationEventRole" short-description="Remove a CommunicationEventRole">
                 

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=678605&r1=678604&r2=678605&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Mon Jul 21 17:52:16 2008
@@ -696,6 +696,13 @@
         <auto-attributes entity-name="CommunicationEventRole" include="pk" mode="IN" optional="false"/>
         <auto-attributes entity-name="CommunicationEventRole" include="nonpk" mode="IN" optional="true"/>
     </service>
+    <service name="updateCommunicationEventRole" engine="simple"
+            location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="updateCommunicationEventRole" auth="true">
+        <description>Update a Communication Event Role</description>
+        <permission-service service-name="partyCommunicationEventPermissionCheck" main-action="UPDATE"/>
+        <auto-attributes entity-name="CommunicationEventRole" include="pk" mode="IN" optional="false"/>
+        <auto-attributes entity-name="CommunicationEventRole" include="nonpk" mode="IN" optional="true"/>
+    </service>
     <service name="removeCommunicationEventRole" engine="simple"
             location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="removeCommunicationEventRole" auth="true">
         <description>Remove a Communication Event Role</description>