Search in sources :

Example 21 with TextType

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;
}
Also used : BinaryObjectType(un.unece.uncefact.data.standard.unqualifieddatatype._100.BinaryObjectType) FormattedDateTimeType(un.unece.uncefact.data.standard.qualifieddatatype._100.FormattedDateTimeType) TextType(un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType) Nullable(javax.annotation.Nullable)

Example 22 with TextType

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;
}
Also used : TextType(un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType) Nullable(javax.annotation.Nullable)

Example 23 with TextType

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;
}
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 24 with TextType

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));
    }
}
Also used : TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)

Example 25 with 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));
    }
}
Also used : TextType(un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)

Aggregations

TextType (un.unece.uncefact.data.standard.unqualifieddatatype._100.TextType)21 TextType (un.unece.uncefact.data.standard.unqualifieddatatype._20.TextType)19 Nullable (javax.annotation.Nullable)18 FormattedDateTimeType (un.unece.uncefact.data.standard.qualifieddatatype._100.FormattedDateTimeType)12 BinaryObjectType (un.unece.uncefact.data.standard.unqualifieddatatype._100.BinaryObjectType)12 IDType (un.unece.uncefact.data.standard.unqualifieddatatype._100.IDType)12 BigDecimal (java.math.BigDecimal)10 CodeType (un.unece.uncefact.data.standard.unqualifieddatatype._20.CodeType)10 CGlobal (com.helger.commons.CGlobal)9 ValueEnforcer (com.helger.commons.ValueEnforcer)9 CollectionHelper (com.helger.commons.collection.CollectionHelper)9 EqualsHelper (com.helger.commons.equals.EqualsHelper)9 ErrorList (com.helger.commons.error.list.ErrorList)9 IErrorList (com.helger.commons.error.list.IErrorList)9 MathHelper (com.helger.commons.math.MathHelper)9 ETriState (com.helger.commons.state.ETriState)9 StringHelper (com.helger.commons.string.StringHelper)9 Serializable (java.io.Serializable)9 LocalDate (java.time.LocalDate)9 Consumer (java.util.function.Consumer)9