Search in sources :

Example 1 with DelimitedPeriod

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

the class MapperUtil method getStandardFishingActivity.

private static FishingActivity getStandardFishingActivity() {
    List<IDType> ids = Arrays.asList(getIdType("Id_1", "fhr574fh-thrud754-kgitjf754-gjtufe89"));
    CodeType typeCode = getCodeType("FISHING_OPERATION", "FLUX_FA_TYPE");
    DateTimeType occurrenceDateTime = getDateTimeType("2016-07-01 11:15:00");
    CodeType reasonCode = getCodeType("Reason_code_1", "FA_REASON_DEPARTURE");
    CodeType vesselRelatedActivityCode = getCodeType("Vessel activity 1", "58thft-58fjd8-gt85eje-hjgute8");
    CodeType fisheryTypeCode = getCodeType("Fishing_Type_code 1", "FA_FISHERY");
    CodeType speciesTargetCode = getCodeType("Species code 1", "FAO_SPECIES");
    QuantityType operationsQuantity = getQuantityType(100);
    MeasureType fishingDurationMeasure = getMeasureType(500, "C62", "4hr2yf0-t583thf-6jgttue8-6jtie844");
    List<FLAPDocument> specifiedFLAPDocument = Arrays.asList(getFlapDocument());
    VesselStorageCharacteristic sourceVesselStorageCharacteristic = getVesselStorageCharacteristic();
    VesselStorageCharacteristic destinationVesselStorageCharacteristic = getVesselStorageCharacteristic();
    List<FACatch> specifiedFACatches = Arrays.asList(getFaCatch());
    List<FLUXLocation> relatedFLUXLocations = Arrays.asList(getFluxLocation());
    List<GearProblem> specifiedGearProblems = Arrays.asList(getGearProblem());
    List<FLUXCharacteristic> specifiedFLUXCharacteristics = Arrays.asList(getFluxCharacteristics());
    List<FishingGear> specifiedFishingGears = Arrays.asList(getFishingGear());
    List<DelimitedPeriod> specifiedDelimitedPeriods = Arrays.asList(getDelimitedPeriod());
    FishingTrip specifiedFishingTrip = getFishingTrip();
    List<VesselTransportMeans> relatedVesselTransportMeans = Arrays.asList(getVesselTransportMeans());
    FishingActivity fishingActivity = new FishingActivity(ids, typeCode, occurrenceDateTime, reasonCode, vesselRelatedActivityCode, fisheryTypeCode, speciesTargetCode, operationsQuantity, fishingDurationMeasure, specifiedFACatches, relatedFLUXLocations, specifiedGearProblems, specifiedFLUXCharacteristics, specifiedFishingGears, sourceVesselStorageCharacteristic, destinationVesselStorageCharacteristic, null, specifiedFLAPDocument, specifiedDelimitedPeriods, specifiedFishingTrip, relatedVesselTransportMeans);
    return fishingActivity;
}
Also used : DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) FLAPDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLAPDocument) FishingGear(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingGear) MeasureType(un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) GearProblem(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.GearProblem) FishingActivity(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity) VesselStorageCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselStorageCharacteristic) FLUXCharacteristic(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic) VesselTransportMeans(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.VesselTransportMeans) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) QuantityType(un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType) FLUXLocation(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation) FishingTrip(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) FACatch(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FACatch)

Example 2 with DelimitedPeriod

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

the class MapperUtil method getFishingTrip.

public static FishingTrip getFishingTrip() {
    List<IDType> ids = Arrays.asList(getIdType("ID 1", "fhty58-gh586t-5tjf8-t58rjewe"));
    CodeType typeCode = getCodeType("Code Type 1", "57t3yf-ght43yrf-ght56yru-ght7565h");
    List<DelimitedPeriod> specifiedDelimitedPeriods = Arrays.asList(getDelimitedPeriod());
    FishingTrip fishingTrip = new FishingTrip(ids, typeCode, specifiedDelimitedPeriods);
    return fishingTrip;
}
Also used : DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) FishingTrip(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingTrip) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)

Example 3 with DelimitedPeriod

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

the class FishingActivityMapper method getCalculatedStartTime.

protected DateTimeType getCalculatedStartTime(FishingActivity fishingActivity) {
    if (fishingActivity == null)
        return null;
    DateTimeType dateTimeType = null;
    if (fishingActivity.getOccurrenceDateTime() != null)
        return fishingActivity.getOccurrenceDateTime();
    if (CollectionUtils.isNotEmpty(fishingActivity.getSpecifiedDelimitedPeriods())) {
        List<DelimitedPeriod> delimitedPeriodEntities = fishingActivity.getSpecifiedDelimitedPeriods();
        dateTimeType = delimitedPeriodEntities.iterator().next().getStartDateTime();
        if (dateTimeType != null) {
            return dateTimeType;
        }
    }
    // We reached till this point of code means FishingActivity has neither occurrence date or startDate for DelimitedPeriod.
    // In such cases, we need to check if its subactivities have date mentioned.
    // If yes, then take the first subactivity occurrence date and consider it as start date for parent fishing activity
    List<FishingActivity> relatedFishingActivities = fishingActivity.getRelatedFishingActivities();
    if (CollectionUtils.isNotEmpty(relatedFishingActivities)) {
        for (FishingActivity subFishingActivity : relatedFishingActivities) {
            if (subFishingActivity.getOccurrenceDateTime() != null || (CollectionUtils.isNotEmpty(fishingActivity.getSpecifiedDelimitedPeriods()) && fishingActivity.getSpecifiedDelimitedPeriods().iterator().next().getStartDateTime() != null)) {
                dateTimeType = subFishingActivity.getOccurrenceDateTime();
                if (dateTimeType == null) {
                    dateTimeType = fishingActivity.getSpecifiedDelimitedPeriods().iterator().next().getStartDateTime();
                }
                return dateTimeType;
            }
        }
    }
    return null;
}
Also used : FishingActivity(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod)

Example 4 with DelimitedPeriod

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

the class FishingActivityMapper method getDelimitedPeriodEntities.

protected Set<DelimitedPeriodEntity> getDelimitedPeriodEntities(List<DelimitedPeriod> delimitedPeriods, FishingActivityEntity fishingActivityEntity) {
    if (delimitedPeriods == null || delimitedPeriods.isEmpty()) {
        return Collections.emptySet();
    }
    Set<DelimitedPeriodEntity> delimitedPeriodEntities = new HashSet<>();
    for (DelimitedPeriod delimitedPeriod : delimitedPeriods) {
        DelimitedPeriodEntity delimitedPeriodEntity = DelimitedPeriodMapper.INSTANCE.mapToDelimitedPeriodEntity(delimitedPeriod);
        delimitedPeriodEntity.setFishingActivity(fishingActivityEntity);
        delimitedPeriodEntities.add(delimitedPeriodEntity);
    }
    return delimitedPeriodEntities;
}
Also used : DelimitedPeriodEntity(eu.europa.ec.fisheries.ers.fa.entities.DelimitedPeriodEntity) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) HashSet(java.util.HashSet)

Example 5 with DelimitedPeriod

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

the class ActivityToSubscriptionMapperTest method before.

@Before
@SneakyThrows
public void before() {
    IDType idType = new IDType();
    idType.setSchemeID("FLUX_GP_PARTY");
    idType.setValue("BEL");
    FLUXParty fluxParty = new FLUXParty();
    fluxParty.setIDS(Collections.singletonList(idType));
    DelimitedPeriod delimitedPeriod = new DelimitedPeriod();
    DateTimeType startDateTime = new DateTimeType();
    GregorianCalendar cal = new GregorianCalendar();
    DateTime dateTime = DateUtils.XML_FORMATTER.parseDateTime("2016-07-01T11:14:00Z");
    cal.setTime(dateTime.toDate());
    XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
    startDateTime.setDateTime(xmlDate);
    delimitedPeriod.setStartDateTime(startDateTime);
    DateTimeType endDateTime = new DateTimeType();
    GregorianCalendar cal2 = new GregorianCalendar();
    DateTime dateTime2 = DateUtils.XML_FORMATTER.parseDateTime("2017-07-01T02:00:00Z");
    cal2.setTime(dateTime2.toDate());
    XMLGregorianCalendar xmlDate2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal2);
    endDateTime.setDateTime(xmlDate2);
    delimitedPeriod.setEndDateTime(endDateTime);
    FAQueryParameter faQueryParameter = new FAQueryParameter();
    CodeType codeType = new CodeType();
    codeType.setValue(SubCriteriaType.VESSELID.value());
    faQueryParameter.setTypeCode(codeType);
    IDType idType0 = new IDType();
    idType0.setValue("PD2438");
    idType0.setSchemeID("IRCS");
    faQueryParameter.setValueID(idType0);
    FAQueryParameter faQueryParameter2 = new FAQueryParameter();
    CodeType codeType2 = new CodeType();
    codeType2.setValue(SubCriteriaType.VESSELID.value());
    faQueryParameter2.setTypeCode(codeType2);
    IDType idType2 = new IDType();
    idType2.setValue("SVN123456789");
    idType2.setSchemeID("CFR");
    faQueryParameter2.setValueID(idType2);
    FAQueryParameter faQueryParameter3 = new FAQueryParameter();
    CodeType codeType3 = new CodeType();
    codeType3.setValue(SubCriteriaType.TRIPID.value());
    faQueryParameter3.setTypeCode(codeType3);
    IDType idType3 = new IDType();
    idType3.setValue("FRA-TRP-2016122102030");
    idType3.setSchemeID("EU_TRIP_ID");
    faQueryParameter3.setValueID(idType3);
    FAQueryParameter faQueryParameter4 = new FAQueryParameter();
    CodeType codeType4 = new CodeType();
    codeType4.setValue("CONSOLIDATED");
    CodeType valueCode = new CodeType();
    valueCode.setListID("BOOLEAN_VALUE");
    valueCode.setValue("Y");
    faQueryParameter4.setTypeCode(codeType4);
    faQueryParameter4.setValueCode(valueCode);
    List<FAQueryParameter> faQueryParameters = new ArrayList<>();
    faQueryParameters.add(faQueryParameter);
    faQueryParameters.add(faQueryParameter2);
    faQueryParameters.add(faQueryParameter3);
    faQueryParameters.add(faQueryParameter4);
    FAQuery faQuery = new FAQuery();
    faQuery.setSpecifiedDelimitedPeriod(delimitedPeriod);
    faQuery.setSimpleFAQueryParameters(faQueryParameters);
    faQuery.setSubmitterFLUXParty(fluxParty);
    fluxfaQueryMessage.setFAQuery(faQuery);
}
Also used : FAQueryParameter(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQueryParameter) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) DelimitedPeriod(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod) FAQuery(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQuery) GregorianCalendar(java.util.GregorianCalendar) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ArrayList(java.util.ArrayList) CodeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType) IDType(un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType) FLUXParty(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXParty) DateTime(org.joda.time.DateTime) Before(org.junit.Before) SneakyThrows(lombok.SneakyThrows)

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