Search in sources :

Example 1 with XmlObjectIdentifierType

use of xades4j.xml.bind.xades.XmlObjectIdentifierType 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 XmlObjectIdentifierType

use of xades4j.xml.bind.xades.XmlObjectIdentifierType in project xades4j by luisgoncalves.

the class ToXmlUtils method getXmlObjectId.

static XmlObjectIdentifierType getXmlObjectId(ObjectIdentifier objId) {
    XmlObjectIdentifierType xmlObjId = new XmlObjectIdentifierType();
    // Object identifier
    XmlIdentifierType xmlId = new XmlIdentifierType();
    xmlId.setValue(objId.getIdentifier());
    // If it is IdentifierType.URI the converter returns null, which is the
    // same as not specifying a qualifier.
    xmlId.setQualifier(identifierTypeConv.get(objId.getIdentifierType()));
    xmlObjId.setIdentifier(xmlId);
    // Description
    xmlObjId.setDescription(objId.getDescription());
    return xmlObjId;
}
Also used : XmlIdentifierType(xades4j.xml.bind.xades.XmlIdentifierType) XmlObjectIdentifierType(xades4j.xml.bind.xades.XmlObjectIdentifierType)

Example 3 with XmlObjectIdentifierType

use of xades4j.xml.bind.xades.XmlObjectIdentifierType in project xades4j by luisgoncalves.

the class ToXmlCommitmentTypeConverter method convertIntoObjectTree.

@Override
public void convertIntoObjectTree(PropertyDataObject propData, XmlSignedPropertiesType xmlProps, Document doc) {
    CommitmentTypeData commitmentTypeData = (CommitmentTypeData) propData;
    // Create the JAXB CommitmentTypeIndication and add it to SignedDataObjectProperties.
    XmlCommitmentTypeIndicationType xmlCommitmentTypeProp = new XmlCommitmentTypeIndicationType();
    xmlProps.getSignedDataObjectProperties().getCommitmentTypeIndication().add(xmlCommitmentTypeProp);
    XmlIdentifierType xmlIdentifier = new XmlIdentifierType();
    xmlIdentifier.setValue(commitmentTypeData.getUri());
    XmlObjectIdentifierType xmlObjectId = new XmlObjectIdentifierType();
    xmlObjectId.setDescription(commitmentTypeData.getDescription());
    xmlObjectId.setIdentifier(xmlIdentifier);
    xmlCommitmentTypeProp.setCommitmentTypeId(xmlObjectId);
    Collection<String> refsUris = commitmentTypeData.getObjReferences();
    if (null == refsUris) {
        xmlCommitmentTypeProp.setAllSignedDataObjects();
    } else {
        xmlCommitmentTypeProp.getObjectReference().addAll(refsUris);
    }
    Collection qualifiers = commitmentTypeData.getQualifiers();
    if (!qualifiers.isEmpty()) {
        XmlCommitmentTypeQualifiersListType xmlQualifiers = new XmlCommitmentTypeQualifiersListType();
        for (Object q : qualifiers) {
            XmlAnyType xmlQualifier = new XmlAnyType();
            xmlQualifier.getContent().add(q);
            xmlQualifiers.getCommitmentTypeQualifier().add(xmlQualifier);
        }
        xmlCommitmentTypeProp.setCommitmentTypeQualifiers(xmlQualifiers);
    }
}
Also used : XmlAnyType(xades4j.xml.bind.xades.XmlAnyType) XmlIdentifierType(xades4j.xml.bind.xades.XmlIdentifierType) XmlCommitmentTypeIndicationType(xades4j.xml.bind.xades.XmlCommitmentTypeIndicationType) XmlObjectIdentifierType(xades4j.xml.bind.xades.XmlObjectIdentifierType) XmlCommitmentTypeQualifiersListType(xades4j.xml.bind.xades.XmlCommitmentTypeQualifiersListType) Collection(java.util.Collection) PropertyDataObject(xades4j.properties.data.PropertyDataObject) CommitmentTypeData(xades4j.properties.data.CommitmentTypeData)

Example 4 with XmlObjectIdentifierType

use of xades4j.xml.bind.xades.XmlObjectIdentifierType in project xades4j by luisgoncalves.

the class ToXmlDataObjectFormatConverter method getXmlObjId.

private XmlObjectIdentifierType getXmlObjId(DataObjectFormatData dataObjFormatData) {
    ObjectIdentifier identifier = dataObjFormatData.getIdentifier();
    if (null == identifier)
        return null;
    XmlObjectIdentifierType xmlObjId = ToXmlUtils.getXmlObjectId(identifier);
    // Documentation references
    Collection<String> docsUris = dataObjFormatData.getDocumentationUris();
    if (docsUris != null && !docsUris.isEmpty()) {
        XmlDocumentationReferencesType docRefs = new XmlDocumentationReferencesType();
        docRefs.getDocumentationReference().addAll(docsUris);
        xmlObjId.setDocumentationReferences(docRefs);
    }
    return xmlObjId;
}
Also used : XmlDocumentationReferencesType(xades4j.xml.bind.xades.XmlDocumentationReferencesType) XmlObjectIdentifierType(xades4j.xml.bind.xades.XmlObjectIdentifierType) ObjectIdentifier(xades4j.properties.ObjectIdentifier)

Aggregations

XmlObjectIdentifierType (xades4j.xml.bind.xades.XmlObjectIdentifierType)4 XmlDocumentationReferencesType (xades4j.xml.bind.xades.XmlDocumentationReferencesType)2 XmlIdentifierType (xades4j.xml.bind.xades.XmlIdentifierType)2 Collection (java.util.Collection)1 ObjectIdentifier (xades4j.properties.ObjectIdentifier)1 CommitmentTypeData (xades4j.properties.data.CommitmentTypeData)1 DataObjectFormatData (xades4j.properties.data.DataObjectFormatData)1 PropertyDataObject (xades4j.properties.data.PropertyDataObject)1 XmlAnyType (xades4j.xml.bind.xades.XmlAnyType)1 XmlCommitmentTypeIndicationType (xades4j.xml.bind.xades.XmlCommitmentTypeIndicationType)1 XmlCommitmentTypeQualifiersListType (xades4j.xml.bind.xades.XmlCommitmentTypeQualifiersListType)1 XmlDataObjectFormatType (xades4j.xml.bind.xades.XmlDataObjectFormatType)1