Search in sources :

Example 1 with DataObjectFormatData

use of xades4j.properties.data.DataObjectFormatData 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);
    }
}
Also used : XmlDocumentationReferencesType(xades4j.xml.bind.xades.XmlDocumentationReferencesType) DataObjectFormatData(xades4j.properties.data.DataObjectFormatData) XmlDataObjectFormatType(xades4j.xml.bind.xades.XmlDataObjectFormatType) XmlObjectIdentifierType(xades4j.xml.bind.xades.XmlObjectIdentifierType)

Example 2 with DataObjectFormatData

use of xades4j.properties.data.DataObjectFormatData 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);
}
Also used : DataObjectFormatData(xades4j.properties.data.DataObjectFormatData) XmlDataObjectFormatType(xades4j.xml.bind.xades.XmlDataObjectFormatType)

Example 3 with DataObjectFormatData

use of xades4j.properties.data.DataObjectFormatData in project xades4j by luisgoncalves.

the class DataGenDataObjFormat method generatePropertyData.

@Override
public PropertyDataObject generatePropertyData(DataObjectFormatProperty prop, PropertiesDataGenerationContext ctx) {
    // DataObjectFormat applies to a single data object. The mandatory ObjectReference
    // attribute MUST reference the ds:Reference element of the ds:Signature
    // corresponding with the data object qualified by this property.
    // This assumes that the QualifyingProperties are in the signature's document.
    DataObjectDesc targetDataObjInfo = prop.getTargetDataObjects().iterator().next();
    String objRef = '#' + ctx.getReferencesMappings().get(targetDataObjInfo).getId();
    DataObjectFormatData dataObjFormatData = new DataObjectFormatData(objRef);
    dataObjFormatData.setMimeType(prop.getMimeType());
    dataObjFormatData.setEncoding(prop.getEncoding());
    dataObjFormatData.setDescription(prop.getDescription());
    dataObjFormatData.setIdentifier(prop.getIdentifier());
    dataObjFormatData.setDocumentationUris(prop.getDocumentationUris());
    return dataObjFormatData;
}
Also used : DataObjectFormatData(xades4j.properties.data.DataObjectFormatData) DataObjectDesc(xades4j.properties.DataObjectDesc)

Aggregations

DataObjectFormatData (xades4j.properties.data.DataObjectFormatData)3 XmlDataObjectFormatType (xades4j.xml.bind.xades.XmlDataObjectFormatType)2 DataObjectDesc (xades4j.properties.DataObjectDesc)1 XmlDocumentationReferencesType (xades4j.xml.bind.xades.XmlDocumentationReferencesType)1 XmlObjectIdentifierType (xades4j.xml.bind.xades.XmlObjectIdentifierType)1