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());
}
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());
}
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());
}
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;
}
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;
}
Aggregations