Search in sources :

Example 1 with BwOwnedDbentity

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);
}
Also used : EventInfo(org.bedework.calfacade.svc.EventInfo) BwOwnedDbentity(org.bedework.calfacade.base.BwOwnedDbentity) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 2 with BwOwnedDbentity

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;
}
Also used : BwPrincipal(org.bedework.calfacade.BwPrincipal) EventInfo(org.bedework.calfacade.svc.EventInfo) BwOwnedDbentity(org.bedework.calfacade.base.BwOwnedDbentity) SkipThis(org.bedework.icalendar.IcalTranslator.SkipThis) BwAdminGroup(org.bedework.calfacade.svc.BwAdminGroup) OwnerUidKey(org.bedework.dumprestore.restore.OwnerUidKey) BwOrganizer(org.bedework.calfacade.BwOrganizer) BwView(org.bedework.calfacade.svc.BwView)

Aggregations

BwOwnedDbentity (org.bedework.calfacade.base.BwOwnedDbentity)2 EventInfo (org.bedework.calfacade.svc.EventInfo)2 BwOrganizer (org.bedework.calfacade.BwOrganizer)1 BwPrincipal (org.bedework.calfacade.BwPrincipal)1 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)1 BwAdminGroup (org.bedework.calfacade.svc.BwAdminGroup)1 BwView (org.bedework.calfacade.svc.BwView)1 OwnerUidKey (org.bedework.dumprestore.restore.OwnerUidKey)1 SkipThis (org.bedework.icalendar.IcalTranslator.SkipThis)1