Search in sources :

Example 6 with DelimitedPeriod

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

the class BaseMapper method mapToFishingTripEntity.

private static FishingTripEntity mapToFishingTripEntity(FishingTrip fishingTrip) {
    FishingTripEntity fishingTripEntity = FishingTripMapper.INSTANCE.mapToFishingTripEntity(fishingTrip);
    List<IDType> ids = fishingTrip.getIDS();
    if (CollectionUtils.isNotEmpty(ids)) {
        for (IDType idType : ids) {
            fishingTripEntity.addFishingTripIdentifiers(FishingTripIdentifierMapper.INSTANCE.mapToFishingTripIdentifier(idType));
        }
    }
    List<DelimitedPeriod> specifiedDelimitedPeriods = fishingTrip.getSpecifiedDelimitedPeriods();
    if (CollectionUtils.isNotEmpty(specifiedDelimitedPeriods)) {
        for (DelimitedPeriod delimitedPeriod : specifiedDelimitedPeriods) {
            fishingTripEntity.addDelimitedPeriods(DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodEntity(delimitedPeriod));
        }
    }
    return fishingTripEntity;
}
Also used : FishingTripEntity(eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)

Example 7 with DelimitedPeriod

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

the class MapperUtil method getDelimitedPeriod.

public static DelimitedPeriod getDelimitedPeriod() {
    DateTimeType startDate = getDateTimeType("2011-07-01 11:15:00");
    DateTimeType endDate = getDateTimeType("2016-07-01 11:15:00");
    MeasureType measureType = getMeasureType(500, "C62", "4rhfy5-fhtydr-tyfr85-ghtyd54");
    DelimitedPeriod delimitedPeriod = new DelimitedPeriod(startDate, endDate, measureType);
    return delimitedPeriod;
}
Also used : DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) MeasureType(un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)

Example 8 with DelimitedPeriod

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

the class DelimitedPeriodMapperTest method testDelimitedPeriodMapperForFishingTrip.

@Test
public void testDelimitedPeriodMapperForFishingTrip() {
    DelimitedPeriod delimitedPeriod = MapperUtil.getDelimitedPeriod();
    DelimitedPeriodEntity delimitedPeriodEntity = DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodEntity(delimitedPeriod);
    assertEquals(delimitedPeriod.getStartDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getStartDate());
    assertEquals(delimitedPeriod.getEndDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getEndDate());
    assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getDurationMeasure().getValue().intValue());
    assertEquals(delimitedPeriod.getDurationMeasure().getUnitCode(), delimitedPeriodEntity.getDurationMeasure().getUnitCode());
    assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getCalculatedDuration().intValue());
    assertNull(delimitedPeriodEntity.getFishingTrip());
}
Also used : DelimitedPeriodEntity(eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) Test(org.junit.Test)

Example 9 with DelimitedPeriod

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

the class DelimitedPeriodMapperTest method testDelimitedPeriodMapperForFishingActivity.

@Test
public void testDelimitedPeriodMapperForFishingActivity() {
    DelimitedPeriod delimitedPeriod = MapperUtil.getDelimitedPeriod();
    DelimitedPeriodEntity delimitedPeriodEntity = DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodEntity(delimitedPeriod);
    assertEquals(delimitedPeriod.getStartDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getStartDate());
    assertEquals(delimitedPeriod.getEndDateTime().getDateTime().toGregorianCalendar().getTime(), delimitedPeriodEntity.getEndDate());
    assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getDurationMeasure().getValue().intValue());
    assertEquals(delimitedPeriod.getDurationMeasure().getUnitCode(), delimitedPeriodEntity.getDurationMeasure().getUnitCode());
    assertEquals(delimitedPeriod.getDurationMeasure().getValue().intValue(), delimitedPeriodEntity.getCalculatedDuration().intValue());
    assertNull(delimitedPeriodEntity.getFishingActivity());
}
Also used : DelimitedPeriodEntity(eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) Test(org.junit.Test)

Aggregations

DelimitedPeriod (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod)9 DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)4 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)4 DelimitedPeriodEntity (eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity)3 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)3 Test (org.junit.Test)2 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)2 FishingTrip (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip)2 MeasureType (un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)2 FishingTripEntity (eu.europa.ec.fisheries.ers.fa.entities.FishingTripEntity)1 ArrayList (java.util.ArrayList)1 GregorianCalendar (java.util.GregorianCalendar)1 HashSet (java.util.HashSet)1 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 SneakyThrows (lombok.SneakyThrows)1 DateTime (org.joda.time.DateTime)1 Before (org.junit.Before)1 FACatch (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)1 FAQuery (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQuery)1 FAQueryParameter (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQueryParameter)1