Search in sources :

Example 16 with JAXBElement

use of jakarta.xml.bind.JAXBElement 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;
}
Also used : XmlAnyType(xades4j.xml.bind.xades.XmlAnyType) List(java.util.List) JAXBElement(jakarta.xml.bind.JAXBElement) XmlSigPolicyQualifiersListType(xades4j.xml.bind.xades.XmlSigPolicyQualifiersListType)

Aggregations

JAXBElement (jakarta.xml.bind.JAXBElement)16 QName (javax.xml.namespace.QName)11 Test (org.junit.jupiter.api.Test)6 GET (jakarta.ws.rs.GET)3 Path (jakarta.ws.rs.Path)3 StringReader (java.io.StringReader)3 StreamSource (javax.xml.transform.stream.StreamSource)3 Tag (org.junit.jupiter.api.Tag)3 FileDataSource (jakarta.activation.FileDataSource)2 Produces (jakarta.ws.rs.Produces)2 GenericEntity (jakarta.ws.rs.core.GenericEntity)2 SseEventSink (jakarta.ws.rs.sse.SseEventSink)2 JAXBContext (jakarta.xml.bind.JAXBContext)2 JAXBException (jakarta.xml.bind.JAXBException)2 Unmarshaller (jakarta.xml.bind.Unmarshaller)2 Source (javax.xml.transform.Source)2 FlightType (org.springframework.oxm.jaxb.test.FlightType)2 XmlAnyType (xades4j.xml.bind.xades.XmlAnyType)2 XmlSigPolicyQualifiersListType (xades4j.xml.bind.xades.XmlSigPolicyQualifiersListType)2 DataHandler (jakarta.activation.DataHandler)1