use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class EntityDAO method getResourceContent.
public void getResourceContent(final BwResource val) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getResourceContentQuery);
sess.setString("path", val.getColPath());
sess.setString("name", val.getName());
sess.cacheableQuery();
final BwResourceContent rc = (BwResourceContent) sess.getUnique();
if (rc == null) {
throw new CalFacadeException(CalFacadeException.missingResourceContent);
}
val.setContent(rc);
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class EntityDAO method getNResources.
@SuppressWarnings("unchecked")
public List<BwResource> getNResources(final String path, final int start, final int count) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getNResourcesQuery);
sess.setString("path", path);
sess.setString("tsenc", BwResource.tombstoned);
sess.setFirstResult(start);
sess.setMaxResults(count);
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class EntityDAO method getEventsByAlarm.
@SuppressWarnings("unchecked")
public Collection<BwEvent> getEventsByAlarm(final BwAlarm alarm) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(eventByAlarmQuery);
sess.setInt("alarmId", alarm.getId());
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method findGroup.
public BwGroup findGroup(final String account, final boolean admin) throws CalFacadeException {
final HibSession sess = getSess();
if (admin) {
sess.createQuery(getAdminGroupQuery);
} else {
sess.createQuery(getGroupQuery);
}
sess.setString("account", account);
return (BwGroup) sess.getUnique();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class PrincipalsAndPrefsDAO method getGroups.
@SuppressWarnings("unchecked")
public Collection<BwGroup> getGroups(final BwPrincipal val, final boolean admin) throws CalFacadeException {
final HibSession sess = getSess();
if (admin) {
sess.createQuery(getAdminGroupsQuery);
} else {
sess.createQuery(getGroupsQuery);
}
sess.setInt("entId", val.getId());
/* This is what I want to do but it inserts 'true' or 'false'
sess.setBool("isgroup", (val instanceof BwGroup));
*/
if (val.getKind() == WhoDefs.whoTypeGroup) {
sess.setString("isgroup", "T");
} else {
sess.setString("isgroup", "F");
}
final Set<BwGroup> gs = new TreeSet<>(sess.getList());
if (admin && (val.getKind() == WhoDefs.whoTypeUser)) {
/* Event owner for group is implicit member of group. */
sess.createQuery(getAdminGroupsByEventOwnerQuery);
sess.setString("ownerHref", val.getPrincipalRef());
gs.addAll(sess.getList());
}
return gs;
}
Aggregations