Search in sources :

Example 36 with HibSession

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();
}
Also used : HibSession(org.bedework.calcorei.HibSession)

Example 37 with HibSession

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();
}
Also used : HibSession(org.bedework.calcorei.HibSession)

Example 38 with HibSession

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();
}
Also used : HibSession(org.bedework.calcorei.HibSession)

Example 39 with HibSession

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);
}
Also used : HibSession(org.bedework.calcorei.HibSession)

Example 40 with HibSession

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();
}
Also used : HibSession(org.bedework.calcorei.HibSession)

Aggregations

HibSession (org.bedework.calcorei.HibSession)60 Collection (java.util.Collection)4 BwCalendar (org.bedework.calfacade.BwCalendar)4 CalFacadeException (org.bedework.calfacade.exc.CalFacadeException)4 BwGroup (org.bedework.calfacade.BwGroup)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 TreeSet (java.util.TreeSet)2 BwEvent (org.bedework.calfacade.BwEvent)2 BwEventAnnotation (org.bedework.calfacade.BwEventAnnotation)2 BwEventProperty (org.bedework.calfacade.BwEventProperty)2 BwEventProxy (org.bedework.calfacade.BwEventProxy)2 BwPrincipal (org.bedework.calfacade.BwPrincipal)2 BwCalSuite (org.bedework.calfacade.svc.BwCalSuite)2 BwCategory (org.bedework.calfacade.BwCategory)1 BwContact (org.bedework.calfacade.BwContact)1 BwDateTime (org.bedework.calfacade.BwDateTime)1 BwFilterDef (org.bedework.calfacade.BwFilterDef)1 BwLocation (org.bedework.calfacade.BwLocation)1 BwRecurrenceInstance (org.bedework.calfacade.BwRecurrenceInstance)1