From: <one...@us...> - 2002-11-11 01:25:11
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/reflect In directory usw-pr-cvs1:/tmp/cvs-serv27549/cirrus/hibernate/tools/reflect Modified Files: MappingByReflection.java ReflectedClass.java ReflectedProperty.java Log Message: changes / bugfixes to MapGenerator tool Index: MappingByReflection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/reflect/MappingByReflection.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** MappingByReflection.java 19 Sep 2002 08:26:45 -0000 1.14 --- MappingByReflection.java 11 Nov 2002 01:25:07 -0000 1.15 *************** *** 158,162 **** /** how low will you go? the depth of component nesting followed */ ! protected int maxDepth = 3; /** candidate UID property names; presence of one of these with a --- 158,162 ---- /** how low will you go? the depth of component nesting followed */ ! protected int maxDepth = 0; /** candidate UID property names; presence of one of these with a *************** *** 222,226 **** private Vector roots; ! private char[] prefix = " ".toCharArray(); /** the only MappingByReflection constructor --- 222,226 ---- private Vector roots; ! private char[] prefix = StringHelper.repeat("\t", 100).toCharArray(); /** the only MappingByReflection constructor *************** *** 462,466 **** */ protected void emitPrefix( int n ) { ! int e = n * 2; // configurable? if( e > prefix.length ) e = prefix.length; buf.append( prefix, 0, e ); --- 462,466 ---- */ protected void emitPrefix( int n ) { ! int e = n * 1; // configurable? if( e > prefix.length ) e = prefix.length; buf.append( prefix, 0, e ); Index: ReflectedClass.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/reflect/ReflectedClass.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ReflectedClass.java 16 Sep 2002 15:19:39 -0000 1.7 --- ReflectedClass.java 11 Nov 2002 01:25:07 -0000 1.8 *************** *** 7,10 **** --- 7,12 ---- import java.util.Vector; + import cirrus.hibernate.helpers.StringHelper; + /** a ReflectedClass is created by MappingByReflection instances for * every class encountered, from map.addClass(), while chasing the *************** *** 111,114 **** --- 113,117 ---- this.buf = map.buf; String name = clazz.getName(); + String shortName = StringHelper.unqualify(name); // debug... map.emitPrefix(level);; *************** *** 122,131 **** .append("\" table=\"") .append(map.tableNameFor(name)) ! .append((subs.size() > 0) ? "\" discriminator=\"subclass" : "") .append("\">\n"); // first find the uid if( uid == null ) { // report error ! map.emitPrefix(level);; buf.append("<!-- NO UID!? class=\"") .append(name) --- 125,134 ---- .append("\" table=\"") .append(map.tableNameFor(name)) ! .append((subs.size() > 0) ? "\" discriminator-value=\"" + shortName : "") .append("\">\n"); // first find the uid if( uid == null ) { // report error ! map.emitPrefix(level); buf.append("<!-- NO UID!? class=\"") .append(name) *************** *** 134,137 **** --- 137,145 ---- uid.getUidXML(level+1, buf); } + //the discriminator element + if ( subs.size() > 0 ) { + map.emitPrefix(level+1); + buf.append("<discriminator column=\"subclass\" type=\"string\"/>\n"); + } // now the properties already classified by heuristic Enumeration ps = props.elements(); *************** *** 211,215 **** while( ps.hasMoreElements() ) { ReflectedProperty prop = (ReflectedProperty )ps.nextElement(); ! prop.getXML( level, buf ); } // NOT the subclasses --- 219,223 ---- while( ps.hasMoreElements() ) { ReflectedProperty prop = (ReflectedProperty )ps.nextElement(); ! prop.getXML( level+1, buf ); } // NOT the subclasses Index: ReflectedProperty.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/reflect/ReflectedProperty.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ReflectedProperty.java 5 Oct 2002 09:33:42 -0000 1.14 --- ReflectedProperty.java 11 Nov 2002 01:25:07 -0000 1.15 *************** *** 131,135 **** protected void emitPCommentStr( int level, String comment, String name, String tynm ) { ! map.emitPrefix(level); buf.append("<!-- ") .append(comment) --- 131,135 ---- protected void emitPCommentStr( int level, String comment, String name, String tynm ) { ! /*map.emitPrefix(level); buf.append("<!-- ") .append(comment) *************** *** 138,142 **** .append("\" type=\"") .append(tynm) ! .append("\" -->\n"); } --- 138,142 ---- .append("\" type=\"") .append(tynm) ! .append("\" -->\n");*/ } |