use of eu.europa.ec.fisheries.uvms.spatial.model.schemas.GeometryByPortCodeResponse in project UVMS-ActivityModule-APP by UnionVMS.
the class SpatialModuleServiceBean method getGeometryForPortCode.
@Override
public String getGeometryForPortCode(String portCode) throws ServiceException {
log.info("Inside getGeometryForPortCode :" + portCode);
try {
String request = SpatialModuleRequestMapper.mapToGeometryByPortCodeRequest(portCode);
String correlationId = spatialProducer.sendModuleMessage(request, activityConsumer.getDestination());
TextMessage message = activityConsumer.getMessage(correlationId, TextMessage.class);
if (message != null && !isUserFault(message)) {
GeometryByPortCodeResponse response = SpatialModuleResponseMapper.mapGeometryByPortCodeResponseToString(message, correlationId);
return response.getPortGeometry();
} else {
throw new ServiceException("FAILED TO GET GEOMETRY FROM SPATIAL");
}
} catch (ServiceException | MessageException | SpatialModelMapperException e) {
log.error("Exception in communication with spatial while retrieving GEOMETRY", e);
throw new ServiceException(e.getMessage(), e);
}
}
Aggregations