use of xades4j.properties.CommitmentTypePropertyBase in project xades4j by luisgoncalves.
the class CommitmentTypeVerifier method verify.
@Override
public QualifyingProperty verify(CommitmentTypeData propData, QualifyingPropertyVerificationContext ctx) throws CommitmentTypeVerificationException {
String uri = propData.getUri(), desc = propData.getDescription();
Collection<String> objsReferences = propData.getObjReferences();
CommitmentTypePropertyBase property;
if (objsReferences != null) {
// "Check that all the ObjectReference elements actually reference
// ds:Reference elements from the signature."
SignedObjectsData signedObjsData = ctx.getSignedObjectsData();
CommitmentTypeProperty commitmentTypeProperty = new CommitmentTypeProperty(uri, desc);
for (String objRef : objsReferences) {
RawDataObjectDesc dataObj = signedObjsData.findSignedDataObject(objRef);
if (null == dataObj)
throw new CommitmentTypeVerificationException(objRef);
// Associate the property to the data object.
dataObj.withCommitmentType(commitmentTypeProperty);
}
property = commitmentTypeProperty;
} else {
property = new AllDataObjsCommitmentTypeProperty(uri, desc);
}
if (propData.getQualifiers() != null) {
for (Object q : propData.getQualifiers()) {
if (q instanceof String) {
property.withQualifier((String) q);
} else if (q instanceof Element) {
property.withQualifier((Element) q);
}
}
}
return property;
}
Aggregations