use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.
the class DescriptionPropUpdater method applyUpdate.
@Override
public UpdateResult applyUpdate(final UpdateInfo ui) throws WebdavException {
final BwEvent ev = ui.getEvent();
if (ui.isRemove()) {
ui.getCte().setDeleted(ev.getDescription());
ev.setDescription(null);
return UpdateResult.getOkResult();
}
if (ui.getUpdprop() == null) {
// No change - parameters only upated?
return UpdateResult.getOkResult();
}
final String val = ((TextPropertyType) ui.getUpdprop()).getText();
if (ui.getCte().setChanged(ev.getDescription(), val)) {
ev.setDescription(val);
}
return UpdateResult.getOkResult();
}
use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.
the class SequencePropUpdater method applyUpdate.
@Override
public UpdateResult applyUpdate(final UpdateInfo ui) throws WebdavException {
BwEvent ev = ui.getEvent();
SequencePropType pr = (SequencePropType) ui.getProp();
ChangeTableEntry cte = ui.getCte();
int val = pr.getInteger().intValue();
int evVal = ev.getSequence();
if (ui.isRemove()) {
if (evVal == 0) {
return new UpdateResult("Entity has no " + ui.getPropName() + " property - cannot remove");
}
val = 0;
} else if (ui.isAdd()) {
if (evVal != 0) {
return new UpdateResult("Entity already has " + ui.getPropName() + " property - cannot add");
}
} else if (!ui.isChange()) {
return new UpdateResult("No update specified for " + ui.getPropName());
} else {
if (val != evVal) {
return new UpdateResult("Values don't match for update to " + ui.getPropName());
}
val = ((SequencePropType) ui.getUpdprop()).getInteger().intValue();
}
if (val < 0) {
return new UpdateResult("Value for " + ui.getPropName() + " must be >= 0 ");
}
if (val != evVal) {
cte.setChanged(evVal, val);
ev.setSequence(val);
}
return UpdateResult.getOkResult();
}
use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.
the class StatusPropUpdater method applyUpdate.
@Override
public UpdateResult applyUpdate(final UpdateInfo ui) throws WebdavException {
BwEvent ev = ui.getEvent();
StatusPropType pr = (StatusPropType) ui.getProp();
ChangeTableEntry cte = ui.getCte();
String val = pr.getText();
String evVal = ev.getStatus();
if (ui.isRemove()) {
if (evVal == null) {
return new UpdateResult("Entity has no " + ui.getPropName() + " property - cannot remove");
}
val = null;
} else if (ui.isAdd()) {
if (evVal != null) {
return new UpdateResult("Entity already has " + ui.getPropName() + " property - cannot add");
}
} else if (!ui.isChange()) {
return new UpdateResult("No update specified for " + ui.getPropName());
} else {
if (!val.equals(evVal)) {
return new UpdateResult("Values don't match for update to " + ui.getPropName());
}
val = ((StatusPropType) ui.getUpdprop()).getText();
}
if (!Util.equalsString(val, evVal)) {
cte.setChanged(evVal, val);
ev.setStatus(val);
}
return UpdateResult.getOkResult();
}
use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.
the class SummaryPropUpdater method applyUpdate.
@Override
public UpdateResult applyUpdate(final UpdateInfo ui) throws WebdavException {
BwEvent ev = ui.getEvent();
if (ui.isRemove()) {
return new UpdateResult("cannot remove: " + ui.getPropName());
}
String val = ((TextPropertyType) ui.getUpdprop()).getText();
if (ui.getCte().setChanged(ev.getSummary(), val)) {
ev.setSummary(val);
}
return UpdateResult.getOkResult();
}
use of org.bedework.calfacade.BwEvent in project bw-calendar-engine by Bedework.
the class UrlPropUpdater method applyUpdate.
@Override
public UpdateResult applyUpdate(final UpdateInfo ui) throws WebdavException {
BwEvent ev = ui.getEvent();
UrlPropType pr = (UrlPropType) ui.getProp();
ChangeTableEntry cte = ui.getCte();
String val = pr.getUri();
String evVal = ev.getLink();
if (ui.isRemove()) {
if (evVal == null) {
return new UpdateResult("Entity has no " + ui.getPropName() + " property - cannot remove");
}
val = null;
} else if (ui.isAdd()) {
if (evVal != null) {
return new UpdateResult("Entity already has " + ui.getPropName() + " property - cannot add");
}
} else if (!ui.isChange()) {
return new UpdateResult("No update specified for " + ui.getPropName());
} else {
if (!val.equals(evVal)) {
return new UpdateResult("Values don't match for update to " + ui.getPropName());
}
val = ((UrlPropType) ui.getUpdprop()).getUri();
}
if (!Util.equalsString(val, evVal)) {
cte.setChanged(evVal, val);
ev.setLink(val);
}
return UpdateResult.getOkResult();
}
Aggregations