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);
}
}
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;
}
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);
}
}
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;
}
Aggregations