use of eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class BaseActivityViewMapper method fillRoleAndCharacteristics.
private void fillRoleAndCharacteristics(GearDto gearDto, FishingGearEntity gearEntity) {
Set<FishingGearRoleEntity> fishingGearRole = gearEntity.getFishingGearRole();
if (CollectionUtils.isNotEmpty(fishingGearRole)) {
FishingGearRoleEntity role = fishingGearRole.iterator().next();
gearDto.setRole(role.getRoleCode());
}
Set<GearCharacteristicEntity> gearCharacteristics = gearEntity.getGearCharacteristics();
if (CollectionUtils.isNotEmpty(gearCharacteristics)) {
for (GearCharacteristicEntity charac : gearCharacteristics) {
fillCharacteristicField(charac, gearDto);
}
}
}
use of eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class GearCharacteristicsMapper method fillRoleAndCharacteristics.
private void fillRoleAndCharacteristics(GearDto gearDto, FishingGearEntity gearEntity) {
Set<FishingGearRoleEntity> fishingGearRole = gearEntity.getFishingGearRole();
if (CollectionUtils.isNotEmpty(fishingGearRole)) {
FishingGearRoleEntity role = fishingGearRole.iterator().next();
gearDto.setRole(role.getRoleCode());
}
Set<GearCharacteristicEntity> gearCharacteristics = gearEntity.getGearCharacteristics();
if (CollectionUtils.isNotEmpty(gearCharacteristics)) {
for (GearCharacteristicEntity charac : gearCharacteristics) {
fillCharacteristicField(charac, gearDto);
}
}
}
use of eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class BaseMapper method getGearCharacteristicEntities.
public static Set<GearCharacteristicEntity> getGearCharacteristicEntities(List<GearCharacteristic> gearCharacteristics, FishingGearEntity fishingGearEntity) {
if (CollectionUtils.isEmpty(gearCharacteristics)) {
return Collections.emptySet();
}
Set<GearCharacteristicEntity> gearCharacteristicEntities = newSet();
for (GearCharacteristic gearCharacteristic : gearCharacteristics) {
GearCharacteristicEntity gearCharacteristicEntity = GearCharacteristicsMapper.INSTANCE.mapToGearCharacteristicEntity(gearCharacteristic, fishingGearEntity, new GearCharacteristicEntity());
gearCharacteristicEntities.add(gearCharacteristicEntity);
}
return gearCharacteristicEntities;
}
use of eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity in project UVMS-ActivityModule-APP by UnionVMS.
the class GearCharacteristicsMapperTest method testGearCharacteristicsMapper.
@Test
public void testGearCharacteristicsMapper() {
GearCharacteristic gearCharacteristic = MapperUtil.getGearCharacteristics();
GearCharacteristicEntity gearCharacteristicEntity = new GearCharacteristicEntity();
GearCharacteristicsMapper.INSTANCE.mapToGearCharacteristicEntity(gearCharacteristic, null, gearCharacteristicEntity);
assertEquals(gearCharacteristic.getTypeCode().getValue(), gearCharacteristicEntity.getTypeCode());
assertEquals(gearCharacteristic.getTypeCode().getListID(), gearCharacteristicEntity.getTypeCodeListId());
assertTrue(gearCharacteristicEntity.getDescription().startsWith(gearCharacteristic.getDescriptions().get(0).getValue()));
assertEquals(gearCharacteristic.getValueMeasure().getValue().intValue(), gearCharacteristicEntity.getValueMeasure().intValue());
assertEquals(gearCharacteristic.getValueMeasure().getUnitCode(), gearCharacteristicEntity.getValueMeasureUnitCode());
assertEquals(gearCharacteristic.getValueMeasure().getValue().intValue(), gearCharacteristicEntity.getCalculatedValueMeasure().intValue());
assertEquals(gearCharacteristic.getValueDateTime().getDateTime().toGregorianCalendar().getTime(), gearCharacteristicEntity.getValueDateTime());
assertEquals(gearCharacteristic.getValueIndicator().getIndicatorString().getValue(), gearCharacteristicEntity.getValueIndicator());
assertEquals(gearCharacteristic.getValueCode().getValue(), gearCharacteristicEntity.getValueCode());
assertTrue(gearCharacteristicEntity.getValueText().startsWith(gearCharacteristic.getValue().getValue()));
assertEquals(gearCharacteristic.getValueQuantity().getValue().intValue(), gearCharacteristicEntity.getValueQuantity().intValue());
assertEquals(gearCharacteristic.getValueQuantity().getUnitCode(), gearCharacteristicEntity.getValueQuantityCode());
assertNull(gearCharacteristicEntity.getFishingGear());
}
Aggregations