Search in sources :

Example 1 with SummaryFishSize

use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SummaryFishSize in project UVMS-ActivityModule-APP by UnionVMS.

the class FACatchSummaryMapper method getSummaryFishSizeList.

protected List<SummaryFishSize> getSummaryFishSizeList(Map<FishSizeClassEnum, Object> summaryFishSizeMap) {
    if (MapUtils.isEmpty(summaryFishSizeMap)) {
        return new ArrayList<>();
    }
    List<SummaryFishSize> summaryFishSizes = new ArrayList<>();
    for (Map.Entry<FishSizeClassEnum, Object> entry : summaryFishSizeMap.entrySet()) {
        SummaryFishSize summaryFishSize = new SummaryFishSize();
        summaryFishSize.setFishSize(entry.getKey());
        Object value = entry.getValue();
        if (value instanceof Map) {
            summaryFishSize.setSpecies(getSpeciesCounts((Map<String, Double>) value));
        } else if (value instanceof Double) {
            summaryFishSize.setFishSizeCount((Double) value);
        }
        summaryFishSizes.add(summaryFishSize);
    }
    log.debug("SummaryFishSize List is created");
    return summaryFishSizes;
}
Also used : FishSizeClassEnum(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishSizeClassEnum) ArrayList(java.util.ArrayList) EnumMap(java.util.EnumMap) HashMap(java.util.HashMap) Map(java.util.Map) SummaryFishSize(eu.europa.ec.fisheries.uvms.activity.model.schemas.SummaryFishSize)

Aggregations

FishSizeClassEnum (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishSizeClassEnum)1 SummaryFishSize (eu.europa.ec.fisheries.uvms.activity.model.schemas.SummaryFishSize)1 ArrayList (java.util.ArrayList)1 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1