[OFBiz] SVN: r7789 - in trunk/applications/content: servicedef src/org/ofbiz/content/email
sichen@svn.ofbiz.org
sichen at svn.ofbiz.org
Tue Jun 13 19:03:50 CDT 2006
Author: sichen
Date: 2006-06-13 19:03:46 -0500 (Tue, 13 Jun 2006)
New Revision: 7789
Modified:
trunk/applications/content/servicedef/services_email.xml
trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
Log:
Enhanced the storeIncomingEmail by returning a communicationEventId for further processing and setting started and end dates to the sent and received date of the email
Modified: trunk/applications/content/servicedef/services_email.xml
===================================================================
--- trunk/applications/content/servicedef/services_email.xml 2006-06-13 18:26:15 UTC (rev 7788)
+++ trunk/applications/content/servicedef/services_email.xml 2006-06-14 00:03:46 UTC (rev 7789)
@@ -119,8 +119,12 @@
</service>
<service name="storeIncomingEmail" engine="java"
location="org.ofbiz.content.email.EmailServices" invoke="storeIncomingEmail" auth="true">
- <description>Process incoming email. Try to determine partyIdFrom from email address.</description>
+ <description>
+ Process incoming email. Try to determine partyIdFrom from email address. datetimeStarted and datetimeEnded are the
+ sent and received dates respectively. partyIdTo is the logged-in user's partyId.
+ </description>
<attribute name="messageWrapper" type="org.ofbiz.service.mail.MimeMessageWrapper" mode="IN"/>
+ <attribute name="communicationEventId" type="String" mode="OUT" optional="false"/>
</service>
<service name="storeForwardedEmail" engine="java"
location="org.ofbiz.content.email.EmailServices" invoke="storeForwardedEmail" auth="true">
Modified: trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
===================================================================
--- trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java 2006-06-13 18:26:15 UTC (rev 7788)
+++ trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java 2006-06-14 00:03:46 UTC (rev 7789)
@@ -638,14 +638,12 @@
commEventMap.put("partyIdTo", partyIdTo);
String subject = message.getSubject();
commEventMap.put("subject", subject);
- String [] dates = message.getHeader("Date");
- String sDate = null;
- Timestamp entryDate = null;
- if (dates != null && dates.length > 0 ) {
- sDate = dates[0];
- }
commEventMap.put("entryDate", nowTimestamp);
+
+ //Set sent and received dates
+ commEventMap.put("datetimeStarted", UtilDateTime.toTimestamp(message.getSentDate()));
+ commEventMap.put("datetimeEnded", UtilDateTime.toTimestamp(message.getReceivedDate()));
int contentIndex = -1;
Multipart multipart = null;
@@ -703,6 +701,10 @@
int attachmentCount = EmailWorker.addAttachmentsToCommEvent(message, communicationEventId, contentIndex, dispatcher, userLogin);
if (Debug.infoOn()) Debug.logInfo(attachmentCount + " attachments added to CommunicationEvent:" + communicationEventId,module);
}
+
+ Map results = ServiceUtil.returnSuccess();
+ results.put("communicationEventId", communicationEventId);
+ return results;
} catch (MessagingException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -716,7 +718,6 @@
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
- return ServiceUtil.returnSuccess();
}
}
More information about the Svn
mailing list