use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method getChildCollections.
@SuppressWarnings("unchecked")
protected List getChildCollections(final String parentPath) throws CalFacadeException {
final HibSession sess = getSess();
if (parentPath == null) {
sess.createQuery(getChildCollectionsQuery + " is null order by col.path");
} else {
sess.createQuery(getChildCollectionsQuery + "=:colPath order by col.path");
sess.setString("colPath", parentPath);
}
sess.setString("tsfilter", BwCalendar.tombstonedFilter);
return sess.getList();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method touchCollection.
protected void touchCollection(final BwCalendar col, final Timestamp ts) throws CalFacadeException {
// CALWRAPPER - if we're not cloning can we avoid this?
// val = (BwCalendar)getSess().merge(val);
// val = (BwCalendar)getSess().merge(val);
final BwLastMod lm = col.getLastmod();
lm.updateLastmod(ts);
final HibSession sess = getSess();
sess.createQuery(touchCalendarQuery);
sess.setString("timestamp", lm.getTimestamp());
sess.setInt("sequence", lm.getSequence());
sess.setString("path", col.getPath());
sess.executeUpdate();
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method deleteCalendar.
protected void deleteCalendar(final BwCalendar val) throws CalFacadeException {
final HibSession sess = getSess();
sess.delete(val);
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method getSynchInfo.
protected CollectionSynchInfo getSynchInfo(final String path, final String token) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(getSynchInfoQuery);
sess.setString("path", path);
sess.cacheableQuery();
final Object[] lmfields = (Object[]) sess.getUnique();
if (lmfields == null) {
return null;
}
final CollectionSynchInfo csi = new CollectionSynchInfo();
csi.token = BwLastMod.getTagValue((String) lmfields[0], (Integer) lmfields[1]);
csi.changed = (token == null) || (!csi.token.equals(token));
return csi;
}
use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.
the class CoreCalendarsDAO method collectionExists.
public boolean collectionExists(final String path) throws CalFacadeException {
final HibSession sess = getSess();
sess.createQuery(collectionExistsQuery);
sess.setString("path", path);
final Collection refs = sess.getList();
final Object o = refs.iterator().next();
/* Apparently some get a Long - others get Integer */
if (o instanceof Long) {
final Long ct = (Long) o;
return ct > 0;
}
final Integer ct = (Integer) o;
return ct > 0;
}
Aggregations