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);
}
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;
}
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();
}
}
Aggregations