diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod index f63a8013b1c7c652570265c3393b39673ea28046..c48e801ff5987462f08ae36bbdbe73f51277247c 100644 --- a/entity/Appointment_entity/Appointment_entity.aod +++ b/entity/Appointment_entity/Appointment_entity.aod @@ -242,6 +242,9 @@ <tooltip>New activity</tooltip> <tooltipProcess>%aditoprj%/entity/Appointment_entity/entityfields/newactivity/tooltipProcess.js</tooltipProcess> </entityActionField> + <entityField> + <name>STATUS_ACTION</name> + </entityField> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -324,6 +327,9 @@ <jDitoRecordFieldMapping> <name>MASTEREND.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>STATUS_ACTION.value</name> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js b/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js index d8b40a8d06cb04e1ebfde21704f5c00f74d85de3..0a3bd6581e53cbdcbec38d9add2282ad21660210 100644 --- a/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js +++ b/entity/Appointment_entity/entityfields/partstatactiongroup/children/accept/onActionProcess.js @@ -19,4 +19,5 @@ else var currentAttendees = vars.get("$field.ATTENDEES"); var updatedAttendees = AppointmentUtils.setPartStat(currentUserUri, currentAttendees, newState); neon.setFieldValue("$field.ATTENDEES", updatedAttendees); + neon.setFieldValue("$field.STATUS_ACTION", calendars.STATUS_ACCEPTED) } diff --git a/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/onActionProcess.js b/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/onActionProcess.js index a6828aaf7a079d04060e1f8c8efe3c5d7a9b6830..20b2e975da0f63dbc6074a81fc2a3958dc6f943b 100644 --- a/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/onActionProcess.js +++ b/entity/Appointment_entity/entityfields/partstatactiongroup/children/decline/onActionProcess.js @@ -19,4 +19,5 @@ else var currentAttendees = vars.get("$field.ATTENDEES"); var updatedAttendees = AppointmentUtils.setPartStat(currentUserUri, currentAttendees, newState); neon.setFieldValue("$field.ATTENDEES", updatedAttendees); + neon.setFieldValue("$field.STATUS_ACTION", calendars.STATUS_DECLINED); } diff --git a/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/onActionProcess.js b/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/onActionProcess.js index 2915c893e54f1a06974956e6cc9ad3fd6fa70d71..a82f2e460d9cb86e7e3e643db7860ac6228918eb 100644 --- a/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/onActionProcess.js +++ b/entity/Appointment_entity/entityfields/partstatactiongroup/children/tentative/onActionProcess.js @@ -19,4 +19,5 @@ else var currentAttendees = vars.get("$field.ATTENDEES"); var updatedAttendees = AppointmentUtils.setPartStat(currentUserUri, currentAttendees, newState); neon.setFieldValue("$field.ATTENDEES", updatedAttendees); + neon.setFieldValue("$field.STATUS_ACTION", calendars.STATUS_TENTATIVE); } \ No newline at end of file diff --git a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js index 700dad726e87f9ce003625986e2b3f9935242260..ee80cd3135dfe593423991de92f65cd9cade5df2 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js @@ -119,6 +119,7 @@ function buildEntry(pEntry, pMasterentry) recurrenceID, null, masterBegin, - masterEnd + masterEnd, + null ]; } diff --git a/entity/Appointment_entity/recordcontainers/jdito/onUpdate.js b/entity/Appointment_entity/recordcontainers/jdito/onUpdate.js index a394b2e212aa76da209257a603f23ccc8f09c46b..d9c947a770aed397a837cdea2483289f3d0ef2de 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/Appointment_entity/recordcontainers/jdito/onUpdate.js @@ -59,6 +59,9 @@ if(event) if(event[calendars.RRULE]) event[calendars.RRULE] = [fields["RRULE.value"]]; + // Adds the required X-Header for status actions needed by Exchange and Domino + addStatusAction(event, fields); + calendars.updateEntry(event); } @@ -90,4 +93,101 @@ function areEventAndFieldsDifferent(event){ } return different; +} + +/** + * Summary. Sets the "X-ADITO-STATUSACTION" - header which is needed for Exchange and Domino to process changes. + * + * Description. Checks if the backendType requires a special X-Header to handle certain updates. Currently + * only Domino (calendars.BACKEND_DOMINO_REST) and Exchange (calendars.BACKEND_EXCHANGEWS) require this header. + * <br/> + * The required status action needs to be stored in the entityField <tt>STATUS_ACTION</tt> + * in order to set the header correctly. + * <br/> + * The X-Header <tt>X-ADITO-STATUSACTION</tt> is an internal placeholder for setting + * the status action for certain calendar backends. The required value depends on the backend used. + * <br/> + * The X-Header is added to the given calender event. + * + * + * @param {JSON} pEvent the calendar event for the update + * @param {Array} pFields the current field values of the entity + * + * @see calendars.getBackendType + * @see _getExchangeStatusAction + * @see _getDominoStatusAction + */ +function addStatusAction (pEvent, pFields) +{ + var statusAction = pFields["STATUS_ACTION.value"]; + var backendType = calendars.getBackendType(); + + if(statusAction != null + && ( backendType == calendars.BACKEND_EXCHANGEWS || backendType == calendars.BACKEND_DOMINO_REST )) + { + statusAction = statusAction.toUpperCase(); + + if(backendType == calendars.BACKEND_EXCHANGEWS) + { + statusAction = _getExchangeStatusAction(statusAction); + } + else if(backendType == calendars.BACKEND_DOMINO_REST) + { + statusAction = _getDominoStatusAction(statusAction); + } + + if(statusAction != null) + pEvent["X-ADITO-STATUSACTION"] = statusAction; + } +} + +/** + * Translates the given action into a status action for ExchangeWS. + * + * @param {String} pStatusAction the general Key for the status action + * @return {String} The specific value for the specified Exchange status action. + */ +function _getExchangeStatusAction(pStatusAction) +{ + switch (pStatusAction) + { + case calendars.STATUS_ACCEPTED: + return "ACCEPT"; + case calendars.STATUS_TENTATIVE: + return "TENTATIVELYACCEPT"; + case calendars.STATUS_DECLINED: + return "DECLINE"; + case calendars.STATUS_CANCELLED: + return "CANCEL_MEETING"; + default: + return null; + } +} + +/** + * Translates the given action into a status action for Domino. + * + * @param {String} pStatusAction the general Key for the status action + * @return {String} The specific value for the specified Domino status action. + */ +function _getDominoStatusAction(pStatusAction) +{ + switch (pStatusAction) + { + case calendars.STATUS_ACCEPTED: + return "accept"; + case calendars.STATUS_TENTATIVE: + return "tentative"; + case calendars.STATUS_DECLINED: + return "decline"; + case calendars.STATUS_CANCELLED: + return "cancel"; +// Not needed. +// Entries are deleted using the system.calendars own delte method +// +// case "DELETED": +// return "delete"; + default: + return null; + } } \ No newline at end of file