Search in sources :

Example 6 with BwEventProperty

use of org.bedework.calfacade.BwEventProperty in project bw-calendar-engine by Bedework.

the class AuthUserFieldRule method field.

/* (non-Javadoc)
   * @see org.bedework.dumprestore.restore.rules.EntityFieldRule#field(java.lang.String)
   */
@Override
public void field(final String name) throws Throwable {
    BwEventProperty ep = null;
    BwCalendar cal = null;
    try {
        if (top() instanceof BwEventProperty) {
            ep = (BwEventProperty) pop();
        } else if (top() instanceof BwCalendar) {
            cal = (BwCalendar) pop();
        }
        BwAuthUser au = (BwAuthUser) top();
        if (name.equals("id") || name.equals("seq")) {
            return;
        }
        if (name.equals("userHref")) {
            au.setUserHref(Util.buildPath(false, stringFld()));
        // } else if (name.equals("account")) {   old?
        // au.setUserHref(globals.rintf.getUser(stringFld()).getPrincipalRef());
        // } else if (name.equals("user")) {
        // // done above
        } else if (name.equals("usertype")) {
            int type = intFld();
            au.setUsertype(type);
        /* Prefs stuff next */
        } else if (name.equals("autoAdd")) {
            if (inCategoryPrefs) {
                getCategoryPrefs(au).setAutoAdd(booleanFld());
            } else if (inCollectionsPrefs) {
                getCalendarPrefs(au).setAutoAdd(booleanFld());
            } else if (inContactPrefs) {
                getContactPrefs(au).setAutoAdd(booleanFld());
            } else if (inLocationPrefs) {
                getLocationPrefs(au).setAutoAdd(booleanFld());
            } else {
                error("Not in any prefs for autoAdd");
            }
        } else if (name.equals("category")) {
            au.getPrefs().getCategoryPrefs().add((BwCategory) ep);
        } else if (name.equals("collection")) {
            au.getPrefs().getCalendarPrefs().add(cal);
        } else if (name.equals("contact")) {
            au.getPrefs().getContactPrefs().add((BwContact) ep);
        } else if (name.equals("location")) {
            au.getPrefs().getLocationPrefs().add((BwLocation) ep);
        } else if (name.equals("categoryPrefs")) {
            inCategoryPrefs = false;
        } else if (name.equals("calendarPrefs")) {
            inCollectionsPrefs = false;
        } else if (name.equals("contactPrefs")) {
            inContactPrefs = false;
        } else if (name.equals("locationPrefs")) {
            inLocationPrefs = false;
        } else if (name.equals("prefs")) {
        } else if (name.equals("byteSize")) {
        } else {
            unknownTag(name);
        }
    } catch (Throwable t) {
        handleException(t);
    }
}
Also used : BwAuthUser(org.bedework.calfacade.svc.BwAuthUser) BwCategory(org.bedework.calfacade.BwCategory) BwEventProperty(org.bedework.calfacade.BwEventProperty) BwCalendar(org.bedework.calfacade.BwCalendar) BwContact(org.bedework.calfacade.BwContact)

Aggregations

BwEventProperty (org.bedework.calfacade.BwEventProperty)6 BwCalendar (org.bedework.calfacade.BwCalendar)3 HibSession (org.bedework.calcorei.HibSession)2 BwCategory (org.bedework.calfacade.BwCategory)2 BwContact (org.bedework.calfacade.BwContact)2 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)2 Acl (org.bedework.access.Acl)1 BwEvent (org.bedework.calfacade.BwEvent)1 BwLocation (org.bedework.calfacade.BwLocation)1 BwPrincipal (org.bedework.calfacade.BwPrincipal)1 BwShareableContainedDbentity (org.bedework.calfacade.base.BwShareableContainedDbentity)1 BwShareableDbentity (org.bedework.calfacade.base.BwShareableDbentity)1 ReindexResponse (org.bedework.calfacade.indexing.ReindexResponse)1 BwAuthUser (org.bedework.calfacade.svc.BwAuthUser)1 BwPreferences (org.bedework.calfacade.svc.BwPreferences)1 EventInfo (org.bedework.calfacade.svc.EventInfo)1 BwCalSuiteWrapper (org.bedework.calfacade.svc.wrappers.BwCalSuiteWrapper)1 CalendarWrapper (org.bedework.calfacade.wrappers.CalendarWrapper)1 EsDocInfo (org.bedework.util.elasticsearch.EsDocInfo)1 CreateIndexRequest (org.elasticsearch.action.admin.indices.create.CreateIndexRequest)1