continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r191407 - in /maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve: ContinuumViewContextPopulatorValve.java ContinuumViewContextValve.java FormicaValve.java
Date Mon, 20 Jun 2005 06:51:24 GMT
Author: jvanzyl
Date: Sun Jun 19 23:51:24 2005
New Revision: 191407

URL: http://svn.apache.org/viewcvs?rev=191407&view=rev
Log:
o adding a formica valve, first step toward a view flow valve

Added:
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/FormicaValve.java
Modified:
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextPopulatorValve.java
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextValve.java

Modified: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextPopulatorValve.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextPopulatorValve.java?rev=191407&r1=191406&r2=191407&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextPopulatorValve.java
(original)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextPopulatorValve.java
Sun Jun 19 23:51:24 2005
@@ -19,6 +19,7 @@
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.web.context.ViewContextPopulator;
 import org.codehaus.plexus.summit.pipeline.valve.CreateViewContextValve;
+import org.codehaus.plexus.summit.pipeline.valve.ValveInvocationException;
 import org.codehaus.plexus.summit.rundata.RunData;
 import org.codehaus.plexus.summit.view.ViewContext;
 
@@ -28,7 +29,7 @@
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @version $Id: ContinuumViewContextPopulatorValve.java,v 1.1 2005/04/04 14:05:38 jvanzyl
Exp $
+ * @version $Id$
  */
 public class ContinuumViewContextPopulatorValve
     extends CreateViewContextValve
@@ -38,6 +39,7 @@
     private Continuum model;
 
     protected void populateViewContext( RunData data, ViewContext context )
+        throws ValveInvocationException
     {
         if ( data.getTarget() != null )
         {

Modified: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextValve.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextValve.java?rev=191407&r1=191406&r2=191407&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextValve.java
(original)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/ContinuumViewContextValve.java
Sun Jun 19 23:51:24 2005
@@ -17,17 +17,20 @@
  */
 
 import org.codehaus.plexus.summit.pipeline.valve.CreateViewContextValve;
+import org.codehaus.plexus.summit.pipeline.valve.ValveInvocationException;
 import org.codehaus.plexus.summit.rundata.RunData;
 import org.codehaus.plexus.summit.view.ViewContext;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @version $Id: ContinuumViewContextValve.java,v 1.1 2005/04/04 14:05:38 jvanzyl Exp $
+ * @version $Id$
  */
 public class ContinuumViewContextValve
     extends CreateViewContextValve
 {
     protected void populateViewContext( RunData data, ViewContext context )
+        throws ValveInvocationException
+    
     {
         context.put( "data", data );
     }

Added: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/FormicaValve.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/FormicaValve.java?rev=191407&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/FormicaValve.java
(added)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/FormicaValve.java
Sun Jun 19 23:51:24 2005
@@ -0,0 +1,88 @@
+package org.apache.maven.continuum.web.pipeline.valve;
+
+import org.codehaus.plexus.summit.pipeline.valve.CreateViewContextValve;
+import org.codehaus.plexus.summit.pipeline.valve.ValveInvocationException;
+import org.codehaus.plexus.summit.rundata.RunData;
+import org.codehaus.plexus.summit.view.ViewContext;
+import org.codehaus.plexus.formica.FormManager;
+import org.codehaus.plexus.formica.Form;
+import org.codehaus.plexus.formica.FormNotFoundException;
+import org.apache.maven.continuum.web.tool.FormicaTool;
+import org.apache.maven.continuum.web.tool.FormToolException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id: ContinuumViewContextValve.java 170819 2005-05-18 20:34:26Z trygvis $
+ */
+public class FormicaValve
+    extends CreateViewContextValve
+{
+    // ----------------------------------------------------------------------
+    // Requirements
+    // ----------------------------------------------------------------------
+
+    /**
+     * @plexus.requirement
+     */
+    private FormicaTool formicaTool;
+
+    // ----------------------------------------------------------------------
+    // Configuration
+    // ----------------------------------------------------------------------
+
+    /**
+     * @plexus.configuration
+     */
+    private String defaultFormId;
+
+    protected void populateViewContext( RunData data, ViewContext context )
+        throws ValveInvocationException
+    {
+        // ----------------------------------------------------------------------
+        // Entity Id
+        // ----------------------------------------------------------------------
+
+        String id = data.getParameters().getString( "id" );
+
+        context.put( "id", id );
+
+        // ----------------------------------------------------------------------
+        // Form
+        // ----------------------------------------------------------------------
+
+        String formId = data.getParameters().getString( "fid" );
+
+        context.put( "fid", formId );
+
+        if ( formId == null )
+        {
+            formId = defaultFormId;
+        }
+
+        Form form;
+
+        try
+        {
+            form = formicaTool.getForm( formId );
+
+            context.put( "form", form );
+
+            // ----------------------------------------------------------------------
+            // We only need the item for the Edit and View
+            // ----------------------------------------------------------------------
+
+            String view = data.getTarget();
+
+            if ( view != null && ( view.startsWith( "View" ) || view.startsWith(
"Edit" ) ) )
+            {
+                Object item = formicaTool.getItem( form, id );
+
+                context.put( "item", item );
+            }
+        }
+        catch ( FormToolException e )
+        {
+            throw new ValveInvocationException( "Error populating context: ", e );
+        }
+    }
+}



Mime
View raw message