Example usage for javax.xml.bind JAXBElement getScope

List of usage examples for javax.xml.bind JAXBElement getScope

Introduction

In this page you can find the example usage for javax.xml.bind JAXBElement getScope.

Prototype

public Class getScope() 

Source Link

Document

Returns scope of xml element declaration.

Usage

From source file:be.fedict.eid.tsl.Tsl2PdfExporter.java

private void printExtension(ExtensionType extension, Document document) throws DocumentException {

    List<Object> contentList = extension.getContent();
    for (Object content : contentList) {
        LOG.debug("extension content: " + content.getClass().getName());
        if (content instanceof JAXBElement<?>) {
            JAXBElement<?> element = (JAXBElement<?>) content;
            LOG.debug("QName: " + element.getName());
            if (true == ADDITIONAL_SERVICE_INFORMATION_QNAME.equals(element.getName())) {
                addTitle("Extension (critical: " + extension.isCritical() + ")", title3Font,
                        Paragraph.ALIGN_LEFT, 0, 0, document);
                addTitle("Additional service information", title4Font, Paragraph.ALIGN_LEFT, 0, 0, document);
                AdditionalServiceInformationType additionalServiceInformation = (AdditionalServiceInformationType) element
                        .getValue();//  w  w  w  .  j  a va 2  s.c  o  m
                LOG.debug("information value: " + additionalServiceInformation.getInformationValue());
                NonEmptyMultiLangURIType multiLangUri = additionalServiceInformation.getURI();
                LOG.debug("URI : " + multiLangUri.getValue() + " (language: " + multiLangUri.getLang() + ")");
                document.add(new Paragraph(
                        multiLangUri.getValue().substring(
                                multiLangUri.getValue().indexOf("SvcInfoExt/") + "SvcInfoExt/".length()),
                        this.valueFont));
            } else {
                addTitle("Extension (critical: " + extension.isCritical() + ")", title3Font,
                        Paragraph.ALIGN_LEFT, 0, 0, document);
                addTitle("Qualifications", title4Font, Paragraph.ALIGN_LEFT, 0, 0, document);

                LOG.debug("element namespace: " + element.getName());
                LOG.debug("element name: " + element.getScope());
                if ("http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#"
                        .equals(element.getName().getNamespaceURI())
                        && "Qualifications".equals(element.getName().getLocalPart())) {
                    QualificationsType qualifications = (QualificationsType) element.getValue();
                    List<QualificationElementType> qualificationElements = qualifications
                            .getQualificationElement();
                    for (QualificationElementType qualificationElement : qualificationElements) {
                        QualifiersType qualifiers = qualificationElement.getQualifiers();
                        List<QualifierType> qualifierList = qualifiers.getQualifier();
                        for (QualifierType qualifier : qualifierList) {
                            document.add(new Paragraph(
                                    "Qualifier: " + qualifier.getUri().substring(
                                            qualifier.getUri().indexOf("SvcInfoExt/") + "SvcInfoExt/".length()),
                                    this.valueFont));
                        }

                        CriteriaListType criteriaList = qualificationElement.getCriteriaList();
                        String description = criteriaList.getDescription();
                        if (null != description) {
                            document.add(new Paragraph("Criterial List Description", this.labelFont));
                            document.add(new Paragraph(description, this.valueFont));
                        }
                        document.add(new Paragraph("Assert: " + criteriaList.getAssert(), this.valueFont));
                        List<PoliciesListType> policySet = criteriaList.getPolicySet();
                        for (PoliciesListType policiesList : policySet) {
                            List<ObjectIdentifierType> oids = policiesList.getPolicyIdentifier();
                            for (ObjectIdentifierType oid : oids) {
                                document.add(new Paragraph("Policy OID: " + oid.getIdentifier().getValue(),
                                        this.valueFont));
                            }
                        }
                    }
                }

            }

        } else if (content instanceof Element) {
            addTitle("Qualifications", title4Font, Paragraph.ALIGN_LEFT, 0, 0, document);
            Element element = (Element) content;
            LOG.debug("element namespace: " + element.getNamespaceURI());
            LOG.debug("element name: " + element.getLocalName());
            if ("http://uri.etsi.org/TrstSvc/SvcInfoExt/eSigDir-1999-93-EC-TrustedList/#"
                    .equals(element.getNamespaceURI()) && "Qualifications".equals(element.getLocalName())) {
                try {
                    QualificationsType qualifications = unmarshallQualifications(element);
                    List<QualificationElementType> qualificationElements = qualifications
                            .getQualificationElement();
                    for (QualificationElementType qualificationElement : qualificationElements) {
                        QualifiersType qualifiers = qualificationElement.getQualifiers();
                        List<QualifierType> qualifierList = qualifiers.getQualifier();
                        for (QualifierType qualifier : qualifierList) {
                            document.add(new Paragraph(
                                    "Qualifier: " + qualifier.getUri().substring(
                                            qualifier.getUri().indexOf("SvcInfoExt/") + "SvcInfoExt/".length()),
                                    this.valueFont));
                        }

                        CriteriaListType criteriaList = qualificationElement.getCriteriaList();
                        String description = criteriaList.getDescription();
                        if (null != description) {
                            document.add(new Paragraph("Criterial List Description", this.labelFont));
                            document.add(new Paragraph(description, this.valueFont));
                        }
                        document.add(new Paragraph("Assert: " + criteriaList.getAssert(), this.valueFont));
                        List<PoliciesListType> policySet = criteriaList.getPolicySet();
                        for (PoliciesListType policiesList : policySet) {
                            List<ObjectIdentifierType> oids = policiesList.getPolicyIdentifier();
                            for (ObjectIdentifierType oid : oids) {
                                document.add(new Paragraph("Policy OID: " + oid.getIdentifier().getValue(),
                                        this.valueFont));
                            }
                        }
                    }
                } catch (JAXBException e) {
                    LOG.error("JAXB error: " + e.getMessage(), e);
                }
            }
        }
    }
}