Search in sources :

Example 1 with GearCharacteristic

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic 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 2 with GearCharacteristic

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic in project UVMS-ActivityModule-APP by UnionVMS.

the class MapperUtil method getGearCharacteristics.

public static GearCharacteristic getGearCharacteristics() {
    CodeType typeCode = getCodeType("Code 1", "57t3yf-ght43yrf-ght56yru-ght7565h");
    List<TextType> descriptions = Arrays.asList(getTextType("This is sample text"));
    MeasureType valueMeasure = getMeasureType(123, "C62", "57t3yf-ght43yrf-ght56yru-ght7565h");
    DateTimeType valueDateTime = getDateTimeType("2016-07-01 11:15:00");
    IndicatorType valueIndicator = getIndicatorType(true, "Test value", "Test format");
    CodeType valueCode = getCodeType("Code type 1", "4fhry5-thfyr85-67thf-5htr84");
    TextType value = getTextType("This is sample Text");
    QuantityType valueQuantity = getQuantityType(123);
    List<FLUXLocation> specifiedFluxLocations = Arrays.asList(getFluxLocation());
    GearCharacteristic gearCharacteristic = new GearCharacteristic(typeCode, descriptions, valueMeasure, valueDateTime, valueIndicator, valueCode, value, valueQuantity, specifiedFluxLocations);
    return gearCharacteristic;
}
Also used : DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) IndicatorType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IndicatorType) QuantityType(un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType) FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) MeasureType(un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType) GearCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)

Example 3 with GearCharacteristic

use of un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic 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

GearCharacteristic (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearCharacteristic)3 GearCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.GearCharacteristicEntity)2 Test (org.junit.Test)1 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)1 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)1 DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)1 IndicatorType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IndicatorType)1 MeasureType (un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)1 QuantityType (un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType)1 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)1