Search in sources :

Example 1 with FluxFaReportMessageMapper

use of eu.europa.ec.fisheries.ers.service.mapper.FluxFaReportMessageMapper in project UVMS-ActivityModule-APP by UnionVMS.

the class FluxMessageServiceBean method saveFishingActivityReportDocuments.

/**
 * {@inheritDoc}
 */
@Override
@Transactional(Transactional.TxType.REQUIRED)
public void saveFishingActivityReportDocuments(FLUXFAReportMessage faReportMessage, FaReportSourceEnum faReportSourceEnum) throws ServiceException {
    log.info("[INFO] Going to save [ " + faReportMessage.getFAReportDocuments().size() + " ] FaReportDocuments..");
    FluxFaReportMessageEntity messageEntity = new FluxFaReportMessageMapper().mapToFluxFaReportMessage(faReportMessage, faReportSourceEnum, new FluxFaReportMessageEntity());
    final Set<FaReportDocumentEntity> faReportDocuments = messageEntity.getFaReportDocuments();
    for (FaReportDocumentEntity faReportDocument : faReportDocuments) {
        try {
            updateGeometry(faReportDocument);
            enrichFishingActivityWithGuiID(faReportDocument);
        } catch (Exception e) {
            log.error("Could not update Geometry OR enrichActivities for faReportDocument:" + faReportDocument.getId());
        }
    }
    log.debug("fishing activity records to be saved : " + faReportDocuments.size());
    fluxReportMessageDao.saveFluxFaReportMessage(messageEntity);
    log.debug("Save partial FluxFaReportMessage before further processing");
    updateFaReportCorrections(faReportMessage.getFAReportDocuments());
    log.debug("Update FaReport Corrections is complete.");
    updateFishingTripStartAndEndDate(faReportDocuments);
    log.info("FluxFaReportMessage Saved successfully.");
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FluxFaReportMessageMapper(eu.europa.ec.fisheries.ers.service.mapper.FluxFaReportMessageMapper) FluxFaReportMessageEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity) ParseException(com.vividsolutions.jts.io.ParseException) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) Transactional(javax.transaction.Transactional)

Aggregations

ParseException (com.vividsolutions.jts.io.ParseException)1 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)1 FluxFaReportMessageEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity)1 FluxFaReportMessageMapper (eu.europa.ec.fisheries.ers.service.mapper.FluxFaReportMessageMapper)1 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)1 Transactional (javax.transaction.Transactional)1