use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class FilterDefsDAO method fetch.
public BwFilterDef fetch(final String name, final BwPrincipal owner) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(fetchFilterDefQuery);
sess.setString("ownerHref", owner.getPrincipalRef());
sess.setString("name", name);
sess.cacheableQuery();
return (BwFilterDef) sess.getUnique();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method getPrincipal.
public BwPrincipal getPrincipal(final String href) throws CalFacadeException {
final HibSession sess = getSess();
if (href == null) {
return null;
}
if (sess == null) {
warn("Null sesssion");
throw new NullPointerException("No session");
}
sess.createQuery(getPrincipalQuery);
sess.setString("href", href);
return (BwPrincipal) sess.getUnique();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method getPreferences.
public BwPreferences getPreferences(final String principalHref) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getOwnerPreferencesQuery);
sess.setString("ownerHref", principalHref);
sess.cacheableQuery();
return (BwPreferences) sess.getUnique();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method removeFromAllPrefs.
public void removeFromAllPrefs(final BwShareableDbentity val) throws CalFacadeException {
final HibSession sess = getSess();
final String q;
if (val instanceof BwCategory) {
q = getCategoryPrefForAllQuery;
} else if (val instanceof BwCalendar) {
q = removeCalendarPrefForAllQuery;
} else if (val instanceof BwContact) {
q = removeContactPrefForAllQuery;
} else if (val instanceof BwLocation) {
q = removeLocationPrefForAllQuery;
} else {
throw new CalFacadeException("Can't handle " + val);
}
sess.createQuery(q);
sess.setInt("id", val.getId());
sess.executeUpdate();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method getAuthUser.
public BwAuthUser getAuthUser(final String href) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getUserQuery);
sess.setString("userHref", href);
return (BwAuthUser) sess.getUnique();
}
Aggregations