use of un.unece.uncefact.data.standard.unqualifieddatatype._18.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;
}
use of un.unece.uncefact.data.standard.unqualifieddatatype._18.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);
}
}
}
use of un.unece.uncefact.data.standard.unqualifieddatatype._18.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);
}
}
use of un.unece.uncefact.data.standard.unqualifieddatatype._18.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;
}
use of un.unece.uncefact.data.standard.unqualifieddatatype._18.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;
}
}
Aggregations