use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method removeMember.
public void removeMember(final BwGroup group, final BwPrincipal val, final boolean admin) throws CalFacadeException {
final HibSession sess = getSess();
if (admin) {
sess.createQuery(findAdminGroupEntryQuery);
} else {
sess.createQuery(findGroupEntryQuery);
}
sess.setEntity("grp", group);
sess.setInt("mbrId", val.getId());
/* This is what I want to do but it inserts 'true' or 'false'
sess.setBool("isgroup", (val instanceof BwGroup));
*/
if (val instanceof BwGroup) {
sess.setString("isgroup", "T");
} else {
sess.setString("isgroup", "F");
}
final Object ent = sess.getUnique();
if (ent == null) {
return;
}
sess.delete(ent);
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method findGroupParents.
/**
* @param group the group
* @param admin true for an admin group
* @return Collection
* @throws CalFacadeException on error
*/
@SuppressWarnings("unchecked")
public Collection<BwGroup> findGroupParents(final BwGroup group, final boolean admin) throws CalFacadeException {
final HibSession sess = getSess();
if (admin) {
sess.createQuery(getAdminGroupParentsQuery);
} else {
sess.createQuery(getGroupParentsQuery);
}
sess.setInt("grpid", group.getId());
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method getChildrenCollections.
public List getChildrenCollections(final String parentPath, final int start, final int count) throws CalFacadeException {
final HibSession sess = getSess();
if (parentPath == null) {
sess.createQuery(getChildCollectionPathsQuery + " is null order by col.path");
} else {
sess.createQuery(getChildCollectionPathsQuery + "=:colPath order by col.path");
sess.setString("colPath", parentPath);
}
sess.setString("tsfilter", BwCalendar.tombstonedFilter);
if (start >= 0) {
sess.setFirstResult(start);
sess.setMaxResults(count);
}
final List res = sess.getList();
if (Util.isEmpty(res)) {
return null;
}
return res;
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method getCollections.
protected List getCollections(final List<String> paths) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getCollectionsQuery);
sess.setParameterList("paths", paths);
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method getCollection.
public BwCalendar getCollection(final String path) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getCalendarByPathQuery);
sess.setString("path", path);
sess.cacheableQuery();
return (BwCalendar) sess.getUnique();
}
Aggregations