use of un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType in project en16931-cii2ubl by phax.
the class CIIToUBL21Converter method _convertDocumentReference.
@Nullable
private static DocumentReferenceType _convertDocumentReference(@Nullable final ReferencedDocumentType aRD, @Nonnull final IErrorList aErrorList) {
if (aRD == null)
return null;
final String sID = aRD.getIssuerAssignedIDValue();
if (StringHelper.hasNoText(sID))
return null;
final DocumentReferenceType ret = new DocumentReferenceType();
// ID value is a mandatory field
ret.setID(sID).setSchemeID(aRD.getReferenceTypeCodeValue());
// IssueDate is optional
final FormattedDateTimeType aFDT = aRD.getFormattedIssueDateTime();
if (aFDT != null)
ret.setIssueDate(_parseDate(aFDT.getDateTimeString(), aErrorList));
// Name is optional
for (final TextType aItem : aRD.getName()) {
final DocumentDescriptionType aUBLDocDesc = new DocumentDescriptionType();
aUBLDocDesc.setValue(aItem.getValue());
aUBLDocDesc.setLanguageID(aItem.getLanguageID());
aUBLDocDesc.setLanguageLocaleID(aItem.getLanguageLocaleID());
ret.addDocumentDescription(aUBLDocDesc);
}
// Attachment (0..1 for CII)
if (aRD.getAttachmentBinaryObjectCount() > 0) {
final BinaryObjectType aBinObj = aRD.getAttachmentBinaryObjectAtIndex(0);
final AttachmentType aUBLAttachment = new AttachmentType();
final EmbeddedDocumentBinaryObjectType aEmbeddedDoc = new EmbeddedDocumentBinaryObjectType();
aEmbeddedDoc.setMimeCode(aBinObj.getMimeCode());
aEmbeddedDoc.setFilename(aBinObj.getFilename());
aEmbeddedDoc.setValue(aBinObj.getValue());
aUBLAttachment.setEmbeddedDocumentBinaryObject(aEmbeddedDoc);
final String sURI = aRD.getURIIDValue();
if (StringHelper.hasText(sURI)) {
final ExternalReferenceType aUBLExtRef = new ExternalReferenceType();
aUBLExtRef.setURI(sURI);
aUBLAttachment.setExternalReference(aUBLExtRef);
}
ret.setAttachment(aUBLAttachment);
}
return ret;
}
use of un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType in project en16931-cii2ubl by phax.
the class CIIToUBL23Converter method _convertPartyLegalEntity.
@Nullable
private static PartyLegalEntityType _convertPartyLegalEntity(@Nonnull final TradePartyType aTradeParty) {
final PartyLegalEntityType aUBLPartyLegalEntity = new PartyLegalEntityType();
final LegalOrganizationType aSLO = aTradeParty.getSpecifiedLegalOrganization();
if (aSLO != null) {
if (StringHelper.hasText(aSLO.getTradingBusinessNameValue()))
aUBLPartyLegalEntity.setRegistrationName(aSLO.getTradingBusinessNameValue());
aUBLPartyLegalEntity.setCompanyID(_copyID(aSLO.getID(), new CompanyIDType()));
}
// UBL 2.3 supports multiple of them
for (final TextType aDesc : aTradeParty.getDescription()) if (StringHelper.hasText(aDesc.getValue()))
aUBLPartyLegalEntity.addCompanyLegalForm(new CompanyLegalFormType(aDesc.getValue()));
if (aUBLPartyLegalEntity.getRegistrationName() == null) {
// Mandatory field according to Schematron
aUBLPartyLegalEntity.setRegistrationName(aTradeParty.getNameValue());
}
return aUBLPartyLegalEntity;
}
use of un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType 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._100.TextType in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapper method mapNames.
private void mapNames(RegistrationLocation target, RegistrationLocationEntity source) {
if (ObjectUtils.allNotNull(target, source)) {
TextType textType = new TextType();
textType.setValue(source.getName());
textType.setLanguageID(source.getNameLanguageId());
target.setNames(singletonList(textType));
}
}
use of un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType in project UVMS-ActivityModule-APP by UnionVMS.
the class ActivityEntityToModelMapper method mapDescription.
private void mapDescription(RegistrationEvent target, String description, String descLanguageId) {
if (ObjectUtils.allNotNull(target) && StringUtils.isNotEmpty(description) || StringUtils.isNotEmpty(descLanguageId)) {
TextType textType = new TextType();
if (StringUtils.isNotEmpty(description)) {
textType.setValue(description);
}
if (StringUtils.isNotEmpty(descLanguageId)) {
textType.setLanguageID(descLanguageId);
}
target.setDescriptions(Collections.singletonList(textType));
}
}
Aggregations