use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method getAllAuthUsers.
@SuppressWarnings("unchecked")
public List<BwAuthUser> getAllAuthUsers() throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getAllAuthUsersQuery);
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method getMembers.
@SuppressWarnings("unchecked")
public Collection<BwPrincipal> getMembers(final BwGroup group, final boolean admin) throws CalFacadeException {
final HibSession sess = getSess();
if (admin) {
sess.createQuery(getAdminGroupUserMembersQuery);
} else {
sess.createQuery(getGroupUserMembersQuery);
}
sess.setEntity("gr", group);
final Collection<BwPrincipal> ms = new TreeSet<>();
ms.addAll(sess.getList());
if (admin) {
sess.createQuery(getAdminGroupGroupMembersQuery);
} else {
sess.createQuery(getGroupGroupMembersQuery);
}
sess.setEntity("gr", group);
ms.addAll(sess.getList());
return ms;
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method getPrincipalHrefs.
public List<String> getPrincipalHrefs(final int start, final int count) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getPrincipalHrefsQuery);
sess.setFirstResult(start);
sess.setMaxResults(count);
@SuppressWarnings("unchecked") final List<String> 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 PrincipalsAndPrefsDAO method removeGroup.
/**
* Delete a group
*
* @param group BwGroup group object to delete
* @exception CalFacadeException If there's a problem
*/
public void removeGroup(final BwGroup group, final boolean admin) throws CalFacadeException {
final HibSession sess = getSess();
if (admin) {
sess.createQuery(removeAllAdminGroupMemberRefsQuery);
} else {
sess.createQuery(removeAllGroupMembersQuery);
}
sess.setEntity("gr", group);
sess.executeUpdate();
if (admin) {
sess.createQuery(removeFromAllAdminGroupsQuery);
} else {
sess.createQuery(removeFromAllGroupsQuery);
}
sess.setInt("mbrId", group.getId());
/* This is what I want to do but it inserts 'true' or 'false'
sess.setBool("isgroup", (val instanceof BwGroup));
*/
sess.setString("isgroup", "T");
sess.executeUpdate();
sess.delete(group);
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreEventPropertiesDAO method getAll.
@SuppressWarnings("unchecked")
public List<BwEventProperty> getAll(final String ownerHref) throws CalFacadeException {
if (getAllQuery == null) {
getAllQuery = "from " + className + " ent where " + " ent.ownerHref=:ownerHref" + " order by ent." + keyFieldName;
}
final HibSession sess = getSess();
sess.createQuery(getAllQuery);
if (debug) {
debug("getAll: q=" + getAllQuery + " owner=" + ownerHref);
}
sess.setString("ownerHref", ownerHref);
return sess.getList();
}
Aggregations