use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method removeCalendarFromAuthPrefs.
protected void removeCalendarFromAuthPrefs(final BwCalendar val) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(removeCalendarPrefForAllQuery);
sess.setInt("id", val.getId());
sess.executeUpdate();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method findCollectionAlias.
public List<BwCalendar> findCollectionAlias(final String aliasPath, final String ownerHref) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(findAliasQuery);
sess.setString("owner", ownerHref);
sess.setString("alias", "bwcal://" + aliasPath);
sess.setInt("caltype", BwCalendar.calTypeAlias);
sess.setString("tsfilter", BwCalendar.tombstonedFilter);
sess.cacheableQuery();
// noinspection unchecked
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method getPathPrefix.
public List getPathPrefix(final String path) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getPathPrefixQuery);
sess.setString("path", path + "%");
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method isEmptyCollection.
public boolean isEmptyCollection(final BwCalendar val) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(countCalendarEventRefsQuery);
sess.setString("colPath", val.getPath());
Long res = (Long) sess.getUnique();
if (debug) {
debug(" ----------- count = " + res);
}
if ((res != null) && (res.intValue() > 0)) {
return false;
}
sess.createQuery(countCalendarChildrenQuery);
sess.setString("colPath", val.getPath());
res = (Long) sess.getUnique();
if (debug) {
debug(" ----------- count children = " + res);
}
return (res == null) || (res.intValue() == 0);
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class FilterDefsDAO method getAllFilterDefs.
@SuppressWarnings("unchecked")
public Collection<BwFilterDef> getAllFilterDefs(final BwPrincipal owner) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getAllFilterDefsQuery);
sess.setString("ownerHref", owner.getPrincipalRef());
sess.cacheableQuery();
return sess.getList();
}
Aggregations