use of eu.europa.ec.fisheries.ers.fa.entities.GearProblemEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityMapper method getGearProblemEntities.
protected Set<GearProblemEntity> getGearProblemEntities(List<GearProblem> gearProblems, FishingActivityEntity fishingActivityEntity) {
if (gearProblems == null || gearProblems.isEmpty()) {
return Collections.emptySet();
}
Set<GearProblemEntity> gearProblemEntities = new HashSet<>();
for (GearProblem gearProblem : gearProblems) {
GearProblemEntity gearProblemEntity = GearProblemMapper.INSTANCE.mapToGearProblemEntity(gearProblem);
gearProblemEntity.setFishingActivity(fishingActivityEntity);
gearProblemEntities.add(gearProblemEntity);
}
return gearProblemEntities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.GearProblemEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class GearProblemMapperTest method testGearProblemMapper.
@Test
public void testGearProblemMapper() {
GearProblem gearProblem = MapperUtil.getGearProblem();
GearProblemEntity gearProblemEntity = GearProblemMapper.INSTANCE.mapToGearProblemEntity(gearProblem);
assertEquals(gearProblem.getTypeCode().getValue(), gearProblemEntity.getTypeCode());
assertEquals(gearProblem.getTypeCode().getListID(), gearProblemEntity.getTypeCodeListId());
assertEquals(gearProblem.getAffectedQuantity().getValue().intValue(), gearProblemEntity.getAffectedQuantity());
assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getValue(), gearProblemEntity.getGearProblemRecovery().iterator().next().getRecoveryMeasureCode());
assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getListID(), gearProblemEntity.getGearProblemRecovery().iterator().next().getRecoveryMeasureCodeListId());
assertNull(gearProblemEntity.getFishingActivity());
assertNotNull(gearProblemEntity.getFishingGears());
FishingGearEntity fishingGearEntity = gearProblemEntity.getFishingGears().iterator().next();
assertEquals(gearProblem.getTypeCode().getValue(), fishingGearEntity.getGearProblem().getTypeCode());
assertEquals(gearProblem.getTypeCode().getListID(), fishingGearEntity.getGearProblem().getTypeCodeListId());
assertEquals(gearProblem.getAffectedQuantity().getValue().intValue(), fishingGearEntity.getGearProblem().getAffectedQuantity());
assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getValue(), fishingGearEntity.getGearProblem().getGearProblemRecovery().iterator().next().getRecoveryMeasureCode());
assertEquals(gearProblem.getRecoveryMeasureCodes().get(0).getListID(), fishingGearEntity.getGearProblem().getGearProblemRecovery().iterator().next().getRecoveryMeasureCodeListId());
assertEquals(gearProblemEntity.getTypeCode(), "Code Type 1");
assertEquals(gearProblemEntity.getTypeCodeListId(), "fhty58-gh586t-5tjf8-t58rjewe");
gearProblemEntity.getLocations().iterator().next().onPrePersist();
assertNotNull(gearProblemEntity.getLocations().iterator().next().getGeom());
}
Aggregations