Update of /cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32694/modules/ejb/src/xdoclet/modules/ejb/entity

Modified Files:
        ValueObjectTagsHandler.java ValueObjectSubTask.java 
Log Message:
using the same algorithm for a value object's  implements and extends to 
prevent problems when having multiple value-objects for the same entity bean 
(XDT-691)

Index: ValueObjectTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** ValueObjectTagsHandler.java 5 Apr 2005 11:05:34 -0000       1.26
--- ValueObjectTagsHandler.java 9 Apr 2005 07:28:54 -0000       1.27
***************
*** 220,223 ****
--- 220,230 ----
      }
  
+     public static String getCurrentValueObjectExtends(XTag tag)
+     {
+         String toImplement = tag.getAttributeValue("extends");
+ 
+         return toImplement != null ? toImplement : "java.lang.Object";
+     }
+ 
      /**
       * Gets the SubTask attribute of the ValueObjectTagsHandler class
***************
*** 381,410 ****
      public String extendsFrom(Properties attributes) throws XDocletException
      {
!         String extendsFrom = null;
! 
!         // get the value object's name we are checking extendsFrom for
!         //
!         String valueObjectName = attributes.getProperty("valueobject", 
valueObjectName());
! 
!         // go through all the value-object tags until we find the one for our 
value object
!         //
!         XClass currentClass = getCurrentClass();
!         Collection valueObjectTags = 
currentClass.getDoc().getTags("ejb:value-object");
! 
!         for (Iterator i = valueObjectTags.iterator();
!             i.hasNext() && extendsFrom == null; ) {
!             XTag tag = (XTag) i.next();
! 
!             String attr = tag.getAttributeValue("extends");
! 
!             if (valueObjectName.equals(tag.getAttributeValue("name")) &&
!                 attr != null) {
!                 // only extend if our value-object has an extends parameter
!                 //
!                 extendsFrom = attr;
!             }
!         }
! 
!         return extendsFrom != null ? extendsFrom : "java.lang.Object";
      }
  
--- 388,392 ----
      public String extendsFrom(Properties attributes) throws XDocletException
      {
!         return getSubTask().getCurrentValueObjectExtends();
      }
  

Index: ValueObjectSubTask.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectSubTask.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** ValueObjectSubTask.java     15 Aug 2004 09:56:35 -0000      1.14
--- ValueObjectSubTask.java     9 Apr 2005 07:28:54 -0000       1.15
***************
*** 39,42 ****
--- 39,43 ----
      private static String currentValueObjectMatch;
      private static String currentValueObjectImplements;
+     private static String currentValueObjectExtends;
  
      /**
***************
*** 85,88 ****
--- 86,94 ----
      }
  
+     public static String getCurrentValueObjectExtends()
+     {
+         return currentValueObjectExtends;
+     }
+ 
      /**
       * Gets the CurrentValueObjectName attribute of the ValueObjectSubTask 
class
***************
*** 221,224 ****
--- 227,231 ----
              currentValueObjectMatch = 
ValueObjectTagsHandler.getCurrentValueObjectMatch(tag);
              currentValueObjectImplements = 
ValueObjectTagsHandler.getCurrentValueObjectImplements(tag);
+             currentValueObjectExtends = 
ValueObjectTagsHandler.getCurrentValueObjectExtends(tag);
              super.generateForClass(clazz);
          }



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
xdoclet-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to