use of eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogDaoBean method getExchangeLogByTypesRefAndGuid.
@Override
public List<ExchangeLog> getExchangeLogByTypesRefAndGuid(String typeRefGuid, List<TypeRefType> types) throws ExchangeDaoException {
try {
TypedQuery<ExchangeLog> namedQuery = em.createNamedQuery(ExchangeConstants.LOG_BY_TYPE_REF_AND_GUID, ExchangeLog.class);
namedQuery.setParameter("typeRefGuid", typeRefGuid);
namedQuery.setParameter("typeRefTypes", types);
return namedQuery.getResultList();
} catch (NoResultException e) {
LOG.error("[ Error when getting entity by type ref ID. ] {}", e.getMessage());
throw new NoEntityFoundException("[ Error when getting entity by type ref ID. ]");
} catch (Exception e) {
LOG.error("[ Error when getting entity by type ref ID. ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when getting entity by type ref ID. ] ");
}
}
use of eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogDaoBean method updateLog.
@Override
public ExchangeLog updateLog(ExchangeLog entity) throws ExchangeDaoException {
try {
em.merge(entity);
em.flush();
return entity;
} catch (Exception e) {
LOG.error("[ Error when updating entity ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when updating entity ]", e);
}
}
use of eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogDaoBean method getExchangeLogStatusHistory.
@Override
public List<ExchangeLogStatus> getExchangeLogStatusHistory(String sql, ExchangeHistoryListQuery searchQuery) throws ExchangeDaoException {
try {
LOG.debug("SQL query for status history " + sql);
TypedQuery<ExchangeLogStatus> query = em.createQuery(sql, ExchangeLogStatus.class);
if (searchQuery.getStatus() != null && !searchQuery.getStatus().isEmpty()) {
query.setParameter("status", searchQuery.getStatus());
}
if (searchQuery.getType() != null && !searchQuery.getType().isEmpty()) {
query.setParameter("type", searchQuery.getType());
}
if (searchQuery.getTypeRefDateFrom() != null) {
Date from = searchQuery.getTypeRefDateFrom();
query.setParameter("from", from);
}
if (searchQuery.getTypeRefDateTo() != null) {
Date to = searchQuery.getTypeRefDateTo();
query.setParameter("to", to);
}
return query.getResultList();
} catch (IllegalArgumentException e) {
LOG.error("[ Error getting exchangelog status list ] " + e.getMessage());
throw new ExchangeDaoException("[ Error when getting search list ] ");
} catch (Exception e) {
LOG.error("[ Error getting exchangelog status list " + e.getMessage());
throw new ExchangeDaoException("[ Error when getting search list ] ");
}
}
use of eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ServiceRegistryDaoBean method updateService.
// updateService
@Override
public Service updateService(Service entity) throws ExchangeDaoException {
try {
em.merge(entity);
em.flush();
return entity;
} catch (IllegalArgumentException e) {
LOG.error("[ Error when updating entity ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when updating entity ]");
} catch (Exception e) {
LOG.error("[ Error when updating entity ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when updating entity ]");
}
}
use of eu.europa.ec.fisheries.uvms.exchange.exception.ExchangeDaoException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ServiceRegistryDaoBean method getServicesByTypes.
@Override
public List<Service> getServicesByTypes(List<PluginType> pluginTypes) throws ExchangeDaoException {
try {
TypedQuery<Service> query = em.createNamedQuery(ExchangeConstants.SERVICE_FIND_BY_TYPES, Service.class);
query.setParameter("types", pluginTypes);
return query.getResultList();
} catch (IllegalArgumentException e) {
LOG.error("[ Error when getting service list by types ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when getting service list by types ] ");
} catch (Exception e) {
LOG.error("[ Error when getting service list by types ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when getting service list by types] ");
}
}
Aggregations