use of eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType 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;
}
use of eu.europa.ec.fisheries.ers.fa.utils.FaReportDocumentType in project UVMS-ActivityModule-APP by UnionVMS.
the class FOPCatchEvolutionProgressHandler 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.ONBOARD || faCatchType == FaCatchTypeEnum.KEPT_IN_NET || faCatchType == FaCatchTypeEnum.BY_CATCH) {
handleOnboardCatch(faCatch, catchEvolutionProgressDTO);
handleCumulatedCatchNoDeletion(faCatch, catchEvolutionProgressDTO, speciesCumulatedWeight);
} else if (faCatchType == FaCatchTypeEnum.TAKEN_ON_BOARD && !isFaCatchTypePresent(fishingActivity.getFaCatchs(), FaCatchTypeEnum.TAKEN_ON_BOARD)) {
handleOnboardCatch(faCatch, catchEvolutionProgressDTO);
handleCumulatedCatchWithDeletion(faCatch, catchEvolutionProgressDTO, speciesCumulatedWeight, Arrays.asList(FaCatchTypeEnum.DEMINIMIS, FaCatchTypeEnum.DISCARDED));
}
}
return catchEvolutionProgressDTO;
}
Aggregations