Search in sources :

Example 11 with BwView

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

the class Users method initPrincipal.

private void initPrincipal(final BwPrincipal principal, final CalSvc svc) throws CalFacadeException {
    // Add preferences
    final BwPreferences prefs = new BwPreferences();
    prefs.setOwnerHref(principal.getPrincipalRef());
    prefs.setDefaultCalendarPath(Util.buildPath(colPathEndsWithSlash, getSvc().getPrincipalInfo().getCalendarHomePath(principal), "/", getBasicSyspars().getUserDefaultCalendar()));
    // Add a default view for the calendar home
    final BwView view = new BwView();
    view.setName(getAuthpars().getDefaultUserViewName());
    // Add default subscription to the user root.
    view.addCollectionPath(svc.getPrincipalInfo().getCalendarHomePath(principal));
    prefs.addView(view);
    prefs.setPreferredView(view.getName());
    prefs.setPreferredViewPeriod("week");
    prefs.setHour24(getAuthpars().getDefaultUserHour24());
    prefs.setScheduleAutoRespond(principal.getKind() == WhoDefs.whoTypeResource);
    svc.getPrefsHandler().update(prefs);
}
Also used : BwPreferences(org.bedework.calfacade.svc.BwPreferences) BwView(org.bedework.calfacade.svc.BwView)

Example 12 with BwView

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

the class Views method removeCollection.

/* (non-Javadoc)
   * @see org.bedework.calsvci.ViewsI#removeCollection(java.lang.String, java.lang.String)
   */
@Override
public boolean removeCollection(final String name, final String path) throws CalFacadeException {
    BwPreferences prefs = getSvc().getPrefsHandler().get(getPrincipal());
    checkOwnerOrSuper(prefs);
    BwView view = find(name);
    if (view == null) {
        return false;
    }
    view.removeCollectionPath(path);
    getSvc().getPrefsHandler().update(prefs);
    return true;
}
Also used : BwPreferences(org.bedework.calfacade.svc.BwPreferences) BwView(org.bedework.calfacade.svc.BwView)

Example 13 with BwView

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

the class ProcessAdd method addToView.

private boolean addToView(final String name) throws Throwable {
    if (debug) {
        debug("About to add to view " + name);
    }
    if (name == null) {
        addError("Must supply name");
        return false;
    }
    try {
        open();
        final BwView view = getSvci().getViewsHandler().find(name);
        if (view == null) {
            addError("View " + name + " not found");
            return false;
        }
        final BwCalendar col = getCal();
        if (col == null) {
            return false;
        }
        return getSvci().getViewsHandler().addCollection(name, col.getPath());
    } finally {
        close();
    }
}
Also used : BwCalendar(org.bedework.calfacade.BwCalendar) BwView(org.bedework.calfacade.svc.BwView)

Aggregations

BwView (org.bedework.calfacade.svc.BwView)13 BwPreferences (org.bedework.calfacade.svc.BwPreferences)7 BwCalendar (org.bedework.calfacade.BwCalendar)2 BwPrincipal (org.bedework.calfacade.BwPrincipal)2 ArrayList (java.util.ArrayList)1 FilterBase (org.bedework.caldav.util.filter.FilterBase)1 BwOrganizer (org.bedework.calfacade.BwOrganizer)1 BwOwnedDbentity (org.bedework.calfacade.base.BwOwnedDbentity)1 BasicSystemProperties (org.bedework.calfacade.configs.BasicSystemProperties)1 BwAdminGroup (org.bedework.calfacade.svc.BwAdminGroup)1 EventInfo (org.bedework.calfacade.svc.EventInfo)1 OwnerUidKey (org.bedework.dumprestore.restore.OwnerUidKey)1 SkipThis (org.bedework.icalendar.IcalTranslator.SkipThis)1 ToString (org.bedework.util.misc.ToString)1