cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r709640 - in /cxf/branches/2.1.x-fixes: ./ rt/javascript/src/main/java/org/apache/cxf/javascript/ rt/javascript/src/main/java/org/apache/cxf/javascript/types/
Date Sat, 01 Nov 2008 03:48:57 GMT
Author: ningjiang
Date: Fri Oct 31 20:48:57 2008
New Revision: 709640

URL: http://svn.apache.org/viewvc?rev=709640&view=rev
Log:
Merged revisions 708417 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r708417 | bimargulies | 2008-10-28 10:21:43 +0800 (Tue, 28 Oct 2008) | 2 lines
  
  drip, drip, drip towards attribute support.
........

Added:
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ItemInfo.java
      - copied unchanged from r708417, cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/ItemInfo.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/UnsupportedConstruct.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 31 20:48:57 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,709353-709354
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,708035,708044,708074,708417,709353-709354

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java?rev=709640&r1=709639&r2=709640&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/AttributeInfo.java
Fri Oct 31 20:48:57 2008
@@ -23,22 +23,23 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.common.xmlschema.XmlSchemaConstants;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaAnnotated;
+import org.apache.ws.commons.schema.XmlSchemaAnyAttribute;
 import org.apache.ws.commons.schema.XmlSchemaAttribute;
-import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaObject;
 import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.ws.commons.schema.XmlSchemaUse;
+import org.apache.ws.commons.schema.constants.Constants.BlockConstants;
 
 /**
  * All the information needed to create the JavaScript for an Xml Schema attribute
  * or xs:anyAttribute.
  */
-public final class AttributeInfo {
+public final class AttributeInfo implements ItemInfo {
     private static final Logger LOG = LogUtils.getL7dLogger(AttributeInfo.class);
     private XmlSchemaAnnotated annotated;
     private String javascriptName;
@@ -50,6 +51,7 @@
     private String defaultValue;
     private String fixedValue;
     private boolean global;
+    private XmlSchemaUse use;
 
     private AttributeInfo() {
     }
@@ -76,7 +78,7 @@
     }
 
     /**
-     * Fill in an ElementInfo for an element or xs:any from a sequence.
+     * Fill in an AttributeInfo for an attribute or anyAttribute from a sequence.
      * 
      * @param sequenceElement
      * @param currentSchema
@@ -90,38 +92,46 @@
                                             NamespacePrefixAccumulator prefixAccumulator,
QName contextName) {
         XmlSchemaAnnotated annotated = XmlSchemaUtils.getObjectAnnotated(sequenceObject,
contextName);
         AttributeInfo attributeInfo = new AttributeInfo();
-        XmlSchemaAnnotated realParticle = annotated;
+        XmlSchemaAnnotated realAnnotated = annotated;
 
         if (annotated instanceof XmlSchemaAttribute) {
             XmlSchemaAttribute attribute = (XmlSchemaAttribute)annotated;
-
+            attributeInfo.use = attribute.getUse();
+            
             if (attribute.getRefName() != null) {
-                XmlSchemaAttribute refElement = schemaCollection
+                XmlSchemaAttribute refAttribute = schemaCollection
                     .getAttributeByQName(attribute.getRefName());
-                if (refElement == null) {
-                    Message message = new Message("ATTRIBUTE_DANGLING_REFERENCE", LOG, attribute
-                        .getQName(), attribute.getRefName());
-                    throw new UnsupportedConstruct(message.toString());
+                if (refAttribute == null) {
+                    throw new UnsupportedConstruct(LOG, "ATTRIBUTE_DANGLING_REFERENCE", attribute
+                                                   .getQName(), attribute.getRefName());

                 }
-                realParticle = refElement;
+                realAnnotated = refAttribute;
                 attributeInfo.global = true;
             }
+        } else if (annotated instanceof XmlSchemaAnyAttribute) {
+            attributeInfo.any = true;
+            attributeInfo.xmlName = null; // unknown until runtime.
+            attributeInfo.javascriptName = "any";
+            attributeInfo.type = null; // runtime for any.
+            attributeInfo.use = new XmlSchemaUse(BlockConstants.OPTIONAL);
+        } else {
+            throw new UnsupportedConstruct(LOG, "UNSUPPORTED_ATTRIBUTE_ITEM", annotated,
contextName);
         }
 
-        factoryCommon(realParticle, currentSchema, schemaCollection, prefixAccumulator, attributeInfo);
+        factoryCommon(realAnnotated, currentSchema, schemaCollection, prefixAccumulator,
attributeInfo);
 
-        attributeInfo.annotated = realParticle;
+        attributeInfo.annotated = realAnnotated;
 
         return attributeInfo;
     }
 
-    private static void factoryCommon(XmlSchemaAnnotated particle, XmlSchema currentSchema,
+    private static void factoryCommon(XmlSchemaAnnotated annotated, XmlSchema currentSchema,
                                       SchemaCollection schemaCollection,
                                       NamespacePrefixAccumulator prefixAccumulator, 
                                       AttributeInfo attributeInfo) {
 
-        if (particle instanceof XmlSchemaAttribute) {
-            XmlSchemaAttribute attribute = (XmlSchemaAttribute)particle;
+        if (annotated instanceof XmlSchemaAttribute) {
+            XmlSchemaAttribute attribute = (XmlSchemaAttribute)annotated;
             String attributeNamespaceURI = attribute.getQName().getNamespaceURI();
             boolean attributeNoNamespace = "".equals(attributeNamespaceURI);
 
@@ -143,61 +153,36 @@
             attributeInfo.javascriptName = attribute.getQName().getLocalPart();
             attributeInfo.defaultValue = attribute.getDefaultValue();
             attributeInfo.fixedValue = attribute.getFixedValue();
+            attributeInfo.use = attribute.getUse();
             factorySetupType(attribute, schemaCollection, attributeInfo);
         } else { // any
             attributeInfo.any = true;
             attributeInfo.xmlName = null; // unknown until runtime.
-            // TODO: multiple 'any'
             attributeInfo.javascriptName = "any";
             attributeInfo.type = null; // runtime for any.
-
+            attributeInfo.use = new XmlSchemaUse(BlockConstants.OPTIONAL);
         }
     }
 
     private static void factorySetupType(XmlSchemaAttribute element, SchemaCollection schemaCollection,
-                                         AttributeInfo elementInfo) {
-        elementInfo.type = element.getSchemaType();
-        if (elementInfo.type == null) {
+                                         AttributeInfo attributeInfo) {
+        attributeInfo.type = element.getSchemaType();
+        if (attributeInfo.type == null) {
             if (element.getSchemaTypeName().equals(XmlSchemaConstants.ANY_TYPE_QNAME)) {
-                elementInfo.anyType = true;
+                attributeInfo.anyType = true;
             } else {
-                elementInfo.type = schemaCollection.getTypeByQName(element.getSchemaTypeName());
-                if (elementInfo.type == null 
+                attributeInfo.type = schemaCollection.getTypeByQName(element.getSchemaTypeName());
+                if (attributeInfo.type == null 
                     && !element.getSchemaTypeName()
                             .getNamespaceURI().equals(XmlSchemaConstants.XSD_NAMESPACE_URI))
{
                     XmlSchemaUtils.unsupportedConstruct("MISSING_TYPE", element.getSchemaTypeName()
                             .toString(), element.getQName(), element);
                 }
             }
-        } else if (elementInfo.type.getQName() != null
-            && XmlSchemaConstants.ANY_TYPE_QNAME.equals(elementInfo.type.getQName()))
{
-            elementInfo.anyType = true;
-        }
-    }
-
-    /**
-     * As a general rule, the JavaScript code is organized by types. The
-     * exception is global elements that have anonymous types. In those cases,
-     * the JavaScript code has its functions named according to the element.
-     * This method returns the QName for the type or element, accordingly. If a
-     * schema has a local element with an anonymous, complex, type, this will
-     * throw. This will need to be fixed.
-     * 
-     * @return the qname.
-     */
-    public QName getControllingName() {
-        if (type != null && type.getQName() != null) {
-            return type.getQName();
-        } else if (annotated instanceof XmlSchemaElement) {
-            XmlSchemaElement element = (XmlSchemaElement)annotated;
-            if (element.getQName() != null) {
-                return element.getQName();
-            }
+        } else if (attributeInfo.type.getQName() != null
+            && XmlSchemaConstants.ANY_TYPE_QNAME.equals(attributeInfo.type.getQName()))
{
+            attributeInfo.anyType = true;
         }
-        Message message = new Message("IMPOSSIBLE_GLOBAL_ITEM", LOG, XmlSchemaUtils
-            .cleanedUpSchemaSource(annotated));
-        LOG.severe(message.toString());
-        throw new UnsupportedConstruct(message);
     }
 
     /**
@@ -254,17 +239,13 @@
      * @return Returns the defaultValue.
      */
     public String getDefaultValue() {
+        if (defaultValue == null && fixedValue != null) {
+            return fixedValue;
+        }
         return defaultValue;
     }
 
     /**
-     * @param defaultValue The defaultValue to set.
-     */
-    public void setDefaultValue(String defaultValue) {
-        this.defaultValue = defaultValue;
-    }
-
-    /**
      * True if this describes a global, named, attribute.
      * 
      * @return
@@ -280,4 +261,20 @@
     public void setFixedValue(String fixedValue) {
         this.fixedValue = fixedValue;
     }
+
+    public boolean isArray() {
+        return false;
+    }
+
+    public boolean isNillable() {
+        return false;
+    }
+
+    public boolean isOptional() {
+        return !use.equals(new XmlSchemaUse(BlockConstants.REQUIRED));
+    }
+
+    public void setDefaultValue(String value) {
+        this.defaultValue = value;
+    }
 }

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties?rev=709640&r1=709639&r2=709640&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
Fri Oct 31 20:48:57 2008
@@ -32,3 +32,4 @@
 MISSING_TYPE=Type {0} is missing from the WSDL schema for element {1}. {2}
 ATTRIBUTE_DANGLING_REFERENCE=Attribute {0} refers to undefined attribute {1}.
 ELEMENT_DANGLING_REFERENCE= Element {0} refers to undefined element {1}.
+UNSUPPORTED_ATTRIBUTE_ITEM= Unsupported {0} in {1}.

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java?rev=709640&r1=709639&r2=709640&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/ParticleInfo.java
Fri Oct 31 20:48:57 2008
@@ -37,7 +37,7 @@
  * All the information needed to create the JavaScript for an Xml Schema element
  * or xs:any.
  */
-public final class ParticleInfo {
+public final class ParticleInfo implements ItemInfo {
     private static final Logger LOG = LogUtils.getL7dLogger(ParticleInfo.class);
     private XmlSchemaParticle particle;
     private String javascriptName;

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/UnsupportedConstruct.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/UnsupportedConstruct.java?rev=709640&r1=709639&r2=709640&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/UnsupportedConstruct.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/UnsupportedConstruct.java
Fri Oct 31 20:48:57 2008
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.javascript;
 
+import java.util.logging.Logger;
+
 import org.apache.cxf.common.i18n.Message;
 
 /**
@@ -32,10 +34,19 @@
     public UnsupportedConstruct(String explanation) {
         super(explanation);
     }
+    
+    public UnsupportedConstruct(Logger logger, String messageKey, Object...args) {
+        super(new Message(messageKey, logger, args).toString());
+        
+    }
 
     public UnsupportedConstruct(Throwable cause) {
         super(cause);
     }
+    
+    public UnsupportedConstruct(Throwable cause, Logger logger, String messageKey, Object...args)
{
+        super(new Message(messageKey, logger, args).toString(), cause);
+    }
 
     public UnsupportedConstruct(String explanation, Throwable cause) {
         super(explanation, cause);

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java?rev=709640&r1=709639&r2=709640&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
Fri Oct 31 20:48:57 2008
@@ -41,6 +41,7 @@
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaForm;
 import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
 import org.apache.ws.commons.schema.XmlSchemaParticle;
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaType;
@@ -137,6 +138,24 @@
         return sequence;
     }
     
+    public static XmlSchemaObjectCollection getContentAttributes(XmlSchemaComplexType type)
{
+        XmlSchemaContentModel model = type.getContentModel();
+        if (model == null) {
+            return null;
+        }
+        XmlSchemaContent content = model.getContent();
+        if (content == null) {
+            return null;
+        }
+        if (!(content instanceof XmlSchemaComplexContentExtension)) {
+            return null;
+        }
+
+        //TODO: the anyAttribute case.
+        XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)content;
+        return ext.getAttributes();
+    }
+    
     public static List<XmlSchemaObject> getContentElements(XmlSchemaComplexType type,

                                                            SchemaCollection collection) {
         List<XmlSchemaObject> results = new ArrayList<XmlSchemaObject>();
@@ -159,7 +178,30 @@
             }
             return results;
         }
-
+    }
+    
+    public static List<XmlSchemaAnnotated> 
+    getContentAttributes(XmlSchemaComplexType type, SchemaCollection collection) {
+        List<XmlSchemaAnnotated> results = new ArrayList<XmlSchemaAnnotated>();
+        QName baseTypeName = getBaseType(type);
+        if (baseTypeName != null) {
+            XmlSchemaComplexType baseType = (XmlSchemaComplexType)collection.getTypeByQName(baseTypeName);
+            // recurse onto the base type ...
+            results.addAll(getContentAttributes(baseType, collection));
+            // and now process our sequence.
+            XmlSchemaObjectCollection extAttrs = getContentAttributes(type);
+            for (int i = 0; i < extAttrs.getCount(); i++) {
+                results.add((XmlSchemaAnnotated)extAttrs.getItem(i));
+            }
+            return results;
+        } else {
+            // no base type, the simple case.
+            XmlSchemaObjectCollection attrs = type.getAttributes();
+            for (int i = 0; i < attrs.getCount(); i++) {
+                results.add((XmlSchemaAnnotated)attrs.getItem(i));
+            }
+            return results;
+        } 
     }
     
     public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) {

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=709640&r1=709639&r2=709640&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Fri Oct 31 20:48:57 2008
@@ -30,6 +30,8 @@
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.common.xmlschema.XmlSchemaTools;
+import org.apache.cxf.javascript.AttributeInfo;
+import org.apache.cxf.javascript.ItemInfo;
 import org.apache.cxf.javascript.JavascriptUtils;
 import org.apache.cxf.javascript.NameManager;
 import org.apache.cxf.javascript.NamespacePrefixAccumulator;
@@ -38,6 +40,7 @@
 import org.apache.cxf.javascript.XmlSchemaUtils;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaAnnotated;
 import org.apache.ws.commons.schema.XmlSchemaAny;
 import org.apache.ws.commons.schema.XmlSchemaAttribute;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
@@ -180,6 +183,7 @@
         accessors = new StringBuilder();
         utils = new JavascriptUtils(code);
         List<XmlSchemaObject> items = XmlSchemaUtils.getContentElements(type, xmlSchemaCollection);
+        List<XmlSchemaAnnotated> attrs = XmlSchemaUtils.getContentAttributes(type,
xmlSchemaCollection);
 
         final String elementPrefix = "this._";
 
@@ -191,22 +195,31 @@
         // to assist in debugging we put a type property into every object.
         utils.appendLine("this.typeMarker = '" + typeObjectName + "';");
         for (XmlSchemaObject thing : items) {
-            constructOneElement(type, elementPrefix, typeObjectName, thing);
+            ParticleInfo itemInfo = ParticleInfo.forLocalItem(thing, 
+                                                              schemaInfo.getSchema(),
+                                                              xmlSchemaCollection, 
+                                                              prefixAccumulator, 
+                                                              type.getQName()); 
+            constructOneItem(type, elementPrefix, typeObjectName, itemInfo);
+        }
+        
+        for (XmlSchemaAnnotated thing : attrs) {
+            AttributeInfo itemInfo = AttributeInfo.forLocalItem(thing, schemaInfo.getSchema(),
+                                                                xmlSchemaCollection,
+                                                                prefixAccumulator,
+                                                                type.getQName());
+            constructOneItem(type, elementPrefix, typeObjectName, itemInfo);
         }
+        
         code.append("}\n\n");
         code.append(accessors.toString());
     }
 
-    private void constructOneElement(XmlSchemaComplexType type, 
-                                     final String elementPrefix, 
-                                     String typeObjectName, 
-                                     XmlSchemaObject thing) {
+    private void constructOneItem(XmlSchemaComplexType type, 
+                                  final String elementPrefix, 
+                                  String typeObjectName, 
+                                  ItemInfo itemInfo) {
 
-        ParticleInfo itemInfo = ParticleInfo.forLocalItem(thing, 
-                                                          schemaInfo.getSchema(),
-                                                          xmlSchemaCollection, 
-                                                          prefixAccumulator, 
-                                                          type.getQName()); 
             
         String accessorSuffix = StringUtils.capitalize(itemInfo.getJavascriptName());
 
@@ -224,14 +237,14 @@
             }
         }
 
-        if (XmlSchemaUtils.isParticleOptional(itemInfo.getParticle())) {
+        if (itemInfo.isOptional()) {
             accessors.append("// - optional element\n");
         } else {
             accessors.append("// - required element\n");
 
         }
 
-        if (XmlSchemaUtils.isParticleArray(itemInfo.getParticle())) {
+        if (itemInfo.isArray()) {
             accessors.append("// - array\n");
 
         }
@@ -253,10 +266,9 @@
                          + " = value;}\n\n");
         accessors.append(setFunctionProperty + " = " + accessorName + ";\n");
 
-        if (XmlSchemaUtils.isParticleOptional(itemInfo.getParticle())
-            || (itemInfo.isNillable() && !XmlSchemaUtils.isParticleArray(itemInfo.getParticle())))
{
+        if (itemInfo.isOptional() || (itemInfo.isNillable() && !itemInfo.isArray()))
{
             utils.appendLine("this._" + itemInfo.getJavascriptName() + " = null;");
-        } else if (XmlSchemaUtils.isParticleArray(itemInfo.getParticle())) {
+        } else if (itemInfo.isArray()) {
             utils.appendLine("this._" + itemInfo.getJavascriptName() + " = [];");
         } else if (itemInfo.isAny() || itemInfo.getType() instanceof XmlSchemaComplexType)
{
             // even for required complex elements, we leave them null.



Mime
View raw message