use of com.entwinemedia.fn.Fn in project opencast by opencast.
the class SchedulerServiceDatabaseImpl method getTransactions.
@Override
@SuppressWarnings("unchecked")
public List<String> getTransactions() throws SchedulerServiceDatabaseException {
EntityManager em = null;
try {
em = emf.createEntityManager();
String orgId = securityService.getOrganization().getId();
Query q = em.createNamedQuery("Transaction.findAll").setParameter("org", orgId);
List<TransactionDto> resultList = q.getResultList();
return $(resultList).map(new Fn<TransactionDto, String>() {
@Override
public String apply(TransactionDto trx) {
return trx.getId();
}
}).toList();
} catch (Exception e) {
logger.error("Could not retrieve transactions: {}", getStackTrace(e));
throw new SchedulerServiceDatabaseException(e);
} finally {
if (em != null)
em.close();
}
}
Aggregations