Search in sources :

Example 11 with DateTimeType

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

the class ActivityEntityToModelMapper method mapToFLUXFAReportMessage.

@SneakyThrows
public FLUXFAReportMessage mapToFLUXFAReportMessage(List<FaReportDocumentEntity> faReportMessageEntity) {
    FLUXFAReportMessage target = new FLUXFAReportMessage();
    FLUXReportDocument fluxReportDocument = new FLUXReportDocument();
    CodeType codeType = new CodeType();
    codeType.setValue("9");
    codeType.setListID("FLUX_GP_PURPOSE");
    fluxReportDocument.setPurposeCode(codeType);
    IDType idType = new IDType();
    idType.setSchemeID("UUID");
    idType.setValue(UUID.randomUUID().toString());
    fluxReportDocument.setIDS(Collections.singletonList(idType));
    DateTimeType dateTimeType = new DateTimeType();
    dateTimeType.setDateTime(DateUtils.getCurrentDate());
    fluxReportDocument.setCreationDateTime(dateTimeType);
    TextType textType = new TextType();
    textType.setValue("LOAD_REPORTS");
    fluxReportDocument.setPurpose(textType);
    FLUXParty party = new FLUXParty();
    IDType idType1 = new IDType();
    idType1.setSchemeID("FLUX_GP_PARTY");
    idType1.setValue("TODO_SET_NODE_ALIAS");
    party.setIDS(Collections.singletonList(idType1));
    fluxReportDocument.setOwnerFLUXParty(party);
    target.setFLUXReportDocument(fluxReportDocument);
    if (CollectionUtils.isNotEmpty(faReportMessageEntity)) {
        mapFAReportDocuments(target, faReportMessageEntity);
    }
    return target;
}
Also used : FLUXReportDocument(un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) FLUXFAReportMessage(un.unece.uncefact.data.standard.fluxfareportmessage._3.FLUXFAReportMessage) 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) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType) SneakyThrows(lombok.SneakyThrows)

Example 12 with DateTimeType

use of un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType 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 13 with DateTimeType

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

the class ActivityEntityToModelMapper method mapOccurrenceDateTime.

private void mapOccurrenceDateTime(FishingActivity target, Date source) {
    if (ObjectUtils.allNotNull(target, source)) {
        DateTimeType dateTimeType = new DateTimeType();
        dateTimeType.setDateTime(DateUtils.dateToXmlGregorian(source));
        target.setOccurrenceDateTime(dateTimeType);
    }
}
Also used : DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)

Example 14 with DateTimeType

use of un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType 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 15 with DateTimeType

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

the class MapperUtil method getDateTimeType.

private static DateTimeType getDateTimeType(String value) {
    try {
        DateTimeType dateTimeType = new DateTimeType();
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(df.parse(value));
        XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), DatatypeConstants.FIELD_UNDEFINED, cal.getTimeZone().LONG).normalize();
        dateTimeType.setDateTime(xmlDate);
        return dateTimeType;
    } catch (Exception e) {
        return null;
    }
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) DateTimeType(un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType) DateFormat(java.text.DateFormat) SimpleDateFormat(java.text.SimpleDateFormat) GregorianCalendar(java.util.GregorianCalendar) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) SimpleDateFormat(java.text.SimpleDateFormat) ParseException(com.vividsolutions.jts.io.ParseException)

Aggregations

DateTimeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.DateTimeType)17 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)9 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._20.IDType)7 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)6 FLUXParty (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXParty)5 DelimitedPeriod (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.DelimitedPeriod)4 FLUXReportDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXReportDocument)4 MeasureType (un.unece.uncefact.data.standard.unqualifieddatatype._20.MeasureType)4 GregorianCalendar (java.util.GregorianCalendar)3 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)3 FLUXLocation (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXLocation)3 FishingActivity (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FishingActivity)3 QuantityType (un.unece.uncefact.data.standard.unqualifieddatatype._20.QuantityType)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 SneakyThrows (lombok.SneakyThrows)2 FAQuery (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQuery)2 FAQueryParameter (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FAQueryParameter)2 FLAPDocument (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLAPDocument)2 FLUXCharacteristic (un.unece.uncefact.data.standard.reusableaggregatebusinessinformationentity._20.FLUXCharacteristic)2