Search in sources :

Example 1 with FluxCharacteristicEntity

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

the class FaCatchMapperTest method testFaCatchMapper.

@Test
public void testFaCatchMapper() {
    FACatch faCatch = MapperUtil.getFaCatch();
    FaCatchEntity faCatchEntity = FaCatchMapper.INSTANCE.mapToFaCatchEntity(faCatch);
    assertFaCatchFields(faCatch, faCatchEntity);
    assertNull(faCatchEntity.getFishingActivity());
    assertNotNull(faCatchEntity.getAapProcesses());
    AapProcessEntity aapProcessEntity = faCatchEntity.getAapProcesses().iterator().next();
    assertNotNull(aapProcessEntity);
    assertFaCatchFields(faCatch, aapProcessEntity.getFaCatch());
    assertNotNull(faCatchEntity.getAapStocks());
    AapStockEntity aapStockEntity = faCatchEntity.getAapStocks().iterator().next();
    assertNotNull(aapStockEntity);
    assertFaCatchFields(faCatch, aapStockEntity.getFaCatch());
    assertNotNull(faCatchEntity.getSizeDistribution());
    assertFaCatchFields(faCatch, faCatchEntity.getSizeDistribution().getFaCatch());
    assertNotNull(faCatchEntity.getFishingGears());
    FishingGearEntity fishingGearEntity = faCatchEntity.getFishingGears().iterator().next();
    assertNotNull(fishingGearEntity);
    assertFaCatchFields(faCatch, fishingGearEntity.getFaCatch());
    assertNotNull(faCatchEntity.getFishingTrips());
    FishingTripEntity fishingTripEntity = faCatchEntity.getFishingTrips().iterator().next();
    assertNotNull(fishingTripEntity);
    assertFaCatchFields(faCatch, fishingTripEntity.getFaCatch());
    assertNotNull(faCatchEntity.getFluxCharacteristics());
    FluxCharacteristicEntity fluxCharacteristicEntity = faCatchEntity.getFluxCharacteristics().iterator().next();
    assertNotNull(fluxCharacteristicEntity);
    assertFaCatchFields(faCatch, fluxCharacteristicEntity.getFaCatch());
    assertNotNull(faCatchEntity.getFluxLocations());
    FluxLocationEntity fluxLocationEntity = faCatchEntity.getFluxLocations().iterator().next();
    assertNotNull(fluxLocationEntity);
    assertFaCatchFields(faCatch, fluxLocationEntity.getFaCatch());
}
Also used : FaCatchEntity(eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity) AapStockEntity(eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity) FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) AapProcessEntity(eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity) FluxLocationEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity) Test(org.junit.Test)

Example 2 with FluxCharacteristicEntity

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

the class FaCatchMapper method getFluxCharacteristicEntities.

protected Set<FluxCharacteristicEntity> getFluxCharacteristicEntities(List<FLUXCharacteristic> fluxCharacteristics, FaCatchEntity faCatchEntity) {
    if (fluxCharacteristics == null || fluxCharacteristics.isEmpty()) {
        return Collections.emptySet();
    }
    Set<FluxCharacteristicEntity> fluxCharacteristicEntities = new HashSet<>();
    for (FLUXCharacteristic fluxCharacteristic : fluxCharacteristics) {
        FluxCharacteristicEntity fluxCharacteristicEntity = FluxCharacteristicsMapper.INSTANCE.mapToFluxCharEntity(fluxCharacteristic);
        fluxCharacteristicEntity.setFaCatch(faCatchEntity);
        fluxCharacteristicEntities.add(fluxCharacteristicEntity);
    }
    return fluxCharacteristicEntities;
}
Also used : FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity) HashSet(java.util.HashSet)

Example 3 with FluxCharacteristicEntity

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

the class FishingActivityMapper method getFluxCharacteristicsEntities.

protected Set<FluxCharacteristicEntity> getFluxCharacteristicsEntities(List<FLUXCharacteristic> fluxCharacteristics, FishingActivityEntity fishingActivityEntity) {
    if (fluxCharacteristics == null || fluxCharacteristics.isEmpty()) {
        return Collections.emptySet();
    }
    Set<FluxCharacteristicEntity> fluxCharacteristicEntities = new HashSet<>();
    for (FLUXCharacteristic fluxCharacteristic : fluxCharacteristics) {
        FluxCharacteristicEntity fluxCharacteristicEntity = FluxCharacteristicsMapper.INSTANCE.mapToFluxCharEntity(fluxCharacteristic);
        fluxCharacteristicEntity.setFishingActivity(fishingActivityEntity);
        fluxCharacteristicEntities.add(fluxCharacteristicEntity);
    }
    return fluxCharacteristicEntities;
}
Also used : FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity) HashSet(java.util.HashSet)

Example 4 with FluxCharacteristicEntity

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

the class BaseActivityViewMapper method getFluxCharacteristicsTypeCodeValue.

protected Map<String, String> getFluxCharacteristicsTypeCodeValue(Set<FluxCharacteristicEntity> fluxCharacteristics) {
    if (fluxCharacteristics == null) {
        return Collections.emptyMap();
    }
    Map<String, String> characMap = new HashMap<>();
    for (FluxCharacteristicEntity fluxCharacteristic : fluxCharacteristics) {
        String value = null;
        if (fluxCharacteristic.getValueMeasure() != null) {
            value = String.valueOf(fluxCharacteristic.getValueMeasure());
        } else if (fluxCharacteristic.getValueDateTime() != null) {
            value = DateUtils.dateToString(fluxCharacteristic.getValueDateTime());
        } else if (fluxCharacteristic.getValueIndicator() != null) {
            value = fluxCharacteristic.getValueIndicator();
        } else if (fluxCharacteristic.getValueCode() != null) {
            value = fluxCharacteristic.getValueCode();
        } else if (fluxCharacteristic.getValueText() != null) {
            value = fluxCharacteristic.getValueText();
        } else if (fluxCharacteristic.getValueQuantity() != null) {
            value = String.valueOf(fluxCharacteristic.getValueQuantity());
        }
        characMap.put(fluxCharacteristic.getTypeCode(), value);
    }
    return characMap;
}
Also used : HashMap(java.util.HashMap) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)

Example 5 with FluxCharacteristicEntity

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

the class ActivityEntityToModelMapper method mapSpecifiedFLUXCharacteristics.

private void mapSpecifiedFLUXCharacteristics(FishingActivity fishingActivity, Set<FluxCharacteristicEntity> fluxCharacteristics) {
    if (CollectionUtils.isNotEmpty(fluxCharacteristics)) {
        List<FLUXCharacteristic> fluxCharacteristicList = new ArrayList<>();
        for (FluxCharacteristicEntity source : fluxCharacteristics) {
            FLUXCharacteristic target = new FLUXCharacteristic();
            mapPurposeCode(target, source);
            mapValueCode(target, source);
            mapValueDateTime(target, source);
            mapValueIndicator(target, source);
            mapValueQuantity(target, source);
            mapValueMeasure(target, source);
            mapDescriptions(target, source);
            mapValues(target, source);
            fluxCharacteristicList.add(target);
        }
        fishingActivity.setSpecifiedFLUXCharacteristics(fluxCharacteristicList);
    }
}
Also used : ArrayList(java.util.ArrayList) FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)

Aggregations

FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)7 FLUXCharacteristic (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic)4 Test (org.junit.Test)3 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)2 HashSet (java.util.HashSet)2 AapProcessEntity (eu.europa.ec.fisheries.ers.fa.entities.AapProcessEntity)1 AapStockEntity (eu.europa.ec.fisheries.ers.fa.entities.AapStockEntity)1 DelimitedPeriodEntity (eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity)1 FishingActivityEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityEntity)1 FishingActivityIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingActivityIdentifierEntity)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)1 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)1