Update of 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17609/src/main/java/org/xdoclet/plugin/hibernate

Modified Files:
        Component.jelly HibernateMappingPlugin.java 
Log Message:
Fixed bug in component. Now component class is calculated not only from 
property class but also form 'class' attribute of 'component' tag

Index: HibernateMappingPlugin.java
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/HibernateMappingPlugin.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** HibernateMappingPlugin.java 15 Jun 2005 12:56:06 -0000      1.43
--- HibernateMappingPlugin.java 4 Jul 2005 12:34:15 -0000       1.44
***************
*** 169,172 ****
--- 169,191 ----
  
      /**
+      * Get list of properties for component class. Real class is calculated 
in following sequence.
+      * First tries to find class by its name if classname parameter is null 
or class not found
+      * @param componentClassName
+      * @param componentPropertyClass
+      * @return
+      */
+     public List getComponentProperties(String componentClassName, JavaClass 
componentPropertyClass) {
+         JavaClass componentClass;
+ 
+         if (componentClassName != null) {
+             componentClass = getMetadata(componentClassName);
+         } else {
+             componentClass = componentPropertyClass;
+         }
+ 
+         return getClassProperties(componentClass);
+     }
+ 
+     /**
       * Returns first argument wich is not empty or last argument if all are 
empty
       *
***************
*** 187,190 ****
--- 206,213 ----
       */
      public JavaClass getMetadata(final String className) {
+         if (className == null) {
+             throw new NullPointerException("Classname can't be null");
+         }
+ 
          JavaClass javaClass = (JavaClass) CollectionUtils.find(getMetadata(),
                  new Predicate() {
***************
*** 202,228 ****
      }
  
!     /**
!      * todo implement it correctly
       */
-     public Object getMetadata(Object metadata) {
-         if (metadata == null) {
-             throw new NullPointerException("Requested metadata cann't be 
null");
-         }
- 
-         final String originFileName = 
metadataProvider.getOriginalFileName(metadata);
- 
-         if (originFileName == null) {
-             throw new IllegalArgumentException("Original file of requested 
metadata can not be located by provider");
-         }
- 
-         return CollectionUtils.find(getMetadata(),
-             new Predicate() {
-                 public boolean evaluate(Object o) {
-                     String fn = metadataProvider.getOriginalFileName(o);
-                     return originFileName.equals(fn);
-                 }
-             });
-     }
- 
      /**
       * derive property name from metadata. strip / decapitalize
--- 225,246 ----
      }
  
!     /*
!        public Object getMetadata(Object metadata) {
!            if (metadata == null) {
!                throw new NullPointerException("Requested metadata can't be 
null");
!            }
!            final String originFileName = 
metadataProvider.getOriginalFileName(metadata);
!            if (originFileName == null) {
!                throw new IllegalArgumentException("Original file of requested 
metadata can not be located by provider");
!            }
!            return CollectionUtils.find(getMetadata(),
!                new Predicate() {
!                    public boolean evaluate(Object o) {
!                        String fn = metadataProvider.getOriginalFileName(o);
!                        return originFileName.equals(fn);
!                    }
!                });
!        }
       */
      /**
       * derive property name from metadata. strip / decapitalize

Index: Component.jelly
===================================================================
RCS file: 
/cvsroot/xdoclet-plugins/xdoclet-plugins/plugin-hibernate/src/main/java/org/xdoclet/plugin/hibernate/Component.jelly,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Component.jelly     22 Jun 2005 15:54:03 -0000      1.13
--- Component.jelly     4 Jul 2005 12:34:15 -0000       1.14
***************
*** 17,21 ****
                  <j:import uri="/Meta.jelly" inherit="true"/>
              </j:forEach>
!             <j:forEach var="property" 
items="${plugin.getClassProperties(property.type.javaClass)}">
                  <j:import uri="/HibernateProperties.jelly" inherit="true"/>
              </j:forEach>
--- 17,21 ----
                  <j:import uri="/Meta.jelly" inherit="true"/>
              </j:forEach>
!             <j:forEach var="property" 
items="${plugin.getComponentProperties(componentTag.class_, 
property.type.javaClass)}">
                  <j:import uri="/HibernateProperties.jelly" inherit="true"/>
              </j:forEach>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
xdoclet-plugins-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xdoclet-plugins-commits

Reply via email to