Search in sources :

Example 11 with FLUXCharacteristic

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

the class ActivityEntityToModelMapper method mapValueDateTime.

private void mapValueDateTime(FLUXCharacteristic target, FluxCharacteristicEntity source) {
    if (ObjectUtils.allNotNull(target, source)) {
        Date valueDateTime = source.getValueDateTime();
        if (valueDateTime != null) {
            DateTimeType dateTimeType = new DateTimeType();
            dateTimeType.setDateTime(DateUtils.dateToXmlGregorian(valueDateTime));
            target.setValueDateTime(dateTimeType);
        }
    }
}
Also used : DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) Date(java.util.Date)

Example 12 with FLUXCharacteristic

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

the class ActivityEntityToModelMapper method mapDescriptions.

private void mapDescriptions(FLUXCharacteristic target, FluxCharacteristicEntity source) {
    if (ObjectUtils.allNotNull(target, source)) {
        String description = source.getDescription();
        String valueLanguageId = source.getValueLanguageId();
        if (StringUtils.isNotEmpty(description) || StringUtils.isNotEmpty(valueLanguageId)) {
            TextType textType = new TextType();
            if (StringUtils.isNotEmpty(description)) {
                textType.setValue(description);
            }
            if (StringUtils.isNotEmpty(valueLanguageId)) {
                textType.setLanguageID(source.getValueLanguageId());
            }
            target.setDescriptions(Collections.singletonList(textType));
        }
    }
}
Also used : TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)

Example 13 with FLUXCharacteristic

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

the class ActivityEntityToModelMapper method mapValueQuantity.

private void mapValueQuantity(FLUXCharacteristic target, FluxCharacteristicEntity source) {
    if (ObjectUtils.allNotNull(target, source)) {
        Double valueQuantity = source.getValueQuantity();
        String valueQuantityCode = source.getValueQuantityCode();
        if (StringUtils.isNotEmpty(valueQuantityCode) || valueQuantity != null) {
            QuantityType quantityType = new QuantityType();
            if (StringUtils.isNotEmpty(valueQuantityCode)) {
                quantityType.setUnitCode(valueQuantityCode);
            }
            if (valueQuantity != null) {
                quantityType.setValue(new BigDecimal(valueQuantity));
            }
            target.setValueQuantity(quantityType);
        }
    }
}
Also used : QuantityType(un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType) BigDecimal(java.math.BigDecimal)

Example 14 with FLUXCharacteristic

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

the class MapperUtil method getFluxLocation.

public static FLUXLocation getFluxLocation() {
    FLUXLocation fluxLocation = new FLUXLocation();
    CodeType typeCode = getCodeType("AREA", "FLUX_LOCATION_TYPE");
    IDType countryID = getIdType("XEU", "TERRITORY");
    CodeType regionalFisheriesManagementOrganizationCode = getCodeType("RFMO1", "fhty58-gh586t-5tjf8-t58rjewe");
    FLUXGeographicalCoordinate specifiedPhysicalFLUXGeographicalCoordinate = getFluxGeographicalCoordinate();
    IDType id = getIdType("25.5b", "FAO_AREA");
    CodeType geopoliticalRegionCode = getCodeType("Code type 2", "fhty258-g3h586t-5t4jf8-t58rjew5e");
    List<TextType> names = Arrays.asList(getTextType("This is sample name"));
    IDType sovereignRightsCountryID = getIdType("sovereign rights id 1", "fhty58-gh5486t-5t5jf8-t58rjewe");
    IDType jurisdictionCountryID = getIdType("jurisdiction country id 1", "fht1y58-gh5876t-5t3jf8-t58rjewe");
    List<FLUXCharacteristic> applicableFLUXCharacteristics = null;
    List<StructuredAddress> postalStructuredAddresses = Arrays.asList(getStructuredAddress());
    StructuredAddress physicalStructuredAddress = getStructuredAddress();
    fluxLocation.setTypeCode(typeCode);
    fluxLocation.setCountryID(countryID);
    fluxLocation.setRegionalFisheriesManagementOrganizationCode(regionalFisheriesManagementOrganizationCode);
    fluxLocation.setSpecifiedPhysicalFLUXGeographicalCoordinate(specifiedPhysicalFLUXGeographicalCoordinate);
    fluxLocation.setID(id);
    fluxLocation.setGeopoliticalRegionCode(geopoliticalRegionCode);
    fluxLocation.setNames(names);
    fluxLocation.setSovereignRightsCountryID(sovereignRightsCountryID);
    fluxLocation.setJurisdictionCountryID(jurisdictionCountryID);
    fluxLocation.setApplicableFLUXCharacteristics(applicableFLUXCharacteristics);
    fluxLocation.setPostalStructuredAddresses(postalStructuredAddresses);
    fluxLocation.setPhysicalStructuredAddress(physicalStructuredAddress);
    return fluxLocation;
}
Also used : FLUXGeographicalCoordinate(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXGeographicalCoordinate) FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) StructuredAddress(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.StructuredAddress) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)

Example 15 with FLUXCharacteristic

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

the class FluxCharacteristicsMapperTest method testFluxCharacteristicsMapper.

@Test
public void testFluxCharacteristicsMapper() {
    FLUXCharacteristic fluxCharacteristic = MapperUtil.getFluxCharacteristics();
    FluxCharacteristicEntity fluxCharacteristicEntity = FluxCharacteristicsMapper.INSTANCE.mapToFluxCharEntity(fluxCharacteristic);
    assertEquals(fluxCharacteristic.getTypeCode().getValue(), fluxCharacteristicEntity.getTypeCode());
    assertEquals(fluxCharacteristic.getTypeCode().getListID(), fluxCharacteristicEntity.getTypeCodeListId());
    assertEquals(fluxCharacteristic.getValueMeasure().getValue().intValue(), fluxCharacteristicEntity.getValueMeasure().intValue());
    assertEquals(fluxCharacteristic.getValueMeasure().getUnitCode(), fluxCharacteristicEntity.getValueMeasureUnitCode());
    assertEquals(fluxCharacteristic.getValueMeasure().getValue().intValue(), fluxCharacteristicEntity.getCalculatedValueMeasure().intValue());
    assertEquals(fluxCharacteristic.getValueDateTime().getDateTime().toGregorianCalendar().getTime(), fluxCharacteristicEntity.getValueDateTime());
    assertEquals(fluxCharacteristic.getValueIndicator().getIndicatorString().getValue(), fluxCharacteristicEntity.getValueIndicator());
    assertEquals(fluxCharacteristic.getValueCode().getValue(), fluxCharacteristicEntity.getValueCode());
    assertTrue(fluxCharacteristicEntity.getValueText().startsWith(fluxCharacteristic.getValues().get(0).getValue()));
    assertEquals(fluxCharacteristic.getValueQuantity().getValue().intValue(), fluxCharacteristicEntity.getValueQuantity().intValue());
    assertEquals(fluxCharacteristic.getValueQuantity().getUnitCode(), fluxCharacteristicEntity.getValueQuantityCode());
    assertTrue(fluxCharacteristicEntity.getDescription().startsWith(fluxCharacteristic.getDescriptions().get(0).getValue()));
}
Also used : FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) FluxCharacteristicEntity(eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity) Test(org.junit.Test)

Aggregations

FLUXCharacteristic (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic)8 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)6 FluxCharacteristicEntity (eu.europa.ec.fisheries.ers.fa.entities.FluxCharacteristicEntity)4 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)4 MeasureType (un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)4 QuantityType (un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType)4 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)4 DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)3 BigDecimal (java.math.BigDecimal)2 HashSet (java.util.HashSet)2 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)2 FLAPDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLAPDocument)2 FishingGear (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear)2 FishingTrip (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip)2 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)2 IndicatorType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IndicatorType)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Test (org.junit.Test)1 AAPProcess (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.AAPProcess)1