use of un.unece.uncefact.data.standard.unqualifieddatatype._100.BinaryObjectType 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.BinaryObjectType in project en16931-cii2ubl by phax.
the class CIIToUBL22Converter 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.BinaryObjectType in project en16931-cii2ubl by phax.
the class CIIToUBL23Converter 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;
}
Aggregations