svn commit: r673309 - in /ofbiz/trunk/applications/party: data/SheduledJobs.xml ofbiz-component.xml script/org/ofbiz/party/communication/CommunicationEventServices.xml servicedef/secas.xml servicedef/services.xml

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

svn commit: r673309 - in /ofbiz/trunk/applications/party: data/SheduledJobs.xml ofbiz-component.xml script/org/ofbiz/party/communication/CommunicationEventServices.xml servicedef/secas.xml servicedef/services.xml

hansbak-2
Author: hansbak
Date: Wed Jul  2 00:53:29 2008
New Revision: 673309

URL: http://svn.apache.org/viewvc?rev=673309&view=rev
Log:
introduction of a sheduled job which is executed every 5 minutes and which send entered emails. This job also allows to send emails in the future.

Added:
    ofbiz/trunk/applications/party/data/SheduledJobs.xml   (with props)
Modified:
    ofbiz/trunk/applications/party/ofbiz-component.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/servicedef/secas.xml
    ofbiz/trunk/applications/party/servicedef/services.xml

Added: ofbiz/trunk/applications/party/data/SheduledJobs.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/SheduledJobs.xml?rev=673309&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/data/SheduledJobs.xml (added)
+++ ofbiz/trunk/applications/party/data/SheduledJobs.xml Wed Jul  2 00:53:29 2008
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<!-- This is a recurring job with will check for communication events which need to be send as emails. -->
+<entity-engine-xml>
+    <!-- create recurring job to check emails with he status "entered and send these emails.. -->
+    <RecurrenceRule recurrenceRuleId="SENDEMAIL" untilDateTime="" frequency="MINUTELY" intervalNumber="5" countNumber="-1"/>
+    <RecurrenceInfo recurrenceInfoId="SENDEMAIL" startDateTime="2000-01-01 00:00:00.000" recurrenceRuleId="SENDEMAIL" recurrenceCount="0"/>
+    <JobSandbox jobId="SENDEMAIL" jobName="Send Email" runTime="2000-01-01 00:00:00.000" serviceName="sendEmailDated" poolId="pool" runAsUser="system" recurrenceInfoId="SENDEMAIL"/>
+</entity-engine-xml>

Propchange: ofbiz/trunk/applications/party/data/SheduledJobs.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/party/data/SheduledJobs.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/party/data/SheduledJobs.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/party/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/ofbiz-component.xml?rev=673309&r1=673308&r2=673309&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/party/ofbiz-component.xml Wed Jul  2 00:53:29 2008
@@ -29,6 +29,7 @@
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/PartyTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/PartySecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/SheduledJobs.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_view.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>

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=673309&r1=673308&r2=673309&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 Wed Jul  2 00:53:29 2008
@@ -189,4 +189,31 @@
             </then>
         </if>        
     </simple-method>
+
+    <simple-method method-name="sendEmailDated"
+        short-description="Checks for email communication events with the status COM__ENTERED and a startdate which is expired, then send the email">
+        <transaction-begin/>
+        <now-timestamp-to-env env-name="nowDate" />
+        <entity-condition entity-name="CommunicationEvent" list-name="communicationEvents">
+            <condition-list combine="and">
+                <condition-list combine="or">
+                    <condition-expr field-name="communicationEventTypeId" operator="equals" value="EMAIL_COMMUNICATION" />
+                    <condition-expr field-name="communicationEventTypeId" operator="equals" value="AUTO_EMAIL_COMM" />
+                </condition-list>
+                <condition-expr field-name="statusId" operator="equals" value="COM_ENTERED" />
+                <condition-list combine="or">
+                    <condition-expr field-name="datetimeStarted" operator="less" env-name="nowDate" />
+                    <condition-expr field-name="datetimeStarted" operator="equals" env-name="nullField" />
+                </condition-list>
+            </condition-list>
+        </entity-condition>
+        <transaction-commit/>
+        <iterate entry-name="communicationEvent" list-name="communicationEvents">
+            <transaction-begin/>
+            <set-service-fields service-name="sendCommEventAsEmail" map-name="communicationEvent" to-map-name="inMap"/>
+            <call-service service-name="sendCommEventAsEmail" in-map-name="inMap"/>
+            <transaction-commit/>
+        </iterate>
+    </simple-method>    
+    
 </simple-methods>

Modified: ofbiz/trunk/applications/party/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/secas.xml?rev=673309&r1=673308&r2=673309&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/secas.xml Wed Jul  2 00:53:29 2008
@@ -58,47 +58,8 @@
         <condition field-name="workEffortId" operator="is-empty"/>
         <action service="createWorkEffort" mode="sync" />
     </eca>
-    
-    <!-- when an email communictaion event for a contact list is marked "IN PROGRESS", launch a background process to send them out -->
-    <eca service="updateCommunicationEvent" event="commit">
-        <condition field-name="statusId" operator="equals" value="COM_IN_PROGRESS"/>
-        <condition field-name="communicationEventTypeId" operator="equals" value="EMAIL_COMMUNICATION"/>
-        <condition field-name="contactListId" operator="is-not-empty"/>
-        <action service="sendCommEventAsEmail" mode="async"/>
-    </eca>
-    <!-- if there is no contact list, then send it in the same thread and complete it -->
-    <eca service="updateCommunicationEvent" event="commit">
-        <condition field-name="statusId" operator="equals" value="COM_IN_PROGRESS"/>
-        <condition field-name="communicationEventTypeId" operator="equals" value="EMAIL_COMMUNICATION"/>
-        <condition field-name="contactListId" operator="is-empty"/>
-        <action service="sendCommEventAsEmail" mode="sync"/>
-    </eca>
 
-    <!-- same for auto email -->
-    <eca service="createCommunicationEvent" event="commit">
-        <condition field-name="statusId" operator="equals" value="COM_IN_PROGRESS"/>
-        <condition field-name="communicationEventTypeId" operator="equals" value="AUTO_EMAIL_COMM"/>
-        <condition field-name="contactListId" operator="is-empty"/>
-        <action service="sendCommEventAsEmail" mode="sync"/>
-    </eca>
-    <eca service="createCommunicationEvent" event="commit">
-        <condition field-name="statusId" operator="equals" value="COM_IN_PROGRESS"/>
-        <condition field-name="communicationEventTypeId" operator="equals" value="AUTO_EMAIL_COMM"/>
-        <condition field-name="contactListId" operator="is-not-empty"/>
-        <action service="sendCommEventAsEmail" mode="async"/>
-    </eca>
-    <eca service="updateCommunicationEvent" event="commit">
-        <condition field-name="statusId" operator="equals" value="COM_IN_PROGRESS"/>
-        <condition field-name="communicationEventTypeId" operator="equals" value="AUTO_EMAIL_COMM"/>
-        <condition field-name="contactListId" operator="is-empty"/>
-        <action service="sendCommEventAsEmail" mode="sync"/>
-    </eca>    
-    <eca service="updateCommunicationEvent" event="commit">
-        <condition field-name="statusId" operator="equals" value="COM_IN_PROGRESS"/>
-        <condition field-name="communicationEventTypeId" operator="equals" value="AUTO_EMAIL_COMM"/>
-        <condition field-name="contactListId" operator="is-not-empty"/>
-        <action service="sendCommEventAsEmail" mode="async"/>
-    </eca>
+    <!-- all these secas are now replaced by a sheduled job (sendEmailDated) which runs every 5 minutes -->    
 
     <!-- After all the emails have been sent to a contact list, mark it as complete. -->
     <eca service="sendEmailToContactList" event="commit">

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=673309&r1=673308&r2=673309&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Wed Jul  2 00:53:29 2008
@@ -723,11 +723,17 @@
     </service>
 
     <service name="setCommEventComplete" engine="java"
-            location="org.ofbiz.party.communication.CommunicationEventServices" invoke="setCommEventComplete" auth="true">
+        location="org.ofbiz.party.communication.CommunicationEventServices" invoke="setCommEventComplete" auth="true">
         <description>Sets the status of a communication event to COM_COMPLETE using the updateCommunicationEvent service</description>
         <attribute name="communicationEventId" type="String" mode="IN" optional="false"/>
     </service>
-
+    
+    <service name="sendEmailDated" engine="simple" use-transaction="false"
+        location="org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="sendEmailDated" auth="true">
+        <description>Checks for email communication events with the status COM__ENTERED and a startdate which is expired, then send the email</description>
+    </service>
+    
+    
     <!-- party content services -->
     <!-- old services
     <service name="createPartyContent" engine="simple" default-entity-name="Content"