Attached is a patch which fixes a bug when generating source for a
group ref when the ref points to a group mapped to a different
package using namespace mapping.

Regards,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             [EMAIL PROTECTED] | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------
Index: src/main/org/exolab/castor/builder/MemberFactory.java
===================================================================
RCS file: /cvs/castor/castor/src/main/org/exolab/castor/builder/MemberFactory.java,v
retrieving revision 1.59
diff -u -r1.59 MemberFactory.java
--- src/main/org/exolab/castor/builder/MemberFactory.java       18 Jan 2002 04:08:10 
-0000      1.59
+++ src/main/org/exolab/castor/builder/MemberFactory.java       10 Feb 2002 15:11:34 
+-0000
@@ -514,13 +514,17 @@
         if (groupClass == null) {
             // Java class name is group name or.
             className = JavaNaming.toJavaClassName(groupName);
+            if( group.getSchema() != null ) {
+                className = SourceGenerator.getQualifiedClassName(
+                    group.getSchema().getTargetNamespace(),className);
+            }
             xsType = new XSClass(new JClass(className));
         }
         else {
             className = groupClass.getName();
         }
 
-        String fieldName = JavaNaming.toJavaMemberName(className);
+        String fieldName = JavaNaming.toJavaMemberName(groupName);
         if (fieldName.charAt(0) != '_')
             fieldName = "_"+fieldName;
 
Index: src/main/org/exolab/castor/builder/SourceFactory.java
===================================================================
RCS file: /cvs/castor/castor/src/main/org/exolab/castor/builder/SourceFactory.java,v
retrieving revision 1.83
diff -u -r1.83 SourceFactory.java
--- src/main/org/exolab/castor/builder/SourceFactory.java       25 Jan 2002 23:54:38 
-0000      1.83
+++ src/main/org/exolab/castor/builder/SourceFactory.java       10 Feb 2002 15:11:34 
+-0000
@@ -1537,6 +1537,7 @@
                     if (tmp.getContentModelGroup() != null) {
                           if (tmp.getName() != null) {
                               modelgroup.setName(tmp.getName());
+                              modelgroup.setSchema(tmp.getSchema());
                               //create the field info for the element
                               //that is referring to a model group in order
                               //not to loose the Particle information
Index: src/main/org/exolab/castor/xml/schema/Group.java
===================================================================
RCS file: /cvs/castor/castor/src/main/org/exolab/castor/xml/schema/Group.java,v
retrieving revision 1.16
diff -u -r1.16 Group.java
--- src/main/org/exolab/castor/xml/schema/Group.java    8 Dec 2001 03:30:25 -0000      
 1.16
+++ src/main/org/exolab/castor/xml/schema/Group.java    10 Feb 2002 15:11:35 -0000
@@ -442,4 +442,12 @@
         _parent = parent;
     } //-- setParent
 
-} //-- Group
\ No newline at end of file
+    /**
+     * Returns the schema that contains this modelGroup definition
+     */
+    public Schema getSchema() {
+       return null;
+    }
+
+} //-- Group
+
Index: src/main/org/exolab/castor/xml/schema/ModelGroup.java
===================================================================
RCS file: /cvs/castor/castor/src/main/org/exolab/castor/xml/schema/ModelGroup.java,v
retrieving revision 1.10
diff -u -r1.10 ModelGroup.java
--- src/main/org/exolab/castor/xml/schema/ModelGroup.java       17 Oct 2001 19:06:28 
-0000      1.10
+++ src/main/org/exolab/castor/xml/schema/ModelGroup.java       10 Feb 2002 15:11:35 
+-0000
@@ -201,4 +201,12 @@
        return _schema;
     }
 
-} //-- Group
\ No newline at end of file
+    /**
+     * Sets the schema that contains this modelGroup definition
+     */
+    public void setSchema(Schema schema) {
+       _schema = schema;
+    }
+
+} //-- Group
+

Reply via email to