use of eu.europa.ec.fisheries.schema.exchange.module.v1.ProcessedMovementResponse in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeEventIncomingServiceBean method handleProcessedMovement.
// Async response handler for processed movements
@Override
public void handleProcessedMovement(@Observes @HandleProcessedMovementEvent ExchangeMessageEvent message) {
try {
ProcessedMovementResponse request = JAXBMarshaller.unmarshallTextMessage(message.getJmsMessage(), ProcessedMovementResponse.class);
log.debug("Received processed movement from Rules:{}", request);
String username;
MovementRefType movementRefType = request.getMovementRefType();
SetReportMovementType orgRequest = request.getOrgRequest();
if (PluginType.MANUAL.equals(orgRequest.getPluginType())) {
username = request.getUsername();
} else {
username = orgRequest.getPluginName();
}
ExchangeLogType log = ExchangeLogMapper.getReceivedMovementExchangeLog(orgRequest, movementRefType.getMovementRefGuid(), movementRefType.getType().value(), username);
ExchangeLogType createdLog = exchangeLog.log(log, username);
LogRefType logTypeRef = createdLog.getTypeRef();
if (logTypeRef != null && logTypeRef.getType() == TypeRefType.POLL) {
String pollGuid = logTypeRef.getRefGuid();
pollEvent.fire(new NotificationMessage("guid", pollGuid));
}
} catch (ExchangeLogException | ExchangeModelMarshallException e) {
log.error(e.getMessage());
}
}
Aggregations