}
return null;
}
protected static void getAlarms(GenericValue workEffort, ComponentList alarms) throws GenericEntityException {
Description description = null;
if (workEffort.get("description") != null) {
description = new Description(workEffort.getString("description"));
} else {
description = new Description(workEffort.getString("workEffortName"));
}
Summary summary = new Summary(UtilProperties.getMessage("WorkEffortUiLabels", "WorkEffortEventReminder", Locale.getDefault()));
Delegator delegator = workEffort.getDelegator();
String workEffortId = workEffort.getString("workEffortId");
List<GenericValue> reminderList = delegator.findList("WorkEffortEventReminder", EntityCondition.makeCondition("workEffortId", EntityOperator.EQUALS, workEffort.get("workEffortId")), null, null, null, false);
for (GenericValue reminder : reminderList) {
String reminderId = workEffortId + "-" + reminder.getString("sequenceId");
VAlarm alarm = null;
PropertyList alarmProps = null;
boolean newAlarm = true;
Iterator<VAlarm> i = UtilGenerics.cast(alarms.iterator());
while (i.hasNext()) {
alarm = i.next();
Property xProperty = alarm.getProperty(reminderXPropName);
if (xProperty != null && reminderId.equals(xProperty.getValue())) {
newAlarm = false;
alarmProps = alarm.getProperties();
// TODO: Write update code. For now, just re-create
alarmProps.clear();
break;
}
}
if (newAlarm) {
alarm = createAlarm(reminder);
alarms.add(alarm);
alarmProps = alarm.getProperties();
alarmProps.add(new XProperty(reminderXPropName, reminderId));
}
GenericValue contactMech = reminder.getRelatedOne("ContactMech");
if (contactMech != null && "EMAIL_ADDRESS".equals(contactMech.get("contactMechTypeId"))) {
try {
alarmProps.add(new Attendee(contactMech.getString("infoString")));
alarmProps.add(Action.EMAIL);
alarmProps.add(summary);
alarmProps.add(description);
} catch (URISyntaxException e) {
alarmProps.add(Action.DISPLAY);
alarmProps.add(new Description("Error encountered while creating iCalendar: " + e));
}
} else {
alarmProps.add(Action.DISPLAY);
alarmProps.add(description);
}