User: ko5tik  
  Date: 02/10/03 07:34:25

  Modified:    modules/ejb/src/xdoclet/modules/ejb/entity
                        ValueObjectTagsHandler.java
  Log:
  fix for XDT-23, obtain value object name from
  ejb.bean tag
  
  Revision  Changes    Path
  1.13      +35 -10    
xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java
  
  Index: ValueObjectTagsHandler.java
  ===================================================================
  RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/entity/ValueObjectTagsHandler.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -w -r1.12 -r1.13
  --- ValueObjectTagsHandler.java       9 Sep 2002 15:57:46 -0000       1.12
  +++ ValueObjectTagsHandler.java       3 Oct 2002 14:34:24 -0000       1.13
  @@ -26,7 +26,7 @@
    * @author               Vincent Harcq ([EMAIL PROTECTED])
    * @created              13. juni 2002
    * @xdoclet.taghandler   namespace="EjbValueObj"
  - * @version              $Revision: 1.12 $
  + * @version              $Revision: 1.13 $
    */
   public class ValueObjectTagsHandler
        extends EjbTagsHandler
  @@ -130,7 +130,7 @@
       public static String getCurrentValueObjectClass(XClass clazz, XTag tag)
            throws XDocletException
       {
  -        String name = tag.getAttributeValue("name");
  +        String name = getCurrentValueObjectName(tag);
   
           String _currentValueObjectClass;
   
  @@ -151,10 +151,34 @@
        *
        * @param tag  Describe what the parameter does
        * @return     The CurrentValueObjectName value
  +     * @exception XDocletException
        */
  -    public static String getCurrentValueObjectName(XTag tag)
  +    public static String getCurrentValueObjectName(XTag tag) throws XDocletException
       {
  -        return tag.getAttributeValue("name");
  +        String name = tag.getAttributeValue("name");
  +
  +        if (name != null) {
  +            return name;
  +        }
  +
  +        // name is null, must look whether it's defined in current class level
  +        XClass clazz = getCurrentClass();
  +
  +        while (clazz != null) {
  +            for (TagIterator i = 
XCollections.tagIterator(clazz.getDoc().getTags(tag.getName())); i.hasNext(); ) {
  +                if (tag.equals(i.next())) {
  +                    // ok, we are defined here return defined ejb name
  +                    name = EjbTagsHandler.getEjbNameFor(clazz);
  +                    if (name == null) {
  +                        throw new XDocletException("unable to determine value 
object name in class " + clazz.getName());
  +                    }
  +                    return name;
  +                }
  +            }
  +            // not found on current level. try with superclass
  +            clazz = clazz.getSuperclass();
  +        }
  +        throw new XDocletException("class defining value object is not EJB");
       }
   
       /**
  @@ -162,10 +186,11 @@
        *
        * @param tag  Describe what the parameter does
        * @return     The CurrentValueObjectAttribute value
  +     * @exception XDocletException
        */
  -    public static String getCurrentValueObjectAttribute(XTag tag)
  +    public static String getCurrentValueObjectAttribute(XTag tag) throws 
XDocletException
       {
  -        String name = tag.getAttributeValue("name");
  +        String name = getCurrentValueObjectName(tag);
   
           String _currentValueObjectAttribute;
   
  
  
  


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to