Author: veithen
Date: Mon Nov 23 23:26:55 2015
New Revision: 1715986

URL: http://svn.apache.org/viewvc?rev=1715986&view=rev
Log:
Unify the (get|set)(Value|SubCode) code in the SOAPFaultClassifier 
implementations.

Modified:
    
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAP12FaultClassifierSupport.aj
    
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
    
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
    
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
    
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java

Modified: 
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAP12FaultClassifierSupport.aj
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAP12FaultClassifierSupport.aj?rev=1715986&r1=1715985&r2=1715986&view=diff
==============================================================================
--- 
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAP12FaultClassifierSupport.aj
 (original)
+++ 
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/AxiomSOAP12FaultClassifierSupport.aj
 Mon Nov 23 23:26:55 2015
@@ -20,10 +20,30 @@ package org.apache.axiom.soap.impl.commo
 
 import javax.xml.namespace.QName;
 
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFaultSubCode;
 import org.apache.axiom.soap.SOAPFaultValue;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultClassifier;
 
 public aspect AxiomSOAP12FaultClassifierSupport {
+    private static final Class<?>[] sequence = { SOAPFaultValue.class, 
SOAPFaultSubCode.class };
+    
+    public final SOAPFaultValue AxiomSOAP12FaultClassifier.getValue() {
+        return 
(SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE);
+    }
+
+    public final void AxiomSOAP12FaultClassifier.setValue(SOAPFaultValue 
value) {
+        insertChild(sequence, 0, value);
+    }
+    
+    public final SOAPFaultSubCode AxiomSOAP12FaultClassifier.getSubCode() {
+        return 
(SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
+    }
+    
+    public final void AxiomSOAP12FaultClassifier.setSubCode(SOAPFaultSubCode 
subCode) {
+        insertChild(sequence, 1, subCode);
+    }
+
     public final QName AxiomSOAP12FaultClassifier.getValueAsQName() {
         SOAPFaultValue value = getValue();
         return value == null ? null : value.getTextAsQName();

Modified: 
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java?rev=1715986&r1=1715985&r2=1715986&view=diff
==============================================================================
--- 
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
 (original)
+++ 
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
 Mon Nov 23 23:26:55 2015
@@ -22,34 +22,11 @@ package org.apache.axiom.soap.impl.dom.s
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.ElementHelper;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFaultSubCode;
-import org.apache.axiom.soap.SOAPFaultValue;
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.dom.SOAPFaultCodeImpl;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultCode;
 
 public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl implements 
AxiomSOAP12FaultCode {
-    public void setSubCode(SOAPFaultSubCode subCode)
-            throws SOAPProcessingException {
-        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault " +
-                            "Sub Code. But received some other 
implementation");
-        }
-        ElementHelper.setNewElement(this, getSubCode(), subCode);
-    }
-
-    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
-        if (!(value instanceof SOAP12FaultValueImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. " +
-                            "But received some other implementation");
-        }
-        ElementHelper.setNewElement(this, getValue(), value);
-    }
-
     // TODO: For compatibility with Axiom 1.2.x; remove in Axiom 1.3
     public QName getTextAsQName() {
         return getValueAsQName();
@@ -62,12 +39,4 @@ public class SOAP12FaultCodeImpl extends
                             "the parent. But received some other 
implementation");
         }
     }
-
-    public SOAPFaultValue getValue() {
-        return 
(SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE);
-    }
-
-    public SOAPFaultSubCode getSubCode() {
-        return 
(SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
-    }
 }

Modified: 
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java?rev=1715986&r1=1715985&r2=1715986&view=diff
==============================================================================
--- 
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
 (original)
+++ 
webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
 Mon Nov 23 23:26:55 2015
@@ -20,18 +20,11 @@
 package org.apache.axiom.soap.impl.dom.soap12;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.ElementHelper;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFaultSubCode;
-import org.apache.axiom.soap.SOAPFaultValue;
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.dom.SOAPElement;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultSubCode;
 
 public class SOAP12FaultSubCodeImpl extends SOAPElement implements 
AxiomSOAP12FaultSubCode {
-    private SOAPFaultValue value;
-    private SOAPFaultSubCode subCode;
-    
     public void checkParent(OMElement parent) throws SOAPProcessingException {
         if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
                 (parent instanceof SOAP12FaultCodeImpl))) {
@@ -41,37 +34,4 @@ public class SOAP12FaultSubCodeImpl exte
                             "other implementation");
         }
     }
-
-    public void setSubCode(SOAPFaultSubCode subCode) throws 
SOAPProcessingException {
-        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault " +
-                            "Sub Code. But received some other 
implementation");
-        }
-        ElementHelper.setNewElement(this, this.subCode, subCode);
-    }
-
-    public SOAPFaultSubCode getSubCode() {
-        if (subCode == null) {
-            subCode = 
(SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
-        }
-        return subCode;
-    }
-
-    public void setValue(SOAPFaultValue soapFaultSubCodeValue)
-            throws SOAPProcessingException {
-        if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. " +
-                            "But received some other implementation");
-        }
-        ElementHelper.setNewElement(this, value, soapFaultSubCodeValue);
-    }
-
-    public SOAPFaultValue getValue() {
-        if (value == null) {
-            value = 
(SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE);
-        }
-        return value;
-    }
 }

Modified: 
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java?rev=1715986&r1=1715985&r2=1715986&view=diff
==============================================================================
--- 
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
 (original)
+++ 
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
 Mon Nov 23 23:26:55 2015
@@ -22,31 +22,11 @@ package org.apache.axiom.soap.impl.llom.
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.ElementHelper;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFaultSubCode;
-import org.apache.axiom.soap.SOAPFaultValue;
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultCode;
 import org.apache.axiom.soap.impl.llom.SOAPFaultCodeImpl;
 
 public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl implements 
AxiomSOAP12FaultCode {
-    public void setSubCode(SOAPFaultSubCode subCode) throws 
SOAPProcessingException {
-        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP12FaultSubCodeImpl, got " + 
subCode.getClass());
-        }
-        ElementHelper.setNewElement(this, getSubCode(), subCode);
-    }
-
-    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
-        if (!(value instanceof SOAP12FaultValueImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP12FaultValueImpl, got " + value.getClass());
-        }
-        ElementHelper.setNewElement(this, getValue(), value);
-    }
-
     public void checkParent(OMElement parent) throws SOAPProcessingException {
         if (!(parent instanceof SOAP12FaultImpl)) {
             throw new SOAPProcessingException(
@@ -58,12 +38,4 @@ public class SOAP12FaultCodeImpl extends
     public QName getTextAsQName() {
         return getValueAsQName();
     }
-
-    public SOAPFaultValue getValue() {
-        return 
(SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE);
-    }
-
-    public SOAPFaultSubCode getSubCode() {
-        return 
(SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
-    }
 }

Modified: 
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java?rev=1715986&r1=1715985&r2=1715986&view=diff
==============================================================================
--- 
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
 (original)
+++ 
webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
 Mon Nov 23 23:26:55 2015
@@ -20,18 +20,11 @@
 package org.apache.axiom.soap.impl.llom.soap12;
 
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.ElementHelper;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPFaultSubCode;
-import org.apache.axiom.soap.SOAPFaultValue;
 import org.apache.axiom.soap.SOAPProcessingException;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultSubCode;
 import org.apache.axiom.soap.impl.llom.SOAPElement;
 
 public class SOAP12FaultSubCodeImpl extends SOAPElement implements 
AxiomSOAP12FaultSubCode {
-    private SOAPFaultValue value;
-    private SOAPFaultSubCode subCode;
-    
     public void checkParent(OMElement parent) throws SOAPProcessingException {
         if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
                 (parent instanceof SOAP12FaultCodeImpl))) {
@@ -41,36 +34,4 @@ public class SOAP12FaultSubCodeImpl exte
                             "other implementation");
         }
     }
-
-    public void setSubCode(SOAPFaultSubCode subCode)
-            throws SOAPProcessingException {
-        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP12FaultSubCodeImpl, got " + 
subCode.getClass());
-        }
-        ElementHelper.setNewElement(this, this.subCode, subCode);
-    }
-
-    public SOAPFaultSubCode getSubCode() {
-        if (subCode == null) {
-            subCode = 
(SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
-        }
-        return subCode;
-    }
-
-    public void setValue(SOAPFaultValue soapFaultSubCodeValue)
-            throws SOAPProcessingException {
-        if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) {
-            throw new SOAPProcessingException(
-                    "Expecting SOAP12FaultValueImpl, got " + 
soapFaultSubCodeValue.getClass());
-        }
-        ElementHelper.setNewElement(this, value, soapFaultSubCodeValue);
-    }
-
-    public SOAPFaultValue getValue() {
-        if (value == null) {
-            value = 
(SOAPFaultValue)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_VALUE);
-        }
-        return value;
-    }
 }


Reply via email to