public void serialize(XMLStreamWriter writer) throws XMLStreamException { if (element != null) { copyEvents(XMLInputFactory.newInstance().createXMLEventReader(new DOMSource(element)), writer); } else { throw new RuntimeException("Wrapped Element is not set"); } }
public boolean equal(PolicyComponent policyComponent) { if (policyComponent.getType() != Constants.TYPE_ASSERTION) { return false; } return getName().equals(((Assertion) policyComponent).getName()); }
return newPolicyContainingAssertion(element, atts.isEmpty() ? null : atts, policy); return new XmlPrimitiveAssertion(element);
/** * Returns the partial normalized version of the wrapped Element, that is * assumed to be an assertion. */ public PolicyComponent normalize() { if (optional) { Policy policy = new Policy(); ExactlyOne exactlyOne = new ExactlyOne(); All all = new All(); Element el = (Element)this.element.cloneNode(true); Attr attr = el.getAttributeNodeNS(Constants.URI_POLICY_13_NS, Constants.ATTR_OPTIONAL); if (attr != null) { el.removeAttributeNode(attr); } attr = el.getAttributeNodeNS(Constants.URI_POLICY_15_NS, Constants.ATTR_OPTIONAL); if (attr != null) { el.removeAttributeNode(attr); } all.addPolicyComponent(new XmlPrimitiveAssertion(el)); exactlyOne.addPolicyComponent(all); exactlyOne.addPolicyComponent(new All()); policy.addPolicyComponent(exactlyOne); return policy; } return this; }