svn commit: r587127 - in /ofbiz/trunk/applications/party: data/ entitydef/ script/org/ofbiz/party/content/ servicedef/ src/org/ofbiz/party/content/ webapp/partymgr/party/profileblocks/ widget/partymgr/

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

svn commit: r587127 - in /ofbiz/trunk/applications/party: data/ entitydef/ script/org/ofbiz/party/content/ servicedef/ src/org/ofbiz/party/content/ webapp/partymgr/party/profileblocks/ widget/partymgr/

jaz-3
Author: jaz
Date: Mon Oct 22 08:17:52 2007
New Revision: 587127

URL: http://svn.apache.org/viewvc?rev=587127&view=rev
Log:
refactored party content to follow the same pattern as the other XxxContent patterns; this includes PK changes to the datamodel, a PartyContentType entity and other minor adjustments

Modified:
    ofbiz/trunk/applications/party/data/PartyTypeData.xml
    ofbiz/trunk/applications/party/entitydef/entitygroup.xml
    ofbiz/trunk/applications/party/entitydef/entitymodel.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/content/PartyContentServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml
    ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
    ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl
    ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml

Modified: ofbiz/trunk/applications/party/data/PartyTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/PartyTypeData.xml?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/data/PartyTypeData.xml (original)
+++ ofbiz/trunk/applications/party/data/PartyTypeData.xml Mon Oct 22 08:17:52 2007
@@ -115,12 +115,12 @@
     <ContactMechTypePurpose contactMechPurposeTypeId="PRIMARY_PHONE" contactMechTypeId="TELECOM_NUMBER"/>
     <ContactMechTypePurpose contactMechPurposeTypeId="PHONE_QUICK" contactMechTypeId="TELECOM_NUMBER"/>
     <ContactMechTypePurpose contactMechPurposeTypeId="PRIMARY_WEB_URL" contactMechTypeId="WEB_ADDRESS"/>
-    
-    <EnumerationType description="Party Content Purpose" enumTypeId="PTYCNT_PRP" hasTable="N" parentTypeId=""/>
-    <Enumeration description="Internal Content" enumCode="INTERNAL" enumId="PCPRP_INTERNAL" sequenceId="01" enumTypeId="PTYCNT_PRP"/>
-    <Enumeration description="User Defined Content" enumCode="USERDEF" enumId="PCPRP_USERDEF" sequenceId="02" enumTypeId="PTYCNT_PRP"/>
-    <Enumeration description="Logo Image URL" enumCode="LGOIMGURL" enumId="PCPRP_LGOIMGURL" sequenceId="03" enumTypeId="PTYCNT_PRP"/>
-    <Enumeration description="Vendor Shipping Info" enumCode="VNDSHPINF" enumId="PCPRP_VNDSHPINF" sequenceId="21" enumTypeId="PTYCNT_PRP"/>
+
+    <!-- party content types -->
+    <PartyContentType description="Internal Content" parentTypeId="" partyContentTypeId="INTERNAL"/>
+    <PartyContentType description="User Defined Content"  parentTypeId="" partyContentTypeId="USERDEF"/>
+    <PartyContentType description="Logo Image URL"  parentTypeId="" partyContentTypeId="LGOIMGURL"/>
+    <PartyContentType description="Vendor Shipping Info"  parentTypeId="" partyContentTypeId="VNDSHPINF"/>
     
     <EnumerationType description="Employment Status" enumTypeId="EMPLOY_STTS" hasTable="N" parentTypeId=""/>
     <Enumeration description="Full-time Employed" enumCode="FULLTIME" enumId="EMPS_FULLTIME" sequenceId="01" enumTypeId="EMPLOY_STTS"/>

Modified: ofbiz/trunk/applications/party/entitydef/entitygroup.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/entitydef/entitygroup.xml?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/entitydef/entitygroup.xml (original)
+++ ofbiz/trunk/applications/party/entitydef/entitygroup.xml Mon Oct 22 08:17:52 2007
@@ -113,6 +113,7 @@
     <entity-group group="org.ofbiz" entity="PartyClassificationType" />
     <entity-group group="org.ofbiz" entity="PartyContactWithPurpose" />
     <entity-group group="org.ofbiz" entity="PartyContent" />
+    <entity-group group="org.ofbiz" entity="PartyContentType" />    
     <entity-group group="org.ofbiz" entity="PartyDataSource" />
     <entity-group group="org.ofbiz" entity="PartyGroup" />
     <entity-group group="org.ofbiz" entity="PartyIcsAvsOverride" />

Modified: ofbiz/trunk/applications/party/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/entitydef/entitymodel.xml?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/party/entitydef/entitymodel.xml Mon Oct 22 08:17:52 2007
@@ -1612,18 +1612,33 @@
             title="Party Data Object Entity">
       <field name="partyId" type="id-ne"></field>
       <field name="contentId" type="id-ne"></field>
-      <field name="contentPurposeEnumId" type="id-ne"></field>
+      <field name="partyContentTypeId" type="id-ne"></field>
+      <field name="fromDate" type="date-time"></field>
+      <field name="thruDate" type="date-time"></field>
       <prim-key field="partyId"/>
       <prim-key field="contentId"/>
+      <prim-key field="partyContentTypeId"/>
+      <prim-key field="fromDate"/>
       <relation type="one" fk-name="PARTY_CNT_PARTY" rel-entity-name="Party">
         <key-map field-name="partyId"/>
       </relation>
       <relation type="one" fk-name="PARTY_CNT_CNT" rel-entity-name="Content">
         <key-map field-name="contentId"/>
       </relation>
-      <relation type="one" fk-name="PARTY_CNT_PENUM" rel-entity-name="Enumeration">
-        <key-map field-name="contentPurposeEnumId" rel-field-name="enumId"/>
+      <relation type="one" fk-name="PARTY_CNT_TYPE" rel-entity-name="PartyContentType">
+        <key-map field-name="partyContentTypeId"/>
       </relation>
+    </entity>
+    <entity entity-name="PartyContentType"
+            package-name="org.ofbiz.party.party"
+            title="Party Content Type Entity">
+        <field name="partyContentTypeId" type="id-ne"></field>
+        <field name="parentTypeId" type="id"></field>
+        <field name="description" type="description"></field>
+        <prim-key field="partyContentTypeId"/>
+        <relation type="one" fk-name="PARTYCNT_TP_PAR" title="Parent" rel-entity-name="PartyContentType">
+            <key-map field-name="parentTypeId" rel-field-name="partyContentTypeId"/>
+        </relation>
     </entity>
     <entity entity-name="PartyDataSource"
             package-name="org.ofbiz.party.party"

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/content/PartyContentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/content/PartyContentServices.xml?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/content/PartyContentServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/content/PartyContentServices.xml Mon Oct 22 08:17:52 2007
@@ -25,10 +25,13 @@
         <make-value value-name="partyContent" entity-name="PartyContent"/>
         <set-pk-fields value-name="partyContent" map-name="parameters"/>
         <set-nonpk-fields value-name="partyContent" map-name="parameters"/>
-        <create-value value-name="partyContent"/>
 
-        <field-to-result field-name="contentId" map-name="partyContent"/>
-        <field-to-result field-name="partyId" map-name="partyContent"/>
+        <if-empty field-name="fromDate" map-name="partyContent">
+            <now-timestamp-to-env env-name="nowTimestamp"/>
+            <set field="partyContent.fromDate" from-field="nowTimestamp"/>
+        </if-empty>
+
+        <create-value value-name="partyContent"/>
     </simple-method>
 
     <simple-method method-name="updatePartyContent" short-description="Update Party Content Entity">
@@ -37,10 +40,7 @@
 
         <find-by-primary-key map-name="lookupPkMap" value-name="partyContent"/>
         <set-nonpk-fields value-name="partyContent" map-name="parameters"/>
-        <store-value value-name="partyContent"/>
-
-        <field-to-result field-name="contentId" map-name="partyContent"/>
-        <field-to-result field-name="partyId" map-name="partyContent"/>
+        <store-value value-name="partyContent"/>      
     </simple-method>
 
     <simple-method method-name="removePartyContent" short-description="Update Party Content Entity">

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Mon Oct 22 08:17:52 2007
@@ -708,15 +708,16 @@
     <service name="createPartyContent" engine="simple" default-entity-name="PartyContent"
             location="org/ofbiz/party/content/PartyContentServices.xml" invoke="createPartyContent" auth="true">
         <description>Create a PartyContent record</description>
-        <auto-attributes mode="INOUT" include="pk" optional="false"/>
-        <auto-attributes mode="IN" include="nonpk" optional="false"/>        
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+        <auto-attributes mode="IN" include="nonpk" optional="true"/>
+        <override name="fromDate" optional="true" />
     </service>
 
     <service name="updatePartyContent" engine="simple" default-entity-name="PartyContent"
             location="org/ofbiz/party/content/PartyContentServices.xml" invoke="updatePartyContent" auth="true">
         <description>Update a PartyContent record</description>
-        <auto-attributes mode="INOUT" include="pk" optional="false"/>
-        <auto-attributes mode="IN" include="nonpk" optional="false"/>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+        <auto-attributes mode="IN" include="nonpk" optional="true"/>
     </service>
 
     <service name="removePartyContent" engine="simple" default-entity-name="PartyContent"

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java Mon Oct 22 08:17:52 2007
@@ -266,7 +266,7 @@
 
         List partyContentList = null;
         try {
-            partyContentList = delegator.findByAndCache("PartyContent", UtilMisc.toMap("partyId", partyId, "contentPurposeEnumId", partyContentTypeId), UtilMisc.toList("-fromDate"));
+            partyContentList = delegator.findByAndCache("PartyContent", UtilMisc.toMap("partyId", partyId, "partyContentTypeId", partyContentTypeId), UtilMisc.toList("-fromDate"));
         } catch (GeneralException e) {
             Debug.logError(e, module);
         }

Modified: ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Content.ftl Mon Oct 22 08:17:52 2007
@@ -29,18 +29,20 @@
             <#assign contentType = content.getRelatedOneCache("ContentType")>
             <#assign mimeType = content.getRelatedOneCache("MimeType")?if_exists>
             <#assign status = content.getRelatedOneCache("StatusItem")>
-            <#assign pcPurpose = pContent.getRelatedOne("Enumeration")>
+            <#assign pcType = pContent.getRelatedOne("PartyContentType")>
             <tr>
-              <td class="button-col"><a href="<@ofbizUrl>EditPartyContents?contentId=${pContent.contentId}&partyId=${pContent.partyId}</@ofbizUrl>">${content.contentId}</a></td>
-              <td>${pcPurpose.description?if_exists}</td>
+              <td class="button-col"><a href="<@ofbizUrl>EditPartyContents?contentId=${pContent.contentId}&partyId=${pContent.partyId}&partyContentTypeId=${pContent.partyContentTypeId}&fromDate=${pContent.fromDate}</@ofbizUrl>">${content.contentId}</a></td>
+              <td>${pcType.description?if_exists}</td>
               <td>${content.contentName?if_exists}</td>
               <td>${(contentType.get("description",locale))?if_exists}</td>
               <td>${(mimeType.description)?if_exists}</td>
               <td>${(status.get("description",locale))?if_exists}</td>
-              <#-- <td>${contentRole.fromDate?if_exists}</td> -->
+              <td>${pContent.fromDate?if_exists}</td>
               <td class="button-col">
-                <a href="<@ofbizUrl>img/${content.contentName}?imgId=${content.dataResourceId}</@ofbizUrl>">${uiLabelMap.CommonView}</a>
-                <a href="<@ofbizUrl>removePartyContent/viewprofile?contentId=${pContent.contentId}&partyId=${pContent.partyId}</@ofbizUrl>">${uiLabelMap.CommonRemove}</a>
+                <#if (content.contentName?has_content)>
+                    <a href="<@ofbizUrl>img/${content.contentName}?imgId=${content.dataResourceId}</@ofbizUrl>">${uiLabelMap.CommonView}</a>
+                </#if>                
+                <a href="<@ofbizUrl>removePartyContent/viewprofile?contentId=${pContent.contentId}&partyId=${pContent.partyId}&partyContentTypeId=${pContent.partyContentTypeId}&fromDate=${pContent.fromDate}</@ofbizUrl>">${uiLabelMap.CommonRemove}</a>
               </td>
             </tr>
           </#list>
@@ -56,10 +58,10 @@
         <input type="hidden" name="statusId" value="CTNT_PUBLISHED"/>
         <input type="hidden" name="partyId" value="${partyId}"/>
         <input type="file" name="uploadedFile" size="20"/>
-        <select name="contentPurposeEnumId">
+        <select name="partyContentTypeId">
           <option value="">${uiLabelMap.PartySelectPurpose}</option>
-          <#list contentPurposes as contentPurpose>
-            <option value="${contentPurpose.enumId}">${contentPurpose.get("description", locale)?default(contentPurpose.enumId)}</option>
+          <#list partyContentTypes as partyContentType>
+            <option value="${partyContentType.partyContentTypeId}">${partyContentType.get("description", locale)?default(partyContentType.partyContentTypeId)}</option>
           </#list>
         </select>
         <select name="roleTypeId">

Modified: ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml?rev=587127&r1=587126&r2=587127&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml Mon Oct 22 08:17:52 2007
@@ -307,10 +307,9 @@
                 <entity-and entity-name="PartyContent" list-name="partyContent">
                     <field-map field-name="partyId" env-name="parameters.partyId"/>
                 </entity-and>
-                <entity-and entity-name="Enumeration" list-name="contentPurposes">
-                    <field-map field-name="enumTypeId" value="PTYCNT_PRP"/>
-                    <order-by field-name="sequenceId"/>
-                </entity-and>
+                <entity-condition entity-name="PartyContentType" list-name="partyContentTypes">
+                    <order-by field-name="description"/>
+                </entity-condition>
                 <entity-condition entity-name="MimeType" list-name="mimeTypes">
                     <order-by field-name="description"/>
                     <order-by field-name="mimeTypeId"/>