use of org.oasis_open.docs.ws_calendar.ns.soap.PropertySelectionType in project bw-calendar-engine by Bedework.
the class BwUpdates method updateEventProperties.
/**
* The current selector is for the event properties.
*
* <p>We might have one or more updates - add or remove
*
* <p>We might also have one or more selects which allow for change of values
*
* @param ei
* @param subComponent - non null if this is a sub-component update
* @param sel - matching the "properties" element
* @return true for updated OK
* @throws WebdavException
*/
private UpdateResult updateEventProperties(final EventInfo ei, final Component subComponent, final PropertiesSelectionType sel) throws WebdavException {
for (final PropertySelectionType psel : sel.getProperty()) {
/* psel represents a selection on a property which must exist and for
* which we must have an updater.
*
* We may be applying changes to the property with a change update and/or
* updating the parameters through one or more a selections on the
* parameters.
*/
final BasePropertyType bprop;
final QName pname;
if (psel.getBaseProperty() == null) {
return new UpdateResult("No selection property supplied");
}
bprop = psel.getBaseProperty().getValue();
pname = psel.getBaseProperty().getName();
final PropertyUpdater pu = getUpdater(bprop);
if (pu == null) {
return new UpdateResult("No updater for property: " + pname);
}
PropertyUpdateInfo ui = new PropertyUpdateInfo(bprop, pname, cb, ei, subComponent, state, userHref);
UpdateResult ur = null;
/* There is possibly no change - for example we are changing the tzid for
* the dtstart
*/
if (psel.getChange() != null) {
ur = ui.setChange(psel.getChange());
if (ur != null) {
return ur;
}
}
/* Look for updates to property parameters and add them to the property
* updater info.
*/
if (psel.getParameters() != null) {
ui.setParameterUpdates(psel.getParameters());
}
// There may be no change
ur = pu.applyUpdate(ui);
if (!ur.getOk()) {
return ur;
}
}
/* Next adds
*/
UpdateResult ur = addRemove(ei, subComponent, true, sel.getAdd(), cb);
if (!ur.getOk()) {
return ur;
}
/* Next removes
*/
ur = addRemove(ei, subComponent, false, sel.getRemove(), cb);
if (!ur.getOk()) {
return ur;
}
/* We now need to validate the result to ensure the changes leave a
* consistent entity. Date/time changes in particular can have a number
* of side effects.
*/
ur = validateDates(ei);
if (!ur.getOk()) {
return ur;
}
if (debug) {
ei.getChangeset(userHref).dumpEntries();
}
return UpdateResult.getOkResult();
}
Aggregations