use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogServiceBean method setPollStatus.
@Override
public PollStatus setPollStatus(String jmsCorrelationId, String pollId, ExchangeLogStatusTypeType logStatus, String username) throws ExchangeLogException {
try {
// Remove the message from cache, because legancy implementation
logCache.acknowledged(jmsCorrelationId);
PollStatus pollStatus = new PollStatus();
pollStatus.setPollGuid(pollId);
pollStatus.setStatus(logStatus);
ExchangeLogType exchangeLogType = exchangeLogModel.setPollStatus(pollStatus, username);
pollStatus.setExchangeLogGuid(exchangeLogType.getGuid());
sendAuditLogMessageForUpdatePollStatus(pollId, username);
// For long polling
exchangeLogEvent.fire(new NotificationMessage("guid", pollStatus.getExchangeLogGuid()));
return pollStatus;
} catch (ExchangeModelMapperException e) {
throw new ExchangeLogException("Couldn't update status of exchange log");
} catch (ExchangeModelException e) {
throw new ExchangeLogException("Couldn't update status of exchange log");
}
}
use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeServiceBean method registerService.
/**
* {@inheritDoc}
*
* @param data
* @throws ExchangeServiceException
*/
@Override
public ServiceResponseType registerService(ServiceType data, CapabilityListType capabilityList, SettingListType settingList, String username) throws ExchangeServiceException {
LOG.info("Register service invoked in service layer: {} {}", data, username);
try {
ServiceResponseType serviceResponseType = serviceRegistryModel.registerService(data, capabilityList, settingList, username);
sendAuditLogMessageForRegisterService(compressServiceClassName(serviceResponseType.getServiceClassName()), username);
return serviceResponseType;
} catch (ExchangeModelMapperException ex) {
throw new ExchangeServiceException(ex.getMessage());
} catch (ExchangeModelException e) {
throw new ExchangeServiceException(e.getMessage());
}
}
use of eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMapperException in project UVMS-ExchangeModule-APP by UnionVMS.
the class PluginServiceBean method registerService.
private void registerService(RegisterServiceRequest register, String messageId) throws ExchangeModelMarshallException, ExchangeMessageException {
try {
overrideSettingsFromConfig(register);
ServiceResponseType service = exchangeService.registerService(register.getService(), register.getCapabilityList(), register.getSettingList(), register.getService().getName());
// push to config module
try {
String serviceClassName = register.getService().getServiceClassName();
SettingListType settings = register.getSettingList();
for (SettingType setting : settings.getSetting()) {
String description = "Plugin " + serviceClassName + " " + setting.getKey() + " setting";
configService.pushSettingToConfig(SettingTypeMapper.map(setting.getKey(), setting.getValue(), description), false);
}
} catch (ConfigServiceException e) {
LOG.error("Couldn't register plugin settings in config parameter table");
}
// TODO log to exchange log
String response = ExchangePluginResponseMapper.mapToRegisterServiceResponseOK(messageId, service);
producer.sendEventBusMessage(response, register.getService().getServiceResponseMessageName());
setServiceStatusOnRegister(register.getService().getServiceClassName());
} catch (ExchangeServiceException | ExchangeModelMapperException e) {
String response = ExchangePluginResponseMapper.mapToRegisterServiceResponseNOK(messageId, "Exchange service exception when registering plugin [ " + e.getMessage() + " ]");
producer.sendEventBusMessage(response, register.getService().getServiceResponseMessageName());
}
}
Aggregations