Update of /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19132/modules/jdo/src/xdoclet/modules/jdo
Modified Files: JdoObjectIdGeneratorTagsHandler.java JdoObjectIdGeneratorSubTask.java Log Message: bugfix: object id generation was confused if no package was defined in the object-id-class tag. Now, it uses the same package as the java source file and the default package (i.e. no package) seems to be functional, too. Index: JdoObjectIdGeneratorTagsHandler.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo/JdoObjectIdGeneratorTagsHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** JdoObjectIdGeneratorTagsHandler.java 9 Oct 2005 21:38:15 -0000 1.6 --- JdoObjectIdGeneratorTagsHandler.java 20 Oct 2006 03:50:55 -0000 1.7 *************** *** 143,146 **** --- 143,152 ---- } + public void ifNotObjectIdPackageEmpty(String template, Properties attributes) throws XDocletException + { + if (!"".equals(getObjectIdClassOrPackage(true))) + generate(template); + } + public void ifCurrentPrimaryKeyFieldIsPrimitive(String template, Properties attributes) throws XDocletException { Index: JdoObjectIdGeneratorSubTask.java =================================================================== RCS file: /cvsroot/xdoclet/xdoclet/modules/jdo/src/xdoclet/modules/jdo/JdoObjectIdGeneratorSubTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** JdoObjectIdGeneratorSubTask.java 29 Aug 2005 22:42:46 -0000 1.2 --- JdoObjectIdGeneratorSubTask.java 20 Oct 2006 03:50:55 -0000 1.3 *************** *** 80,83 **** --- 80,101 ---- throw new IllegalStateException("No objectid-class specified! This should be checked by matchesGenerationRules(...)!"); + if (objectIDClassWithPackage.indexOf('.') < 0) { + // there is no package defined => use the same package as the source file + String pakkage = clazz.getQualifiedName(); + + // check, whether the source class has a package + if (pakkage.lastIndexOf('.') < 0) + pakkage = ""; + else + pakkage = pakkage.substring(0, pakkage.lastIndexOf('.')); + + if ("".equals(pakkage)) + log.debug("The class " + clazz.getQualifiedName() + " does not specify a package in its @jdo.create-objectid-class tag and is in the default package (i.e. empty package). Will use the default package."); + else { + log.debug("The class " + clazz.getQualifiedName() + " does not specify a package in its @jdo.create-objectid-class tag. Will use package of source class: " + pakkage); + objectIDClassWithPackage = pakkage + '.' + objectIDClassWithPackage; + } + } + String res = objectIDClassWithPackage.replace('.', File.separatorChar) + ".java"; ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ xdoclet-devel mailing list xdoclet-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-devel