1 19 20 package org.netbeans.modules.websvc.wsitconf.wsdlmodelext; 21 22 import org.netbeans.modules.websvc.wsitmodelext.addressing.Addressing10WsdlQName; 23 import org.netbeans.modules.websvc.wsitmodelext.addressing.Addressing10WsdlUsingAddressing; 24 import org.netbeans.modules.websvc.wsitmodelext.policy.All; 25 import org.netbeans.modules.websvc.wsitmodelext.policy.Policy; 26 import org.netbeans.modules.xml.wsdl.model.Binding; 27 28 32 public class AddressingModelHelper { 33 34 37 public AddressingModelHelper() { 38 } 39 40 public static Addressing10WsdlUsingAddressing getUsingAddressing(Policy p) { 41 return (Addressing10WsdlUsingAddressing) PolicyModelHelper.getTopLevelElement(p, Addressing10WsdlUsingAddressing.class); 42 } 43 44 public static boolean isAddressingEnabled(Binding b) { 46 Policy p = PolicyModelHelper.getPolicyForElement(b); 47 if (p != null) { 48 Addressing10WsdlUsingAddressing addrAssertion = getUsingAddressing(p); 49 return (addrAssertion != null); 50 } 51 return false; 52 } 53 54 public static void enableAddressing(Binding b) { 56 All a = PolicyModelHelper.createPolicy(b); 57 PolicyModelHelper.createElement(a, Addressing10WsdlQName.USINGADDRESSING.getQName(), Addressing10WsdlUsingAddressing.class, false); 58 } 59 60 public static void disableAddressing(Binding b) { 62 Policy p = PolicyModelHelper.getPolicyForElement(b); 63 Addressing10WsdlUsingAddressing a = getUsingAddressing(p); 64 if (a != null) { 65 PolicyModelHelper.removeElement(a.getParent(), Addressing10WsdlUsingAddressing.class, false); 66 } 67 PolicyModelHelper.cleanPolicies(b); 68 } 69 } 70 | Popular Tags |