use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ServiceRegistryModelBean method updatePluginStatus.
@Override
public ServiceResponseType updatePluginStatus(String serviceName, StatusType status, String username) throws ExchangeModelException {
Service service = dao.getServiceByServiceClassName(serviceName);
if (service != null) {
service.setStatus(status.name());
service.setUpdatedBy(username);
service.setUpdated(new Date());
return ServiceMapper.toServiceModel(dao.updateService(service));
}
throw new ExchangeModelException("[ Error when update plugin " + serviceName + " with status " + status.name());
}
use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException in project UVMS-ExchangeModule-APP by UnionVMS.
the class UnsentModelBean method createMessage.
@Override
public String createMessage(UnsentMessageType message, String username) throws ExchangeModelException {
if (message == null) {
throw new InputArgumentException("No message to create");
}
try {
UnsentMessage entity = UnsentMessageMapper.toEntity(message, username);
UnsentMessage persistedEntity = dao.create(entity);
UnsentMessageType model = UnsentMessageMapper.toModel(persistedEntity);
return model.getMessageId();
} catch (ExchangeDaoException ex) {
LOG.error("[ Error when creating unsent message ] {}", ex.getMessage());
throw new ExchangeModelException("Error when creating unsent message ");
}
}
use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException in project UVMS-ExchangeModule-APP by UnionVMS.
the class UnsentModelBean method removeMessage.
@Override
public String removeMessage(String unsentMessageId) throws ExchangeModelException {
if (unsentMessageId == null) {
throw new InputArgumentException("No message to remove");
}
try {
UnsentMessage entity = dao.getByGuid(unsentMessageId);
if (entity != null) {
String guid = entity.getGuid();
dao.remove(entity);
return guid;
} else {
LOG.error("[ Error when removing unsent message ]");
throw new ExchangeModelException("Error when removing unsent message ");
}
} catch (ExchangeDaoException ex) {
LOG.error("[ Error when creating unsent message ] {}", ex.getMessage());
throw new ExchangeModelException("Error when creating unsent message ");
}
}
Aggregations