Search in sources :

Example 1 with FishingActivityTypeEnum

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

the class CatchEvolutionProgressProcessor method process.

public List<CatchEvolutionProgressDTO> process(List<FishingActivityEntity> fishingActivities) {
    Map<String, Double> speciesCumulatedWeight = new HashMap<>();
    List<CatchEvolutionProgressDTO> catchEvolutionProgressDTOs = new ArrayList<>();
    Collections.sort(fishingActivities, new FishingActivityCalculatedDateComparator());
    int orderId = 1;
    for (FishingActivityEntity fishingActivity : fishingActivities) {
        FishingActivityTypeEnum fishingActivityType = EnumUtils.getEnum(FishingActivityTypeEnum.class, fishingActivity.getTypeCode());
        if (fishingActivityType != null && catchEvolutionProgressRegistry != null && catchEvolutionProgressRegistry.containsHandler(fishingActivityType)) {
            CatchEvolutionProgressHandler catchEvolutionProgressHandler = catchEvolutionProgressRegistry.findHandler(fishingActivityType);
            CatchEvolutionProgressDTO catchEvolutionProgressDTO = catchEvolutionProgressHandler.prepareCatchEvolutionProgressDTO(fishingActivity, speciesCumulatedWeight);
            if (catchEvolutionProgressDTO != null) {
                catchEvolutionProgressDTO.setOrderId(orderId++);
                catchEvolutionProgressDTOs.add(catchEvolutionProgressDTO);
            }
        }
    }
    return catchEvolutionProgressDTOs;
}
Also used : CatchEvolutionProgressDTO(eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FishingActivityEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity) FishingActivityTypeEnum(eu.europa.ec.fisheries.ers.fa.utils.FishingActivityTypeEnum)

Aggregations

FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingActivityTypeEnum (eu.europa.ec.fisheries.ers.fa.utils.FishingActivityTypeEnum)1 CatchEvolutionProgressDTO (eu.europa.ec.fisheries.ers.service.dto.fishingtrip.CatchEvolutionProgressDTO)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1