Search in sources :

Example 16 with FaReportDocumentEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityEntityToModelMapper method mapFAReportDocuments.

private void mapFAReportDocuments(FLUXFAReportMessage target, List<FaReportDocumentEntity> faReportDocuments) {
    List<FAReportDocument> faReportDocumentList = new ArrayList<>();
    for (FaReportDocumentEntity faReportDocumentEntity : faReportDocuments) {
        FAReportDocument faReportDocument = new FAReportDocument();
        mapFAReportDocument(faReportDocument, faReportDocumentEntity);
        faReportDocumentList.add(faReportDocument);
    }
    target.setFAReportDocuments(faReportDocumentList);
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) ArrayList(java.util.ArrayList) FAReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)

Example 17 with FaReportDocumentEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBean method createMessageCounter.

/**
 * Populates the MessageCounter adding to the right counter 1 unit depending on the type of report (typeCode, purposeCode, size()).
 *
 * @param faReportDocumentList
 */
public MessageCountDTO createMessageCounter(List<FaReportDocumentEntity> faReportDocumentList) {
    MessageCountDTO messagesCounter = new MessageCountDTO();
    if (CollectionUtils.isEmpty(faReportDocumentList)) {
        return messagesCounter;
    }
    // Reports total
    messagesCounter.setNoOfReports(faReportDocumentList.size());
    for (FaReportDocumentEntity faReport : faReportDocumentList) {
        String faDocumentType = faReport.getTypeCode();
        String purposeCode = faReport.getFluxReportDocument().getPurpose();
        // Declarations / Notifications
        if (ActivityConstants.DECLARATION.equalsIgnoreCase(faDocumentType)) {
            messagesCounter.setNoOfDeclarations(messagesCounter.getNoOfDeclarations() + 1);
        } else if (ActivityConstants.NOTIFICATION.equalsIgnoreCase(faDocumentType)) {
            messagesCounter.setNoOfNotifications(messagesCounter.getNoOfNotifications() + 1);
        }
        // Fishing operations
        Set<FishingActivityEntity> faEntitiyList = faReport.getFishingActivities();
        if (isNotEmpty(faEntitiyList)) {
            for (FishingActivityEntity faEntity : faEntitiyList) {
                if (FishingActivityTypeEnum.FISHING_OPERATION.toString().equalsIgnoreCase(faEntity.getTypeCode())) {
                    messagesCounter.setNoOfFishingOperations(messagesCounter.getNoOfFishingOperations() + 1);
                }
            }
        }
        // PurposeCode : Deletions / Cancellations / Corrections
        if (ActivityConstants.DELETE.equalsIgnoreCase(purposeCode)) {
            messagesCounter.setNoOfDeletions(messagesCounter.getNoOfDeletions() + 1);
        } else if (ActivityConstants.CANCELLATION.equalsIgnoreCase(purposeCode)) {
            messagesCounter.setNoOfCancellations(messagesCounter.getNoOfCancellations() + 1);
        } else if (ActivityConstants.CORRECTION.equalsIgnoreCase(purposeCode)) {
            messagesCounter.setNoOfCorrections(messagesCounter.getNoOfCorrections() + 1);
        }
    }
    return messagesCounter;
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) MessageCountDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.MessageCountDTO) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Example 18 with FaReportDocumentEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class FluxMessageServiceBean method updateFishingTripStartAndEndDate.

private void updateFishingTripStartAndEndDate(Set<FaReportDocumentEntity> faReportDocuments) throws ServiceException {
    log.debug("Start  update of FishingTrip Start And End Date");
    if (CollectionUtils.isEmpty(faReportDocuments)) {
        log.error("FaReportDocuments List is EMPTY or NULL in updateFishingTripStartAndEndDate");
        return;
    }
    for (FaReportDocumentEntity faReportDocument : faReportDocuments) {
        calculateFishingTripStartAndEndDate(faReportDocument);
    }
    // Update all the Entities together
    faReportDocumentDao.updateAllFaData(new ArrayList<>(faReportDocuments));
    log.debug("Update of Start And End Date for all fishingTrips is complete");
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)

Example 19 with FaReportDocumentEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class ActivityDataUtil method getFaReportDocumentEntity.

public static FaReportDocumentEntity getFaReportDocumentEntity(String typeCode, String typeCodeListId, Date acceptedDatetime, FluxReportDocumentEntity fluxReportDocumentEntity, VesselTransportMeansEntity vesselTransportMeansEntity, String status) {
    FaReportDocumentEntity faReportDocumentEntity = new FaReportDocumentEntity();
    faReportDocumentEntity.setTypeCode(typeCode);
    faReportDocumentEntity.setTypeCodeListId(typeCodeListId);
    faReportDocumentEntity.setAcceptedDatetime(acceptedDatetime);
    faReportDocumentEntity.setFluxReportDocument(fluxReportDocumentEntity);
    faReportDocumentEntity.setVesselTransportMeans(new HashSet<>(Arrays.asList(vesselTransportMeansEntity)));
    faReportDocumentEntity.setStatus(status);
    return faReportDocumentEntity;
}
Also used : FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)

Example 20 with FaReportDocumentEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity in project UVMS-ActivityModule-APP by UnionVMS.

the class MapperUtil method getFishingActivityEntityList.

public static List<FishingActivityEntity> getFishingActivityEntityList() {
    FishingTripEntity entity = new FishingTripEntity();
    FluxReportDocumentEntity fluxReportDocumentEntity1 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT1", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID1", "flux1");
    FluxReportDocumentEntity fluxReportDocumentEntity2 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT2", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID2", "flux2");
    FluxReportDocumentEntity fluxReportDocumentEntity3 = ActivityDataUtil.getFluxReportDocumentEntity("FLUX_REPORT_DOCUMENT3", null, DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "PURPOSE", "PURPOSE_CODE_LIST", null, "OWNER_FLUX_ID3", "flux3");
    VesselTransportMeansEntity vesselTransportMeansEntity1 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup1", null);
    VesselTransportMeansEntity vesselTransportMeansEntity2 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup2", null);
    VesselTransportMeansEntity vesselTransportMeansEntity3 = ActivityDataUtil.getVesselTransportMeansEntity("PAIR_FISHING_PARTNER", "FA_VESSEL_ROLE", "vesselGroup3", null);
    FaReportDocumentEntity faReportDocumentEntity1 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2016-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity1, vesselTransportMeansEntity1, "new");
    FaReportDocumentEntity faReportDocumentEntity2 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity2, vesselTransportMeansEntity2, "new");
    FaReportDocumentEntity faReportDocumentEntity3 = ActivityDataUtil.getFaReportDocumentEntity("Declaration", "FLUX_FA_REPORT_TYPE", DateUtils.parseToUTCDate("2015-06-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), fluxReportDocumentEntity3, vesselTransportMeansEntity3, "new");
    FishingActivityEntity fishingActivityEntity1 = ActivityDataUtil.getFishingActivityEntity("DEPARTURE", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity1, null);
    FishingActivityEntity fishingActivityEntity2 = ActivityDataUtil.getFishingActivityEntity("ARRIVAL", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity2, null);
    FishingActivityEntity fishingActivityEntity3 = ActivityDataUtil.getFishingActivityEntity("LANDING", "FLUX_FA_TYPE", DateUtils.parseToUTCDate("2014-05-27 07:47:31", "yyyy-MM-dd HH:mm:ss"), "FISHING", "FIS", faReportDocumentEntity3, null);
    List<FishingActivityEntity> fishingActivityEntityList = new ArrayList<>();
    fishingActivityEntityList.add(fishingActivityEntity1);
    fishingActivityEntityList.add(fishingActivityEntity2);
    fishingActivityEntityList.add(fishingActivityEntity3);
    return fishingActivityEntityList;
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) VesselTransportMeansEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity) FaReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity) FluxReportDocumentEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity) ArrayList(java.util.ArrayList) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)

Aggregations

FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)24 ArrayList (java.util.ArrayList)10 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)8 Test (org.junit.Test)7 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)5 FluxReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxReportDocumentEntity)5 FluxFaReportMessageEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxFaReportMessageEntity)4 VesselTransportMeansEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselTransportMeansEntity)4 SneakyThrows (lombok.SneakyThrows)4 FAReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAReportDocument)4 CatchEvolutionProgressDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO)3 Geometry (com.vividsolutions.jts.geom.Geometry)2 ParseException (com.vividsolutions.jts.io.ParseException)2 FaReportIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportIdentifierEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 SizeDistributionEntity (eu.europa.ec.fisheries.ers.fa.entities.SizeDistributionEntity)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 FLUXFAReportMessage (un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage)2 FishingTripIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripIdentifierEntity)1