Search in sources :

Example 1 with XmlIdentifierType

use of xades4j.xml.bind.xades.XmlIdentifierType 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 2 with XmlIdentifierType

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

Aggregations

XmlIdentifierType (xades4j.xml.bind.xades.XmlIdentifierType)2 XmlObjectIdentifierType (xades4j.xml.bind.xades.XmlObjectIdentifierType)2 Collection (java.util.Collection)1 CommitmentTypeData (xades4j.properties.data.CommitmentTypeData)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