use of org.opencastproject.scheduler.impl.SchedulerServiceDatabaseException in project opencast by opencast.
the class SchedulerServiceDatabaseImpl method countEvents.
public int countEvents() throws SchedulerServiceDatabaseException {
EntityManager em = emf.createEntityManager();
Query query = em.createNamedQuery("Event.countAll");
try {
Number total = (Number) query.getSingleResult();
return total.intValue();
} catch (Exception e) {
logger.error("Could not find the number of events.", e);
throw new SchedulerServiceDatabaseException(e);
} finally {
em.close();
}
}
use of org.opencastproject.scheduler.impl.SchedulerServiceDatabaseException in project opencast by opencast.
the class SchedulerServiceDatabaseImpl method getTransactionLastModified.
@Override
public Date getTransactionLastModified(String id) throws NotFoundException, SchedulerServiceDatabaseException {
EntityManager em = null;
try {
em = emf.createEntityManager();
Opt<TransactionDto> entity = getTransactionDto(id, em);
if (entity.isNone())
throw new NotFoundException("Transaction with ID " + id + " does not exist");
return entity.get().getLastModifiedDate();
} catch (NotFoundException e) {
throw e;
} catch (Exception e) {
logger.error("Could not retrieve last modified date for transaction with id '{}': {}", id, getStackTrace(e));
throw new SchedulerServiceDatabaseException(e);
} finally {
if (em != null)
em.close();
}
}
use of org.opencastproject.scheduler.impl.SchedulerServiceDatabaseException in project opencast by opencast.
the class SchedulerServiceDatabaseImpl method countUnconfirmedResponses.
public long countUnconfirmedResponses() throws SchedulerServiceDatabaseException {
EntityManager em = null;
try {
em = emf.createEntityManager();
Query q = em.createNamedQuery("ExtendedEvent.countUnconfirmed");
Number countResult = (Number) q.getSingleResult();
return countResult.longValue();
} catch (Exception e) {
throw new SchedulerServiceDatabaseException(e);
} finally {
if (em != null)
em.close();
}
}
use of org.opencastproject.scheduler.impl.SchedulerServiceDatabaseException in project opencast by opencast.
the class SchedulerServiceDatabaseImpl method countDailyConfirmedResponses.
public long countDailyConfirmedResponses() throws SchedulerServiceDatabaseException {
EntityManager em = null;
try {
em = emf.createEntityManager();
Query q = em.createNamedQuery("ExtendedEvent.countConfirmedByDateRange");
setDateForDailyQuery(q);
Number countResult = (Number) q.getSingleResult();
return countResult.longValue();
} catch (Exception e) {
throw new SchedulerServiceDatabaseException(e);
} finally {
if (em != null)
em.close();
}
}
use of org.opencastproject.scheduler.impl.SchedulerServiceDatabaseException in project opencast by opencast.
the class SchedulerServiceDatabaseImpl method countTotalResponses.
public long countTotalResponses() throws SchedulerServiceDatabaseException {
EntityManager em = null;
try {
em = emf.createEntityManager();
Query q = em.createNamedQuery("ExtendedEvent.countRespones");
Number countResult = (Number) q.getSingleResult();
return countResult.longValue();
} catch (Exception e) {
throw new SchedulerServiceDatabaseException(e);
} finally {
if (em != null)
em.close();
}
}
Aggregations