use of org.bedework.calfacade.base.BwOwnedDbentity in project bw-calendar-engine by Bedework.
the class MessageProcessor method getIndexer.
@SuppressWarnings("rawtypes")
private BwIndexer getIndexer(final CalSvcI svci, final Object val) throws CalFacadeException {
boolean publick = false;
String principal = null;
final BwOwnedDbentity ent;
if (val instanceof BwOwnedDbentity) {
ent = (BwOwnedDbentity) val;
} else if (val instanceof EventInfo) {
ent = ((EventInfo) val).getEvent();
} else {
error("Cannot index class: " + val.getClass());
throw new CalFacadeException("org.bedework.index.unexpected.class");
}
if (ent != null) {
if (ent.getPublick() == null) {
debug("This is wrong");
}
publick = ent.getPublick();
principal = ent.getOwnerHref();
}
return getIndexer(svci, publick, principal);
}
use of org.bedework.calfacade.base.BwOwnedDbentity 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