Search in sources :

Example 41 with HibSession

use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.

the class FilterDefsDAO method fetch.

public BwFilterDef fetch(final String name, final BwPrincipal owner) throws CalFacadeException {
    final HibSession sess = getSess();
    sess.createQuery(fetchFilterDefQuery);
    sess.setString("ownerHref", owner.getPrincipalRef());
    sess.setString("name", name);
    sess.cacheableQuery();
    return (BwFilterDef) sess.getUnique();
}
Also used : HibSession(org.bedework.calcorei.HibSession) BwFilterDef(org.bedework.calfacade.BwFilterDef)

Example 42 with HibSession

use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.

the class PrincipalsAndPrefsDAO method getPrincipal.

public BwPrincipal getPrincipal(final String href) throws CalFacadeException {
    final HibSession sess = getSess();
    if (href == null) {
        return null;
    }
    if (sess == null) {
        warn("Null sesssion");
        throw new NullPointerException("No session");
    }
    sess.createQuery(getPrincipalQuery);
    sess.setString("href", href);
    return (BwPrincipal) sess.getUnique();
}
Also used : HibSession(org.bedework.calcorei.HibSession) BwPrincipal(org.bedework.calfacade.BwPrincipal)

Example 43 with HibSession

use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.

the class PrincipalsAndPrefsDAO method getPreferences.

public BwPreferences getPreferences(final String principalHref) throws CalFacadeException {
    final HibSession sess = getSess();
    sess.createQuery(getOwnerPreferencesQuery);
    sess.setString("ownerHref", principalHref);
    sess.cacheableQuery();
    return (BwPreferences) sess.getUnique();
}
Also used : HibSession(org.bedework.calcorei.HibSession) BwPreferences(org.bedework.calfacade.svc.BwPreferences)

Example 44 with HibSession

use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.

the class PrincipalsAndPrefsDAO method removeFromAllPrefs.

public void removeFromAllPrefs(final BwShareableDbentity val) throws CalFacadeException {
    final HibSession sess = getSess();
    final String q;
    if (val instanceof BwCategory) {
        q = getCategoryPrefForAllQuery;
    } else if (val instanceof BwCalendar) {
        q = removeCalendarPrefForAllQuery;
    } else if (val instanceof BwContact) {
        q = removeContactPrefForAllQuery;
    } else if (val instanceof BwLocation) {
        q = removeLocationPrefForAllQuery;
    } else {
        throw new CalFacadeException("Can't handle " + val);
    }
    sess.createQuery(q);
    sess.setInt("id", val.getId());
    sess.executeUpdate();
}
Also used : HibSession(org.bedework.calcorei.HibSession) BwLocation(org.bedework.calfacade.BwLocation) BwCategory(org.bedework.calfacade.BwCategory) BwCalendar(org.bedework.calfacade.BwCalendar) BwContact(org.bedework.calfacade.BwContact) CalFacadeException(org.bedework.calfacade.exc.CalFacadeException)

Example 45 with HibSession

use of org.bedework.calcorei.HibSession in project bw-calendar-engine by Bedework.

the class PrincipalsAndPrefsDAO method getAuthUser.

public BwAuthUser getAuthUser(final String href) throws CalFacadeException {
    final HibSession sess = getSess();
    sess.createQuery(getUserQuery);
    sess.setString("userHref", href);
    return (BwAuthUser) sess.getUnique();
}
Also used : HibSession(org.bedework.calcorei.HibSession) BwAuthUser(org.bedework.calfacade.svc.BwAuthUser)

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