Clover Coverage Report - Atlassian XWork(Aggregated)
Coverage timestamp: Wed Jul 27 2011 23:39:31 CDT
6   39   4   6
4   28   0.67   1
1     4  
1    
 
 
  SimpleValidationInterceptor       Line # 14 6 4 100% 1.0
 
  (3)
 
1    package com.atlassian.xwork.interceptors;
2   
3    import com.opensymphony.xwork.interceptor.Interceptor;
4    import com.opensymphony.xwork.ActionInvocation;
5    import com.opensymphony.xwork.Action;
6    import com.opensymphony.xwork.ValidationAware;
7    import com.opensymphony.xwork.Validateable;
8   
9    /**
10    * Very simple validation interceptor. If an action implements both Validateable
11    * and ValidationAware, the interceptor will call the actions Validateable#validate() method,
12    * and abort processing of the action (returning INPUT) if the validation results in errors.
13    */
 
14    public class SimpleValidationInterceptor implements Interceptor
15    {
 
16  3 toggle public String intercept(ActionInvocation invocation) throws Exception
17    {
18  3 Action action = invocation.getAction();
19  3 if (action instanceof ValidationAware && action instanceof Validateable)
20    {
21  2 ((Validateable)action).validate();
22  2 if (((ValidationAware)action).hasErrors())
23    {
24  1 return Action.INPUT;
25    }
26    }
27   
28  2 return invocation.invoke();
29    }
30   
31    ///CLOVER:OFF
 
32    toggle public void destroy()
33    {
34    }
35   
 
36    toggle public void init()
37    {
38    }
39    }