use of xades4j.xml.bind.xades.XmlDataObjectFormatType in project xades4j by luisgoncalves.
the class FromXmlDataObjFormatPropertyConverter method convertFromObjectTree.
@Override
public void convertFromObjectTree(XmlSignedDataObjectPropertiesType xmlProps, QualifyingPropertiesDataCollector propertyDataCollector) throws PropertyUnmarshalException {
List<XmlDataObjectFormatType> xmlFormats = xmlProps.getDataObjectFormat();
if (xmlFormats.isEmpty())
return;
for (XmlDataObjectFormatType xmlDataObjFormat : xmlFormats) {
XmlObjectIdentifierType xmlObjId = xmlDataObjFormat.getObjectIdentifier();
DataObjectFormatData dataObjFormatData = new DataObjectFormatData(xmlDataObjFormat.getObjectReference());
dataObjFormatData.setIdentifier(FromXmlUtils.getObjectIdentifier(xmlObjId));
dataObjFormatData.setMimeType(xmlDataObjFormat.getMimeType());
dataObjFormatData.setEncoding(xmlDataObjFormat.getEncoding());
dataObjFormatData.setDescription(xmlDataObjFormat.getDescription());
if (xmlObjId != null) {
XmlDocumentationReferencesType docRefs = xmlDataObjFormat.getObjectIdentifier().getDocumentationReferences();
if (docRefs != null && !docRefs.getDocumentationReference().isEmpty())
dataObjFormatData.setDocumentationUris(docRefs.getDocumentationReference());
}
propertyDataCollector.addDataObjectFormat(dataObjFormatData);
}
}
use of xades4j.xml.bind.xades.XmlDataObjectFormatType in project xades4j by luisgoncalves.
the class ToXmlDataObjectFormatConverter method convertIntoObjectTree.
@Override
public void convertIntoObjectTree(PropertyDataObject propData, XmlSignedPropertiesType xmlProps, Document doc) {
DataObjectFormatData dataObjFormatData = (DataObjectFormatData) propData;
XmlDataObjectFormatType xmlDataObjFormatProp = new XmlDataObjectFormatType();
xmlDataObjFormatProp.setObjectReference(dataObjFormatData.getObjectRef());
xmlDataObjFormatProp.setDescription(dataObjFormatData.getDescription());
xmlDataObjFormatProp.setMimeType(dataObjFormatData.getMimeType());
xmlDataObjFormatProp.setEncoding(dataObjFormatData.getEncoding());
xmlDataObjFormatProp.setObjectIdentifier(getXmlObjId(dataObjFormatData));
xmlProps.getSignedDataObjectProperties().getDataObjectFormat().add(xmlDataObjFormatProp);
}
Aggregations