You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/06/19 22:47:37 UTC

svn commit: r669684 - /myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java

Author: lu4242
Date: Thu Jun 19 13:47:37 2008
New Revision: 669684

URL: http://svn.apache.org/viewvc?rev=669684&view=rev
Log:
fix add initValidatorAncestry to validators

Modified:
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java?rev=669684&r1=669683&r2=669684&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java Thu Jun 19 13:47:37 2008
@@ -174,6 +174,7 @@
                 continue;
             }
             // TODO: why is there no check for Converter class existence here??
+            // ANS: there is no automatic generation of converter class.
             
             // Check if the tag class java file exists in the source dirs
             if (isTagClassMissing(converter.getTagClass(), sourceDirs))
@@ -190,6 +191,8 @@
             {
                 continue;
             }
+            initValidatorAncestry(processedClasses, model, validator);
+            
             //Check if the validator class file exists
             if (!IOUtils.existsSourceFile(StringUtils.replace(
                     validator.getClassName(),".","/")+".java", sourceDirs)){
@@ -557,6 +560,26 @@
         }
     }
 
+    /**
+     * Same as initComponentAncestry but for validators.
+     */
+    private void initValidatorAncestry(Map javaClassByName, Model model, ClassMeta modelItem)
+    {
+        JavaClass clazz = (JavaClass) javaClassByName.get(modelItem.getSourceClassName());
+        JavaClass parentClazz = clazz.getSuperJavaClass();
+        while (parentClazz != null)
+        {
+            ValidatorMeta parentComponent = model
+                    .findValidatorByClassName(parentClazz.getFullyQualifiedName());
+            if (parentComponent != null)
+            {
+                modelItem.setParentClassName(parentComponent.getClassName());
+                break;
+            }
+            parentClazz = parentClazz.getSuperJavaClass();
+        }
+    }    
+
     private void processConverter(Map props, AbstractJavaEntity ctx,
             JavaClass clazz, Model model)
     {