The following comment has been added to this issue:

     Author: Matt Raible
    Created: Tue, 21 Jan 2003 5:58 PM
       Body:
Maybe some *real* patch files will help get this committed ;-)

Index: xdoclet/modules/apache/src/META-INF/xtags.xml
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/modules/apache/src/META-INF/xtags.xml,v
retrieving revision 1.10
diff -u -r1.10 xtags.xml
--- xdoclet/modules/apache/src/META-INF/xtags.xml       8 Sep 2002 01:51:07 -0000      
 1.10
+++ xdoclet/modules/apache/src/META-INF/xtags.xml       22 Jan 2003 04:56:26 -0000
@@ -108,6 +108,9 @@
           <condition-parameter>javax.ejb.EntityBean</condition-parameter>
         </condition>
         <condition type="type">
+          <condition-parameter>java.lang.Object</condition-parameter>
+        </condition>
+        <condition type="type">
           <condition-parameter>org.apache.struts.action.Action</condition-parameter>
         </condition>
       </condition>
@@ -122,7 +125,10 @@
         <condition type="and">
           <condition type="class"/>
           <condition type="type">
-            <condition-parameter>javax.ejb.EntityBean"</condition-parameter>
+            <condition-parameter>javax.ejb.EntityBean</condition-parameter>
+          </condition>
+          <condition type="type">
+            <condition-parameter>java.lang.Object</condition-parameter>
           </condition>
         </condition>
         <parameter type="text">
@@ -166,6 +172,9 @@
           <condition type="method"/>
           <condition type="type">
             <condition-parameter>javax.ejb.EntityBean</condition-parameter>
+          </condition>
+          <condition type="type">
+            <condition-parameter>java.lang.Object</condition-parameter>
           </condition>
         </condition>
         <parameter type="text">


Index: 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java,v
retrieving revision 1.9
diff -u -r1.9 StrutsFormTagsHandler.java
--- 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java 2 
Oct 2002 17:11:31 -0000       1.9
+++ 
+xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java 
+22 Jan 2003 04:57:45 -0000
@@ -115,7 +115,17 @@
         String formName = currentTag.getAttributeValue("name");
 
         if (formName == null || formName.trim().length() == 0) {
-            return Introspector.decapitalize(getEjbNameFor(getCurrentClass()) + 
"Form");
+            formName = Introspector.decapitalize(getEjbNameFor(getCurrentClass()) + 
+"Form");
+
+            int packageExists = formName.indexOf(getCurrentPackage().toString());
+
+            if (packageExists > -1) {
+                // package name still exists, chop it off
+                return 
+Introspector.decapitalize(getStrutsFormClassName(getCurrentClass()));
+            }
+            else {
+                return Introspector.decapitalize(getEjbNameFor(getCurrentClass()) + 
+"Form");
+            }
         }
         else {
             return Introspector.decapitalize(getEjbNameFor(getCurrentClass()) + '.' + 
formName);
@@ -156,8 +166,8 @@
                 setCurrentMethod(j.next());
                 // we are interested in persistent methods only
                 if (MethodTagsHandler.isGetter(getCurrentMethod().getName()) &&
-                    !foundFields.containsKey(getCurrentMethod().getName()) &&
-                    PersistentTagsHandler.isPersistentField(getCurrentMethod())
+                    !foundFields.containsKey(getCurrentMethod().getName())
+                //PersistentTagsHandler.isPersistentField(getCurrentMethod())
                     ) {
                     if (useMethodInForm(getCurrentMethod())) {
                         if (log.isDebugEnabled()) {


Index: 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java,v
retrieving revision 1.8
diff -u -r1.8 StrutsFormSubTask.java
--- 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java 11 
Sep 2002 09:07:44 -0000      1.8
+++ 
+xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java 
+22 Jan 2003 04:58:24 -0000
@@ -51,6 +51,7 @@
         setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
         setDestinationFile(getStrutsFormClassPattern() + ".java");
         addOfType("javax.ejb.EntityBean");
+        addOfType("java.lang.Object");
     }
 
     /**


---------------------------------------------------------------------
View the issue:

  http://opensource.atlassian.com/projects/xdoclet/secure/ViewIssue.jspa?key=XDT-211


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-211
    Summary: Improve the <strutsform> task so it can be applied to any POJO
       Type: Improvement

     Status: Assigned
   Priority: Minor

 Time Spent: Unknown
   Estimate: 0 minutes

    Project: XDoclet
  Component: Apache Module
    Fix For: 1.2 Beta 3
   Versions:
             1.2 Beta 2

   Assignee: xdoclet-devel (Use for new issues)
   Reporter: Matt Raible

    Created: Tue, 24 Dec 2002 4:44 AM
    Updated: Wed, 8 Jan 2003 4:51 PM

Description:
I did a little manipulation tonight of the code and can now generate a Struts Form 
from a POJO (i.e. for use with Hibernate).  My hacks are ugly, but they will work for 
me.  I hope we can figure out a way to retain existing functionality, but add this 
functionality to the codebase.  I think the best thing would be use the existing 
@struts.form tag, but somehow allow it to be a subtask of many - maybe of hibernate or 
something.  Right now it still has to be a subtask of ejb, and I don't know how to 
allow it as a subtask of many.  I tried to do a "make patch" with TortoiseCVS, but it 
just keeps giving me an error.

Here's the files I changed:

Index: xdoclet/modules/apache/src/META-INF/xtags.xml
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/modules/apache/src/META-INF/xtags.xml,v
retrieving revision 1.10
diff -r1.10 xtags.xml
110a111,113
>           <condition-parameter>java.lang.Object</condition-parameter>
>         </condition>
>         <condition type="type">
125c128,131
<             <condition-parameter>javax.ejb.EntityBean"</condition-parameter>
---
>             <condition-parameter>javax.ejb.EntityBean</condition-parameter>
>           </condition>
>           <condition type="type">
>             
> <condition-parameter>java.lang.Object</condition-parameter>
168a175,177
>           </condition>
>           <condition type="type">
>             
> <condition-parameter>java.lang.Object</condition-parameter>


Index: 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java,v
retrieving revision 1.9
diff -r1.9 StrutsFormTagsHandler.java
159,160c159,160
<                     !foundFields.containsKey(getCurrentMethod().getName()) &&
<                     PersistentTagsHandler.isPersistentField(getCurrentMethod())
---
>                     !foundFields.containsKey(getCurrentMethod().getName())
>                 
> //PersistentTagsHandler.isPersistentField(getCurrentMethod())


Index: 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java,v
retrieving revision 1.8
diff -r1.8 StrutsFormSubTask.java
53a54
>         addOfType("java.lang.Object");

I also have my own template that removes check for 
<XDtEjbDataObj:ifIsWithDataContainer>.

Any advice on a better way of doing this is appreciated.  I've also thought of just 
generating the XML fragment for a DynaActionForm from a POJO - that might be a cool 
way to do things.  It'd be tough to retain validator settings though doing that.

Thanks,

Matt


---------------------------------------------------------------------
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/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: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to