← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 330: Changed some interceptors from extending AroundInterceptor to implementing Interceptor interface

 

------------------------------------------------------------
revno: 330
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-05-26 10:39:14 +0200
message:
  Changed some interceptors from extending AroundInterceptor to implementing Interceptor interface
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalMenuInterceptor.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalModuleInterceptor.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalParamsInterceptor.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalUserInterceptor.java

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalMenuInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalMenuInterceptor.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalMenuInterceptor.java	2009-05-26 08:39:14 +0000
@@ -34,14 +34,14 @@
 import org.hisp.dhis.webportal.menu.MenuStateManager;
 
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
 /**
  * @author Torgeir Lorange Ostby
  * @version $Id: WebWorkPortalMenuInterceptor.java 2869 2007-02-20 14:26:09Z andegje $
  */
 public class WebWorkPortalMenuInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     private static final String KEY_MENU_STATE = "menuState";
 
@@ -60,13 +60,20 @@
     // AroundInterceptor implementation
     // -------------------------------------------------------------------------
 
-    @Override
-    protected void after( ActionInvocation invocation, String result ) throws Exception
-    {
-    }
-
-    @Override
-    protected void before( ActionInvocation invocation ) throws Exception
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String intercept( ActionInvocation invocation )
+        throws Exception
     {
         Map<String, MenuState> menuStateMap = new HashMap<String, MenuState>( 1 );
 
@@ -80,5 +87,7 @@
         menuStateMap.put( KEY_MENU_STATE, menuState );
 
         invocation.getStack().push( menuStateMap );
+        
+        return invocation.invoke();
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalModuleInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalModuleInterceptor.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalModuleInterceptor.java	2009-05-26 08:39:14 +0000
@@ -33,14 +33,14 @@
 import org.hisp.dhis.webportal.module.ModuleManager;
 
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
 /**
  * @author Torgeir Lorange Ostby
  * @version $Id: WebWorkPortalModuleInterceptor.java 2869 2007-02-20 14:26:09Z andegje $
  */
 public class WebWorkPortalModuleInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     private static final String KEY_MAINTENANCE_MODULES = "maintenanceModules";
     private static final String KEY_SERVICE_MODULES = "serviceModules";
@@ -60,14 +60,19 @@
     // AroundInterceptor implementation
     // -------------------------------------------------------------------------
 
-    @Override
-    protected void after( ActionInvocation actionInvocation, String result )
-        throws Exception
-    {
-    }
-
-    @Override
-    protected void before( ActionInvocation actionInvocation )
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String intercept( ActionInvocation actionInvocation )
         throws Exception
     {
         Map<String, Object> handle = new HashMap<String, Object>( 2 );
@@ -76,5 +81,7 @@
         handle.put( KEY_SERVICE_MODULES, moduleManager.getServiceMenuModules() );
 
         actionInvocation.getStack().push( handle );
+        
+        return actionInvocation.invoke();
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalParamsInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalParamsInterceptor.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalParamsInterceptor.java	2009-05-26 08:39:14 +0000
@@ -34,14 +34,14 @@
 
 import com.opensymphony.xwork.ActionInvocation;
 import com.opensymphony.xwork.config.entities.ActionConfig;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
 /**
  * @author Torgeir Lorange Ostby
  * @version $Id: WebWorkPortalParamsInterceptor.java 4559 2008-02-09 18:47:24Z torgeilo $
  */
 public class WebWorkPortalParamsInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     // -------------------------------------------------------------------------
     // External configuration
@@ -65,51 +65,56 @@
     // AroundInterceptor implementation
     // -------------------------------------------------------------------------
 
-    @Override
-    protected void after( ActionInvocation actionInvocation, String result )
-        throws Exception
-    {
-    }
-
-    @Override
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
     @SuppressWarnings( "unchecked" )
-    protected void before( ActionInvocation actionInvocation )
+    public String intercept( ActionInvocation actionInvocation )
         throws Exception
     {
         ActionConfig actionConfig = actionInvocation.getProxy().getConfig();
 
         final Map<String, String> staticParams = actionConfig.getParams();
 
-        if ( staticParams == null )
-        {
-            return;
-        }
-
-        // ---------------------------------------------------------------------
-        // Push the specified static parameters onto the value stack
-        // ---------------------------------------------------------------------
-
-        Map<String, Object> matches = new HashMap<String, Object>();
-
-        for ( Map.Entry<String, String> entry : staticParams.entrySet() )
-        {
-            if ( standardParams.contains( entry.getKey() ) )
-            {
-                matches.put( entry.getKey(), entry.getValue() );
-            }
-            else if ( commaSeparatedParams.contains( entry.getKey() ) )
-            {
-                String[] values = entry.getValue().split( "," );
-
-                for ( int i = 0; i < values.length; i++ )
-                {
-                    values[i] = values[i].trim();
-                }
-                
-                matches.put( entry.getKey(), values );
-            }
-        }
-
-        actionInvocation.getStack().push( matches );
+        if ( staticParams != null )
+        {            
+            // ---------------------------------------------------------------------
+            // Push the specified static parameters onto the value stack
+            // ---------------------------------------------------------------------
+    
+            Map<String, Object> matches = new HashMap<String, Object>();
+    
+            for ( Map.Entry<String, String> entry : staticParams.entrySet() )
+            {
+                if ( standardParams.contains( entry.getKey() ) )
+                {
+                    matches.put( entry.getKey(), entry.getValue() );
+                }
+                else if ( commaSeparatedParams.contains( entry.getKey() ) )
+                {
+                    String[] values = entry.getValue().split( "," );
+    
+                    for ( int i = 0; i < values.length; i++ )
+                    {
+                        values[i] = values[i].trim();
+                    }
+                    
+                    matches.put( entry.getKey(), values );
+                }
+            }
+    
+            actionInvocation.getStack().push( matches );
+        }
+        
+        return actionInvocation.invoke();
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalUserInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalUserInterceptor.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/interceptor/WebWorkPortalUserInterceptor.java	2009-05-26 08:39:14 +0000
@@ -33,14 +33,14 @@
 import org.hisp.dhis.user.CurrentUserService;
 
 import com.opensymphony.xwork.ActionInvocation;
-import com.opensymphony.xwork.interceptor.AroundInterceptor;
+import com.opensymphony.xwork.interceptor.Interceptor;
 
 /**
  * @author Torgeir Lorange Ostby
  * @version $Id: WebWorkPortalUserInterceptor.java 2869 2007-02-20 14:26:09Z andegje $
  */
 public class WebWorkPortalUserInterceptor
-    extends AroundInterceptor
+    implements Interceptor
 {
     // -------------------------------------------------------------------------
     // Dependencies
@@ -57,13 +57,20 @@
     // Interceptor implementation
     // -------------------------------------------------------------------------
 
-    @Override
-    protected void after( ActionInvocation invocation, String result ) throws Exception
-    {
-    }
-
-    @Override
-    protected void before( ActionInvocation invocation ) throws Exception
+    public void destroy()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void init()
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public String intercept( ActionInvocation invocation )
+        throws Exception
     {
         Map<String, Object> map = new HashMap<String, Object>( 3 );
 
@@ -71,5 +78,7 @@
         map.put( "currentUser", currentUserService.getCurrentUser() );
 
         invocation.getStack().push( map );
+        
+        return invocation.invoke();
     }
 }



--
Trunk
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.