remove old deprecated code in WorkEffortEventReminder services related to issue OFBIZ-6519. Thanks Gil Portenseigne for this cleaning

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1686754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas Malin
2015-06-21 20:09:31 +00:00
parent c5e668dfc4
commit 8e4bfa1eba
2 changed files with 1 additions and 63 deletions
@@ -806,10 +806,6 @@ under the License.
<attribute name="reminder" mode="IN" type="GenericValue"/>
<attribute name="bodyParameters" mode="IN" type="Map"/>
</service>
<service name="migrateWorkEffortEventReminders" engine="java"
location="org.ofbiz.workeffort.workeffort.WorkEffortServices" invoke="migrateWorkEffortEventReminders" auth="true">
<description>Migrate work effort event reminders. Run this service to update work effort reminders.</description>
</service>
<!-- WorkEffort and Survey Services -->
<service name="createWorkEffortSurveyAppl" engine="simple" default-entity-name="WorkEffortSurveyAppl"
@@ -1048,16 +1048,7 @@ public class WorkEffortServices {
Debug.logWarning("Error while emailing event reminder - workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId") + ": " + e, module);
}
} else {
// TODO: Remove this block after the next release 2010-11-29
String screenLocation = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation", delegator);
String fromAddress = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress", delegator);
String subject = UtilProperties.getMessage("WorkEffortUiLabels", "WorkEffortEventReminder", (Locale) parameters.get("locale"));
Map<String, Object> emailCtx = UtilMisc.toMap("sendFrom", fromAddress, "sendTo", toAddress, "subject", subject, "bodyParameters", parameters, "bodyScreenUri", screenLocation);
try {
dispatcher.runAsync("sendMailFromScreen", emailCtx);
} catch (Exception e) {
Debug.logWarning("Error while emailing event reminder - workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId") + ": " + e, module);
}
Debug.logError("No email template (WEFF_EVENT_REMINDER) has been configured, reminder cannot be send.", module);
}
return ServiceUtil.returnSuccess();
}
@@ -1066,55 +1057,6 @@ public class WorkEffortServices {
return ServiceUtil.returnSuccess();
}
@Deprecated
protected static void processEventReminder(DispatchContext ctx, GenericValue reminder, Map<String, Object> parameters) throws GenericEntityException {
LocalDispatcher dispatcher = ctx.getDispatcher();
Delegator delegator = ctx.getDelegator();
GenericValue contactMech = reminder.getRelatedOne("ContactMech", false);
if (contactMech != null && "EMAIL_ADDRESS".equals(contactMech.get("contactMechTypeId"))) {
String screenLocation = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation", delegator);
String fromAddress = EntityUtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress", delegator);
String toAddress = contactMech.getString("infoString");
String subject = UtilProperties.getMessage("WorkEffortUiLabels", "WorkEffortEventReminder", (Locale) parameters.get("locale"));
Map<String, Object> emailCtx = UtilMisc.toMap("sendFrom", fromAddress, "sendTo", toAddress, "subject", subject, "bodyParameters", parameters, "bodyScreenUri", screenLocation);
try {
dispatcher.runAsync("sendMailFromScreen", emailCtx);
} catch (Exception e) {
Debug.logWarning("Error while emailing event reminder - workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId") + ": " + e, module);
}
return;
}
// TODO: Other contact mechanism types
Debug.logWarning("Invalid event reminder contact mech, workEffortId = " + reminder.get("workEffortId") + ", contactMechId = " + reminder.get("contactMechId"), module);
}
/** Migrate work effort event reminders.
* @param ctx the dispatch context
* @param context the context
* @return returns the result of the service execution
*/
public static Map<String, Object> migrateWorkEffortEventReminders(DispatchContext ctx, Map<String, ? extends Object> context) {
Delegator delegator = ctx.getDelegator();
Locale locale = (Locale) context.get("locale");
ModelEntity modelEntity = delegator.getModelEntity("WorkEffortEventReminder");
if (modelEntity != null && modelEntity.getField("recurrenceOffset") != null) {
List<GenericValue> eventReminders = null;
try {
eventReminders = EntityQuery.use(delegator).from("WorkEffortEventReminder").queryList();
for (GenericValue reminder : eventReminders) {
if (UtilValidate.isNotEmpty(reminder.get("recurrenceOffset"))) {
reminder.set("reminderOffset", reminder.get("recurrenceOffset"));
reminder.store();
}
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"WorkEffortEventRemindersMigrationError", UtilMisc.toMap("errorString", e), locale));
}
}
return ServiceUtil.returnSuccess();
}
public static Map<String, Object> removeDuplicateWorkEfforts(DispatchContext ctx, Map<String, ? extends Object> context) {
List<GenericValue> resultList = null;
EntityListIterator eli = (EntityListIterator) context.get("workEffortIterator");