Search in sources :

Example 1 with FishingGearEntity

use of eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity 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 FishingGearEntity

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

the class FishingGearMapperTest method testFishingGearMapperWithGearProblem.

@Test
public void testFishingGearMapperWithGearProblem() {
    FishingGear fishingGear = MapperUtil.getFishingGear();
    FishingGearEntity fishingGearEntity = FishingGearMapper.INSTANCE.mapToFishingGearEntity(fishingGear);
    assertEquals(fishingGear.getTypeCode().getValue(), fishingGearEntity.getTypeCode());
    assertEquals(fishingGear.getTypeCode().getListID(), fishingGearEntity.getTypeCodeListId());
    assertEquals(fishingGear.getRoleCodes().get(0).getValue(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCode());
    assertEquals(fishingGear.getRoleCodes().get(0).getListID(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCodeListId());
    assertNull(fishingGearEntity.getGearProblem());
    assertNotNull(fishingGearEntity.getGearCharacteristics());
    fishingGearEntity = fishingGearEntity.getGearCharacteristics().iterator().next().getFishingGear();
    assertEquals(fishingGear.getTypeCode().getValue(), fishingGearEntity.getTypeCode());
    assertEquals(fishingGear.getTypeCode().getListID(), fishingGearEntity.getTypeCodeListId());
    assertEquals(fishingGear.getRoleCodes().get(0).getValue(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCode());
    assertEquals(fishingGear.getRoleCodes().get(0).getListID(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCodeListId());
}
Also used : FishingGear(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) Test(org.junit.Test)

Example 3 with FishingGearEntity

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

the class FishingGearMapperTest method testFishingGearMapperWithFishingActivity.

@Test
public void testFishingGearMapperWithFishingActivity() {
    FishingGear fishingGear = MapperUtil.getFishingGear();
    FishingGearEntity fishingGearEntity = FishingGearMapper.INSTANCE.mapToFishingGearEntity(fishingGear);
    assertEquals(fishingGear.getTypeCode().getValue(), fishingGearEntity.getTypeCode());
    assertEquals(fishingGear.getTypeCode().getListID(), fishingGearEntity.getTypeCodeListId());
    assertEquals(fishingGear.getRoleCodes().get(0).getValue(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCode());
    assertEquals(fishingGear.getRoleCodes().get(0).getListID(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCodeListId());
    assertNull(fishingGearEntity.getFishingActivity());
    assertNotNull(fishingGearEntity.getGearCharacteristics());
    fishingGearEntity = fishingGearEntity.getGearCharacteristics().iterator().next().getFishingGear();
    assertEquals(fishingGear.getTypeCode().getValue(), fishingGearEntity.getTypeCode());
    assertEquals(fishingGear.getTypeCode().getListID(), fishingGearEntity.getTypeCodeListId());
    assertEquals(fishingGear.getRoleCodes().get(0).getValue(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCode());
    assertEquals(fishingGear.getRoleCodes().get(0).getListID(), fishingGearEntity.getFishingGearRole().iterator().next().getRoleCodeListId());
}
Also used : FishingGear(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) Test(org.junit.Test)

Example 4 with FishingGearEntity

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

the class FaCatchMapper method getFishingGearEntities.

protected Set<FishingGearEntity> getFishingGearEntities(List<FishingGear> fishingGears, FaCatchEntity faCatchEntity) {
    if (fishingGears == null || fishingGears.isEmpty()) {
        return Collections.emptySet();
    }
    Set<FishingGearEntity> fishingGearEntities = new HashSet<>();
    for (FishingGear fishingGear : fishingGears) {
        FishingGearEntity fishingGearEntity = FishingGearMapper.INSTANCE.mapToFishingGearEntity(fishingGear);
        fishingGearEntity.setFaCatch(faCatchEntity);
        fishingGearEntities.add(fishingGearEntity);
    }
    return fishingGearEntities;
}
Also used : FishingGear(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) HashSet(java.util.HashSet)

Example 5 with FishingGearEntity

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

the class FishingActivityMapper method getFishingGearEntities.

protected Set<FishingGearEntity> getFishingGearEntities(List<FishingGear> fishingGears, FishingActivityEntity fishingActivityEntity) {
    if (fishingGears == null || fishingGears.isEmpty()) {
        return Collections.emptySet();
    }
    Set<FishingGearEntity> fishingGearEntities = new HashSet<>();
    for (FishingGear fishingGear : fishingGears) {
        FishingGearEntity fishingGearEntity = FishingGearMapper.INSTANCE.mapToFishingGearEntity(fishingGear);
        fishingGearEntity.setFishingActivity(fishingActivityEntity);
        fishingGearEntities.add(fishingGearEntity);
    }
    return fishingGearEntities;
}
Also used : FishingGear(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear) FishingGearEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity) HashSet(java.util.HashSet)

Aggregations

FishingGearEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearEntity)12 Test (org.junit.Test)7 FishingGear (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear)6 HashSet (java.util.HashSet)4 FaCatchEntity (eu.europa.ec.fisheries.ers.fa.entities.FaCatchEntity)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)2 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)2 FluxLocationEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxLocationEntity)2 GearDto (eu.europa.ec.fisheries.ers.service.dto.view.GearDto)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 GearProblemEntity (eu.europa.ec.fisheries.ers.fa.entities.GearProblemEntity)1 ArrayList (java.util.ArrayList)1 Parameters (junitparams.Parameters)1 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)1 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)1 GearProblem (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearProblem)1