use of org.bedework.icalendar.IcalTranslator.SkipThis in project bw-calendar-engine by Bedework.
the class OwnerRule method end.
@Override
public void end(final String ns, final String name) throws Exception {
error("OwnerRule called");
BwPrincipal p = doPrincipal();
if (top() instanceof OwnerUidKey) {
OwnerUidKey key = (OwnerUidKey) top();
key.setOwnerHref(p.getPrincipalRef());
globals.inOwnerKey = false;
return;
}
if (top() instanceof BwAdminGroup) {
BwAdminGroup ag = (BwAdminGroup) top();
if (name.equals("owner")) {
ag.setOwnerHref(p.getPrincipalRef());
} else if (name.equals("owner-key")) {
// PRE3.5
ag.setOwnerHref(p.getPrincipalRef());
} else {
ag.setGroupOwnerHref(p.getPrincipalRef());
}
globals.inOwnerKey = false;
return;
}
BwOwnedDbentity o = null;
if (top() == null) {
error("Null stack top when setting owner. Match: " + getDigester().getMatch());
return;
}
if (top() instanceof EventInfo) {
o = ((EventInfo) top()).getEvent();
} else if (!(top() instanceof BwOwnedDbentity)) {
if (top() instanceof BwOrganizer) {
// No owner now
} else if (top() instanceof BwView) {
// No owner now
} else if (top() instanceof SkipThis) {
} else {
// We expect organizer in old data
warn("top() is not BwOwnedDbentity:" + top().getClass().getCanonicalName());
warn(" match: " + getDigester().getMatch());
}
globals.inOwnerKey = false;
return;
} else {
o = (BwOwnedDbentity) top();
}
o.setOwnerHref(p.getPrincipalRef());
globals.inOwnerKey = false;
}
Aggregations