final Integer newValue = command.integerValueSansLocaleOfParameterNamed(typeParamName);
final String defaultUserMessage = "Meeting calendar type update is not supported";
final String oldMeeingType = CalendarType.fromInt(this.typeId).name();
final String newMeetingType = CalendarType.fromInt(newValue).name();
throw new CalendarParameterUpdateNotSupportedException("meeting.type", defaultUserMessage, newMeetingType, oldMeeingType);
/*
* final Integer newValue =
* command.integerValueSansLocaleOfParameterNamed(typeParamName);
* actualChanges.put(typeParamName, newValue); this.typeId =
* newValue;
*/
}
final String repeatingParamName = CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue();
if (command.isChangeInBooleanParameterNamed(repeatingParamName, this.repeating)) {
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(repeatingParamName);
actualChanges.put(repeatingParamName, newValue);
this.repeating = newValue;
}
// if repeating is false then update recurrence to NULL
if (!this.repeating) this.recurrence = null;
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CALENDAR_RESOURCE_NAME);
final CalendarType calendarType = CalendarType.fromInt(this.typeId);
if (calendarType.isCollection() && !this.repeating) {
baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue())
.failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar");
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
}
final String newRecurrence = Calendar.constructRecurrence(command, this);
if (!StringUtils.isBlank(this.recurrence) && !newRecurrence.equalsIgnoreCase(this.recurrence)) {
// FIXME: AA - Is this restriction required only for collection type
// meetings or for all?.
// Do not allow to change meeting frequency
if (!CalendarUtils.isFrequencySame(this.recurrence, newRecurrence)) {
final String defaultUserMessage = "Update of meeting frequency is not supported";
throw new CalendarParameterUpdateNotSupportedException("meeting.frequency", defaultUserMessage);
}
// Do not allow to change meeting interval
if (!CalendarUtils.isIntervalSame(this.recurrence, newRecurrence)) {
final String defaultUserMessage = "Update of meeting interval is not supported";
throw new CalendarParameterUpdateNotSupportedException("meeting.interval", defaultUserMessage);
}
actualChanges.put("recurrence", newRecurrence);
this.recurrence = StringUtils.defaultIfEmpty(newRecurrence, null);
}