Search in sources :

Example 6 with CatchEvolutionProgressDTO

use of eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class DEPCatchEvolutionProgressHandler method prepareCatchEvolutionProgressDTO.

@Override
public CatchEvolutionProgressDTO prepareCatchEvolutionProgressDTO(FishingActivityEntity fishingActivity, Map<String, Double> speciesCumulatedWeight) {
    FaReportDocumentType faReportDocumentType = EnumUtils.getEnum(FaReportDocumentType.class, fishingActivity.getFaReportDocument().getTypeCode());
    if (faReportDocumentType != null && faReportDocumentType != FaReportDocumentType.DECLARATION && faReportDocumentType != FaReportDocumentType.NOTIFICATION) {
        return null;
    }
    CatchEvolutionProgressDTO catchEvolutionProgressDTO = initCatchEvolutionProgressDTO(fishingActivity, faReportDocumentType, speciesCumulatedWeight);
    for (FaCatchEntity faCatch : fishingActivity.getFaCatchs()) {
        FaCatchTypeEnum faCatchType = EnumUtils.getEnum(FaCatchTypeEnum.class, faCatch.getTypeCode());
        if (faCatchType == FaCatchTypeEnum.ONBOARD) {
            handleOnboardCatch(faCatch, catchEvolutionProgressDTO);
            if (faReportDocumentType == FaReportDocumentType.DECLARATION) {
                handleCumulatedCatchNoDeletion(faCatch, catchEvolutionProgressDTO, speciesCumulatedWeight);
            }
        }
    }
    return catchEvolutionProgressDTO;
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) FaCatchTypeEnum(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaCatchTypeEnum) CatchEvolutionProgressDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO) FaReportDocumentType(eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType)

Example 7 with CatchEvolutionProgressDTO

use of eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class DISCatchEvolutionProgressHandler method prepareCatchEvolutionProgressDTO.

@Override
public CatchEvolutionProgressDTO prepareCatchEvolutionProgressDTO(FishingActivityEntity fishingActivity, Map<String, Double> speciesCumulatedWeight) {
    FaReportDocumentType faReportDocumentType = EnumUtils.getEnum(FaReportDocumentType.class, fishingActivity.getFaReportDocument().getTypeCode());
    if (faReportDocumentType != null && faReportDocumentType != FaReportDocumentType.DECLARATION) {
        return null;
    }
    CatchEvolutionProgressDTO catchEvolutionProgressDTO = initCatchEvolutionProgressDTO(fishingActivity, faReportDocumentType, speciesCumulatedWeight);
    for (FaCatchEntity faCatch : fishingActivity.getFaCatchs()) {
        FaCatchTypeEnum faCatchType = EnumUtils.getEnum(FaCatchTypeEnum.class, faCatch.getTypeCode());
        if (faCatchType == FaCatchTypeEnum.DEMINIMIS || faCatchType == FaCatchTypeEnum.DISCARDED || faCatchType == FaCatchTypeEnum.UNLOADED) {
            handleOnboardCatch(faCatch, catchEvolutionProgressDTO);
            handleCumulatedCatchWithDeletion(faCatch, catchEvolutionProgressDTO, speciesCumulatedWeight, Arrays.asList(FaCatchTypeEnum.DEMINIMIS, FaCatchTypeEnum.DISCARDED, FaCatchTypeEnum.UNLOADED));
        }
    }
    return catchEvolutionProgressDTO;
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) FaCatchTypeEnum(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaCatchTypeEnum) CatchEvolutionProgressDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO) FaReportDocumentType(eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType)

Example 8 with CatchEvolutionProgressDTO

use of eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class ENTRYCatchEvolutionProgressHandler method prepareCatchEvolutionProgressDTO.

@Override
public CatchEvolutionProgressDTO prepareCatchEvolutionProgressDTO(FishingActivityEntity fishingActivity, Map<String, Double> speciesCumulatedWeight) {
    FaReportDocumentType faReportDocumentType = EnumUtils.getEnum(FaReportDocumentType.class, fishingActivity.getFaReportDocument().getTypeCode());
    if (faReportDocumentType != null && faReportDocumentType != FaReportDocumentType.DECLARATION && faReportDocumentType != FaReportDocumentType.NOTIFICATION) {
        return null;
    }
    CatchEvolutionProgressDTO catchEvolutionProgressDTO = initCatchEvolutionProgressDTO(fishingActivity, faReportDocumentType, speciesCumulatedWeight);
    boolean cumulativeCatchContainsWeight = new WeightCalculator(speciesCumulatedWeight).containsWeight();
    for (FaCatchEntity faCatch : fishingActivity.getFaCatchs()) {
        FaCatchTypeEnum faCatchType = EnumUtils.getEnum(FaCatchTypeEnum.class, faCatch.getTypeCode());
        if (faCatchType == FaCatchTypeEnum.ONBOARD || faCatchType == FaCatchTypeEnum.KEPT_IN_NET || faCatchType == FaCatchTypeEnum.BY_CATCH) {
            handleOnboardCatch(faCatch, catchEvolutionProgressDTO);
            if (!cumulativeCatchContainsWeight) {
                handleCumulatedCatchNoDeletion(faCatch, catchEvolutionProgressDTO, speciesCumulatedWeight);
            }
        }
    }
    return catchEvolutionProgressDTO;
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) FaCatchTypeEnum(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaCatchTypeEnum) CatchEvolutionProgressDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO) FaReportDocumentType(eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType)

Example 9 with CatchEvolutionProgressDTO

use of eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class LANCatchEvolutionProgressHandler method prepareCatchEvolutionProgressDTO.

@Override
public CatchEvolutionProgressDTO prepareCatchEvolutionProgressDTO(FishingActivityEntity fishingActivity, Map<String, Double> speciesCumulatedWeight) {
    FaReportDocumentType faReportDocumentType = EnumUtils.getEnum(FaReportDocumentType.class, fishingActivity.getFaReportDocument().getTypeCode());
    if (faReportDocumentType != null && faReportDocumentType != FaReportDocumentType.DECLARATION) {
        return null;
    }
    CatchEvolutionProgressDTO catchEvolutionProgressDTO = initCatchEvolutionProgressDTO(fishingActivity, faReportDocumentType, speciesCumulatedWeight);
    for (FaCatchEntity faCatch : fishingActivity.getFaCatchs()) {
        FaCatchTypeEnum faCatchType = EnumUtils.getEnum(FaCatchTypeEnum.class, faCatch.getTypeCode());
        if (faCatchType == FaCatchTypeEnum.UNLOADED) {
            handleOnboardCatch(faCatch, catchEvolutionProgressDTO);
        }
    }
    return catchEvolutionProgressDTO;
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) FaCatchTypeEnum(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaCatchTypeEnum) CatchEvolutionProgressDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO) FaReportDocumentType(eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType)

Example 10 with CatchEvolutionProgressDTO

use of eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO in project UVMS-ActivityModule-APP by UnionVMS.

the class RLCCatchEvolutionProgressHandler method prepareCatchEvolutionProgressDTO.

@Override
public CatchEvolutionProgressDTO prepareCatchEvolutionProgressDTO(FishingActivityEntity fishingActivity, Map<String, Double> speciesCumulatedWeight) {
    FaReportDocumentType faReportDocumentType = EnumUtils.getEnum(FaReportDocumentType.class, fishingActivity.getFaReportDocument().getTypeCode());
    if (faReportDocumentType != null && faReportDocumentType != FaReportDocumentType.DECLARATION && faReportDocumentType != FaReportDocumentType.NOTIFICATION) {
        return null;
    }
    CatchEvolutionProgressDTO catchEvolutionProgressDTO = initCatchEvolutionProgressDTO(fishingActivity, faReportDocumentType, speciesCumulatedWeight);
    for (FaCatchEntity faCatch : fishingActivity.getFaCatchs()) {
        FaCatchTypeEnum faCatchType = EnumUtils.getEnum(FaCatchTypeEnum.class, faCatch.getTypeCode());
        boolean loadedXorUnloaded = (faCatchType == FaCatchTypeEnum.LOADED && !isFaCatchTypePresent(fishingActivity.getFaCatchs(), FaCatchTypeEnum.UNLOADED)) || (faCatchType == FaCatchTypeEnum.UNLOADED && !isFaCatchTypePresent(fishingActivity.getFaCatchs(), FaCatchTypeEnum.LOADED));
        if (loadedXorUnloaded) {
            handleOnboardCatch(faCatch, catchEvolutionProgressDTO);
        }
        if (faReportDocumentType == FaReportDocumentType.DECLARATION) {
            if (faCatchType == FaCatchTypeEnum.UNLOADED) {
                handleCumulatedCatchWithDeletion(faCatch, catchEvolutionProgressDTO, speciesCumulatedWeight, Arrays.asList(FaCatchTypeEnum.UNLOADED));
            } else if (faCatchType == FaCatchTypeEnum.LOADED) {
                handleCumulatedCatchNoDeletion(faCatch, catchEvolutionProgressDTO, speciesCumulatedWeight);
            }
        }
    }
    return catchEvolutionProgressDTO;
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) FaCatchTypeEnum(eu.europa.ec.fisheries.uvms.activity.model.schemas.FaCatchTypeEnum) CatchEvolutionProgressDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO) FaReportDocumentType(eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType)

Aggregations

CatchEvolutionProgressDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO)13 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)10 FaReportDocumentType (eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType)7 FaCatchTypeEnum (eu.europa.ec.fisheries.uvms.activity.model.schemas.FaCatchTypeEnum)7 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)5 Test (org.junit.Test)4 FaReportDocumentEntity (eu.europa.ec.fisheries.ers.fa.entities.FaReportDocumentEntity)3 SpeciesQuantityDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.SpeciesQuantityDTO)2 FishingActivityTypeEnum (eu.europa.ec.fisheries.ers.fa.utils.FishingActivityTypeEnum)1 CatchSummaryListDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchSummaryListDTO)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1