Search in sources :

Example 1 with GearCharacteristicEntity

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);
        }
    }
}
Also used : FishingGearRoleEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearRoleEntity) GearCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity)

Example 2 with GearCharacteristicEntity

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);
        }
    }
}
Also used : FishingGearRoleEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingGearRoleEntity) GearCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity)

Example 3 with GearCharacteristicEntity

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;
}
Also used : GearCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity) GearCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic)

Example 4 with GearCharacteristicEntity

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());
}
Also used : GearCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic) GearCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity) Test(org.junit.Test)

Aggregations

GearCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity)4 FishingGearRoleEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingGearRoleEntity)2 GearCharacteristic (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic)2 Test (org.junit.Test)1