Author: rich
Date: Wed Mar 16 10:24:54 2005
New Revision: 157786

URL: http://svn.apache.org/viewcvs?view=rev&rev=157786
Log:
Minor code cleanup related to the XDoclet-compiler checkin from last night.  
Also, fixed an issue where a form bean that both extended FormData and 
implemented Validatable was not having its Validatable.validate() method called.

tests: netui bvt (WinXP)
BB: self (linux)


Removed:
    
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
Modified:
    
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
    
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
    
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseAnnotationProcessor.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FormData.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnyBeanActionForm.java

Modified: 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java?view=diff&r1=157785&r2=157786
==============================================================================
--- 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/AnnotationGrammar.java
 Wed Mar 16 10:24:54 2005
@@ -26,10 +26,10 @@
 
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.Iterator;
 
 
 /**

Modified: 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java?view=diff&r1=157785&r2=157786
==============================================================================
--- 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
 Wed Mar 16 10:24:54 2005
@@ -37,8 +37,10 @@
     public static final String VALIDATION_LOCALE_RULES_TAG_NAME = 
"ValidationLocaleRules";
     public static final String VALIDATION_BEAN_TAG_NAME = "ValidationBean";
     public static final String VALIDATABLE_PROPERTY_TAG_NAME = 
"ValidatableProperty";
+    public static final String VALIDATABLE_BEAN_TAG_NAME = "ValidatableBean";
     public static final String FORM_BEAN_TAG_NAME = "FormBean";
     public static final String ACTION_OUTPUT_TAG_NAME = "ActionOutput";
+    public static final String CONDITIONAL_FORWARD_TAG_NAME = 
"ConditionalForward";
     public static final String FACES_BACKING_TAG_NAME = "FacesBacking";
     public static final String COMMAND_HANDLER_TAG_NAME = "CommandHandler";
     public static final String RAISE_ACTION_TAG_NAME = "RaiseAction";
@@ -58,6 +60,7 @@
     public static final String VALIDATE_VALID_WHEN_TAG_NAME = 
"ValidateValidWhen";
     public static final String VALIDATE_CUSTOM_TAG_NAME = "ValidateCustomRule";
     public static final String MESSAGE_ARG_TAG_NAME = "MessageArg";
+    public static final String VALIDATE_CUSTOM_VARIABLE_TAG_NAME = 
"ValidateCustomVariable";
 
     public static final String BEGIN_ACTION_NAME = "begin";
     public static final String JPF_FILE_EXTENSION = "jpf";

Modified: 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseAnnotationProcessor.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseAnnotationProcessor.java?view=diff&r1=157785&r2=157786
==============================================================================
--- 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseAnnotationProcessor.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseAnnotationProcessor.java
 Wed Mar 16 10:24:54 2005
@@ -95,15 +95,28 @@
      */
     public void check()
     {
+        HashSet declsToCheck = new HashSet();
+        
+        //
+        // First, build up the Set of declarations to check.  We don't want 
any duplicates.
+        //
         for ( int i = 0; i < _atds.length; ++i )
         {
             AnnotationTypeDeclaration atd = _atds[i];
             Declaration[] decls = 
getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith( atd );
             for ( int j = 0; j < decls.length; j++ )
             {
-                Declaration decl = decls[j];
-                check( decl );
+                declsToCheck.add( decls[j] );
             }
+        }
+        
+        //
+        // Now, check the declarations.
+        //
+        for ( Iterator i = declsToCheck.iterator(); i.hasNext(); )
+        {
+            Declaration decl = ( Declaration ) i.next();
+            check( decl );
         }
     }
 

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FormData.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FormData.java?view=diff&r1=157785&r2=157786
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FormData.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FormData.java
 Wed Mar 16 10:24:54 2005
@@ -111,6 +111,14 @@
             }
         }
 
+        //
+        // If this bean implements our Validatable interface, run its validate 
method.
+        //
+        if ( bean instanceof Validatable )
+        {
+            ( ( Validatable ) bean ).validate( mapping, request, errors );
+        }
+        
         return errors;
     }
     

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java?view=diff&r1=157785&r2=157786
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/annotations/Jpf.java
 Wed Mar 16 10:24:54 2005
@@ -32,6 +32,27 @@
  */
 public interface Jpf
 {
+    public enum MultipartHandler
+    {
+        disabled,
+        memory,
+        disk
+    }
+    
+    public enum NavigateTo
+    {
+        currentPage,
+        previousPage,
+        previousAction,
+        page
+    }
+
+    public enum ValidatorVersion
+    {
+        oneZero,
+        oneOne
+    }
+
     /**
      * Jpf.Controller; was jpf:controller
      */
@@ -121,13 +142,6 @@
         MultipartHandler multipartHandler() default MultipartHandler.disabled;
     }
     
-    public enum MultipartHandler
-    {
-        disabled,
-        memory,
-        disk
-    }
-    
     @Target( ANNOTATION_TYPE )
     @Retention( RUNTIME )
     public @interface ConditionalForward
@@ -507,14 +521,6 @@
         String bundleName() default ""; // optional
     }
     
-    public enum NavigateTo
-    {
-        currentPage,
-        previousPage,
-        previousAction,
-        page
-    }
-
     /**
      * Validation message argument: Arg.
      */
@@ -526,12 +532,6 @@
         String argKey() default "";
         String bundleName() default "";
         int position() default -1;
-    }
-
-    public enum ValidatorVersion
-    {
-        oneZero,
-        oneOne
     }
 
     /**

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnyBeanActionForm.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnyBeanActionForm.java?view=diff&r1=157785&r2=157786
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnyBeanActionForm.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnyBeanActionForm.java
 Wed Mar 16 10:24:54 2005
@@ -85,22 +85,8 @@
     public ActionErrors validate( ActionMapping mapping, HttpServletRequest 
request )
     {
         assert _bean != null;
-        assert mapping instanceof PageFlowActionMapping : 
mapping.getClass().getName();
-        
-        String beanName = ( ( PageFlowActionMapping ) mapping ).getAttribute();
-        ActionErrors errors = validateBean( _bean, beanName, mapping, request 
);
-        
-        if ( _bean instanceof Validatable )
-        {
-            if ( errors == null )
-            {
-                errors = new ActionErrors();
-            }
-            
-            ( ( Validatable ) _bean ).validate( mapping, request, errors );
-        }
-        
-        return errors;
+        String beanName = mapping.getAttribute();
+        return validateBean( _bean, beanName, mapping, request );
     }    
     
     public String toString()


Reply via email to