Message: A new issue has been created in JIRA.
--------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/xdoclet/browse/XDT-1355 Here is an overview of the issue: --------------------------------------------------------------------- Key: XDT-1355 Summary: jdodoclet could default table & column names to class & field names Type: Improvement Status: Open Priority: Minor Original Estimate: 1 hour Time Spent: Unknown Remaining: 1 hour Project: XDoclet Components: JDO Module Versions: 1.2.3 Assignee: xdoclet-devel (Use for new issues) Reporter: adriaan peens-hough Created: Thu, 21 Apr 2005 3:08 AM Updated: Thu, 21 Apr 2005 3:08 AM Description: the JDO spec doesn't specify defaults for table & column names if it's not explicitly set with table="X" and column="Y" attributes. developers might reasonably expect default names that correspond to the field & class names, although any given JDO implementation may have a different strategy. i propose adding a new attribute to the jdodoclet task, named "defaultNames" which, when set to "true", will result in all table and column names which haven't been explicitly specified, to be defaulted to the (simple) class & field names. i have already implemented this proposal, relevant code & diffs follow (using gnu diff until i get cvs going). regards adriaan peens-hough --- JdoDocletTask.java 2005-04-16 15:43:56.265625000 +0200 +++ JdoDocletTask.java 2005-04-19 13:18:18.453125000 +0200 @@ -25,6 +25,11 @@ private String jdoSpec = JdoSpecVersion.JDO_1_0; /** + * Defaults to false. + */ + private boolean defaultNames = false; + + /** * Gets the JdoSpec attribute of the JdoDocletTask object * * @return The JdoSpec value @@ -45,6 +50,28 @@ this.jdoSpec = jdoSpec.getValue(); } + /** + * Gets the defaultNames attribute of the JdoDocletTask object. + * + * @return The defaultNames value + */ + public boolean getDefaultNames() + { + return defaultNames; + } + + /** + * Sets whether or not to generate table="className" and column="fieldName" metadata by default. + * Default value is "false". + * + * @param defaultNames + * @ant.not-required. + */ + public void setDefaultNames(boolean defaultNames) + { + this.defaultNames = defaultNames; + } + protected void validateOptions() throws BuildException { super.validateOptions(); --- jdo_xml.xdt 2005-04-16 01:02:50.000000000 +0200 +++ jdo_xml.xdt 2005-04-19 14:14:42.734375000 +0200 @@ -28,6 +28,13 @@ <XDtClass:ifHasClassTag tagName="jdo.persistence-capable" paramName="table" superclasses="false"> table="<XDtClass:classTagValue tagName="jdo.persistence-capable" paramName="table"/>" </XDtClass:ifHasClassTag> + <XDtConfig:ifConfigParamEquals paramName="defaultNames" value="true"> + <XDtClass:ifDoesntHaveClassTag tagName="jdo.persistence-capable" paramName="table" superclasses="false"> + <XDtClass:ifDoesntHaveClassTag tagName="jdo.persistence-capable" paramName="embedded-only" superclasses="false"> + table="<XDtClass:className/>" + </XDtClass:ifDoesntHaveClassTag> + </XDtClass:ifDoesntHaveClassTag> + </XDtConfig:ifConfigParamEquals> <XDtConfig:ifConfigParamEquals paramName="jdospec" value="2.0"> <XDtClass:ifHasClassTag tagName="jdo.persistence-capable" paramName="detachable" superclasses="false"> detachable="<XDtClass:classTagValue tagName="jdo.persistence-capable" paramName="detachable" values="true,false"/>" --- jdo_xml.package_class_field.xdt 2005-04-16 01:02:50.000000000 +0200 +++ jdo_xml.package_class_field.xdt 2005-04-19 19:01:21.468750000 +0200 @@ -43,6 +43,16 @@ <XDtField:ifHasFieldTag tagName="jdo.field" paramName="column"> column="<XDtField:fieldTagValue tagName="jdo.field" paramName="column"/>" </XDtField:ifHasFieldTag> + <XDtConfig:ifConfigParamEquals paramName="defaultNames" value="true"> + <XDtField:ifDoesntHaveFieldTag tagName="jdo.field" paramName="column"> + <XDtField:ifDoesntHaveFieldTag tagName="jdo.field" paramName="embedded"> + column="<XDtField:fieldName/>" + </XDtField:ifDoesntHaveFieldTag> + <XDtField:ifFieldTagValueEquals tagName="jdo.field" paramName="embedded" value="false"> + column="<XDtField:fieldName/>" + </XDtField:ifFieldTagValueEquals> + </XDtField:ifDoesntHaveFieldTag> + </XDtConfig:ifConfigParamEquals> <XDtField:ifHasFieldTag tagName="jdo.field" paramName="delete-action"> delete-action="<XDtField:fieldTagValue tagName="jdo.field" paramName="delete-action" values="restrict,cascade,null,default,none"/>" </XDtField:ifHasFieldTag> --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ xdoclet-devel mailing list xdoclet-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-devel