use of xades4j.xml.bind.xades.XmlAnyType 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);
}
}
use of xades4j.xml.bind.xades.XmlAnyType in project xades4j by luisgoncalves.
the class FromXmlSignaturePolicyConverter method getLocationUrl.
private static String getLocationUrl(XmlSignaturePolicyIdType xmlPolicyId) throws PropertyUnmarshalException {
XmlSigPolicyQualifiersListType sigPolicyQualifiers = xmlPolicyId.getSigPolicyQualifiers();
if (null == sigPolicyQualifiers) {
return null;
}
List<XmlAnyType> xmlQualifiers = sigPolicyQualifiers.getSigPolicyQualifier();
for (XmlAnyType xmlQualifier : xmlQualifiers) {
List content = xmlQualifier.getContent();
if (content.size() == 1 && content.get(0) instanceof JAXBElement) {
JAXBElement xmlSPURI = (JAXBElement) content.get(0);
if (xmlSPURI.getName().getLocalPart().equals("SPURI") && xmlSPURI.getName().getNamespaceURI().equals(QualifyingProperty.XADES_XMLNS)) {
return (String) xmlSPURI.getValue();
}
}
}
return null;
}
Aggregations