Author: bimargulies
Date: Sun Nov 16 11:44:48 2008
New Revision: 718092

URL: http://svn.apache.org/viewvc?rev=718092&view=rev
Log:
Address WSCOMMONS-163 by implementing a useful alternative.

Modified:
    
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java
    
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java

Modified: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java?rev=718092&r1=718091&r2=718092&view=diff
==============================================================================
--- 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java
 (original)
+++ 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java
 Sun Nov 16 11:44:48 2008
@@ -19,6 +19,8 @@
 
 package org.apache.ws.commons.schema;
 
+import javax.xml.namespace.QName;
+
 import org.apache.ws.commons.schema.constants.Constants;
 
 /**
@@ -153,4 +155,27 @@
         xml += "</" + prefix + "complexType>\n";
         return xml;
     }
+
+    /**
+     * Return the QName of the base schema type, if any, as defined in the 
content model.
+     */
+       public QName getBaseSchemaTypeName() {
+               XmlSchemaContentModel model = getContentModel();
+               if (model == null) {
+                       return null;
+               }
+               XmlSchemaContent content = model.getContent();
+               if (content == null) {
+                       return null;
+               }
+
+               if (!(content instanceof XmlSchemaComplexContentExtension)) {
+                       return null;
+               }
+
+               XmlSchemaComplexContentExtension ext = 
(XmlSchemaComplexContentExtension) content;
+               return ext.getBaseTypeName();
+       }
+
+
 }

Modified: 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java?rev=718092&r1=718091&r2=718092&view=diff
==============================================================================
--- 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
 (original)
+++ 
webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java
 Sun Nov 16 11:44:48 2008
@@ -51,12 +51,21 @@
     /**
      * This function returns null. It is intended at some point to return the 
base type in the event of a restriction,
      * but that functionality is not implemented.
+     * @see #getBaseSchemaTypeName()
      * @return null
      */
     public Object getBaseSchemaType() {
         return baseSchemaType;
     }
 
+    /**
+     * If there is a base schema type, which by definition has to have a 
global name, return it.
+     * @return the qualified name of the base schema type. Return null if none 
(e.g. for simple types).
+     */
+    public QName getBaseSchemaTypeName() {
+       return null;
+    }
+
     public XmlSchemaDatatype getDataType() {
         return dataType;
     }


Reply via email to