HashMap map = new HashMap();
XorCompositeAssertion XOR = (XorCompositeAssertion) policy.getTerms()
.get(0);
AndCompositeAssertion AND = (AndCompositeAssertion) XOR.getTerms().get(
0);
for (Iterator iterator = AND.getTerms().iterator(); iterator.hasNext();) {
AndCompositeAssertion nAND = new AndCompositeAssertion();
PrimitiveAssertion pa = (PrimitiveAssertion) iterator.next();
String namespace = pa.getName().getNamespaceURI();
nAND.addTerm(pa);
while (iterator.hasNext()) {
pa = (PrimitiveAssertion) iterator.next();
if (namespace.equals(pa.getName().getNamespaceURI())) {
nAND.addTerm(pa);
}
}
map.put(namespace, nAND);
AND.getTerms().removeAll(nAND.getTerms());
iterator = AND.getTerms().iterator();
}
for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
String namespace = (String) iterator.next();
PolicyExtension policyExtension = (PolicyExtension) ns2Exts.get(namespace);
// AxisModule axisModule = (AxisModule) ns2modules.get(namespace);
if (policyExtension == null) {
System.err.println("cannot find a PolicyExtension to process "
+ namespace + "type assertions");
continue;
}
Policy nPolicy = new Policy();
XorCompositeAssertion nXOR = new XorCompositeAssertion();
nPolicy.addTerm(nXOR);
AndCompositeAssertion nAND = (AndCompositeAssertion) map
.get(namespace);
nXOR.addTerm(nAND);
QName operationName = operation.getName();
policyExtension.addMethodsToStub(document, rootElement, operationName, nPolicy);