You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by Carlin Rogers <ca...@bea.com> on 2004/09/15 01:32:18 UTC

checkin request netui page flow

Hi All,

I have a checkin request for Page Flow. The following patch file
(output from "svn diff") contains changes to address another
issue with form beans not derived from ActionForm.

This patch is synced to revision 46036.

Fixes:
- A management issue with form beans not derived from ActionForm,
utilizing AnyBeanActionForm. PageFlowFormBeanConfig extends the
Struts FormBeanConfig class for the <form-bean> tag to include the
actual type for the bean to help identify it.
(related to changes for svn commit rev: 43687)

CR: Rich
DRT/BVT: NetUI (WinXP)
BB: self (WinXP)

Re: checkin request netui page flow

Posted by Richard Feit <ri...@bea.com>.
Thanks Carlin, looks good.  I'll get this in ASAP.
Rich

At 05:32 PM 9/14/2004, you wrote:
>Hi All,
>
>I have a checkin request for Page Flow. The following patch file
>(output from "svn diff") contains changes to address another
>issue with form beans not derived from ActionForm.
>
>This patch is synced to revision 46036.
>
>Fixes:
>- A management issue with form beans not derived from ActionForm,
>utilizing AnyBeanActionForm. PageFlowFormBeanConfig extends the
>Struts FormBeanConfig class for the <form-bean> tag to include the
>actual type for the bean to help identify it.
>(related to changes for svn commit rev: 43687)
>
>CR: Rich
>DRT/BVT: NetUI (WinXP)
>BB: self (WinXP)
>
>
>Index: netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
>===================================================================
>--- 
>netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java 
>  (revision 46036)
>+++ 
>netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java 
>  (working copy)
>@@ -17,6 +17,7 @@
>   */
>  package org.apache.beehive.netui.pageflow;
>
>+import org.apache.beehive.netui.pageflow.config.PageFlowFormBeanConfig;
>  import org.apache.beehive.netui.pageflow.internal.ActionResultImpl;
>  import org.apache.beehive.netui.pageflow.internal.InternalUtils;
>  import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
>@@ -401,7 +402,7 @@
>          }
>      }
>
>-    private static String getFormNameFromModuleConfig( ActionForm form, 
>ModuleConfig moduleConfig )
>+    private static String getFormNameFromModuleConfig( String 
>formBeanClassName, ModuleConfig moduleConfig )
>      {
>          String modulePrefix = moduleConfig.getPrefix();
>          Map< String, String > formNameMap = _formNameMaps.get( 
> modulePrefix );  // map of form-type-name to form-name
>@@ -413,13 +414,22 @@
>
>              for ( int j = 0; j < formBeans.length; ++j )
>              {
>-                formNameMap.put( formBeans[j].getType(), 
>formBeans[j].getName() );
>+                assert formBeans[j] != null;
>+                if ( formBeans[j] instanceof PageFlowFormBeanConfig )
>+                {
>+                    formNameMap.put( ( ( PageFlowFormBeanConfig ) 
>formBeans[j] ).getActualType(),
>+                                     formBeans[j].getName() );
>+                }
>+                else
>+                {
>+                    formNameMap.put( formBeans[j].getType(), 
>formBeans[j].getName() );
>+                }
>              }
>
>              _formNameMaps.put( modulePrefix, formNameMap );
>          }
>
>-        return formNameMap.get( form.getClass().getName() );
>+        return formNameMap.get( formBeanClassName );
>      }
>
>      /**
>@@ -438,11 +448,12 @@
>          if ( form != null )
>          {
>              ModuleConfig moduleConfig = mapping.getModuleConfig();
>-            String formName = getFormNameFromModuleConfig( form, 
>moduleConfig );
>+            Class formClass = InternalUtils.unwrapFormBean( form 
>).getClass();
>+            String formName = getFormNameFromModuleConfig( 
>formClass.getName(), moduleConfig );
>
>              if ( formName == null )
>              {
>-                formName = getFormBeanName( form, request, false );
>+                formName = getFormBeanName( formClass, request, false );
>              }
>
>              InternalUtils.setFormInScope( formName, form, mapping, 
> request, overwrite );
>@@ -505,15 +516,8 @@
>
>          if ( doStrutsLookup )
>          {
>-            FormBeanConfig[] formBeans = moduleConfig.findFormBeanConfigs();
>-
>-            for ( int j = 0; j < formBeans.length; ++j )
>-            {
>-                if ( formBeans[j].getType().equals( formBeanClassName ) )
>-                {
>-                    return formBeans[j].getName();
>-                }
>-            }
>+            String name = getFormNameFromModuleConfig( formBeanClassName, 
>moduleConfig );
>+            if ( name != null ) return name;
>          }
>
>          //
>Index: 
>netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowFormBeanConfig.java
>===================================================================
>--- 
>netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowFormBeanConfig.java 
>(revision 0)
>+++ 
>netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowFormBeanConfig.java 
>(revision 0)
>@@ -0,0 +1,40 @@
>+/*
>+ * Copyright 2004 The Apache Software Foundation.
>+ *
>+ * Licensed under the Apache License, Version 2.0 (the "License");
>+ * you may not use this file except in compliance with the License.
>+ * You may obtain a copy of the License at
>+ *
>+ *     http://www.apache.org/licenses/LICENSE-2.0
>+ *
>+ * Unless required by applicable law or agreed to in writing, software
>+ * distributed under the License is distributed on an "AS IS" BASIS,
>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>+ * See the License for the specific language governing permissions and
>+ * limitations under the License.
>+ *
>+ * $Header:$
>+ */
>+package org.apache.beehive.netui.pageflow.config;
>+
>+import org.apache.struts.config.FormBeanConfig;
>+
>+
>+/**
>+ * Class to handle our extensions to the Struts <form-bean> tag.
>+ */
>+public class PageFlowFormBeanConfig extends FormBeanConfig
>+{
>+    private String _actualType;  // applicable for non-ActionForm-derived 
>form types
>+
>+
>+    public String getActualType()
>+    {
>+        return _actualType;
>+    }
>+
>+    public void setActualType( String actualType )
>+    {
>+        _actualType = actualType;
>+    }
>+}
>
>Property changes on: 
>netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowFormBeanConfig.java
>___________________________________________________________________
>Name: svn:eol-style
>    + native
>
>Index: 
>netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java
>===================================================================
>--- 
>netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java 
>(revision 46036)
>+++ 
>netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java 
>(working copy)
>@@ -22,6 +22,8 @@
>  import java.util.List;
>
>  import 
> org.apache.beehive.netui.compiler.model.schema.struts11.FormBeanDocument;
>+import 
>org.apache.beehive.netui.compiler.model.schema.struts11.SetPropertyDocument.SetProperty;
>+import static 
>org.apache.beehive.netui.compiler.JpfLanguageConstants.PAGEFLOW_PACKAGE;
>
>
>  /**
>@@ -86,6 +88,8 @@
>      }
>
>
>+    private static final String JPF_FORM_BEAN_CONFIG_CLASSNAME = 
>PAGEFLOW_PACKAGE + ".config.PageFlowFormBeanConfig";
>+
>      private String _id = "";  // NOI18N
>      private String _className = null;
>      private boolean _dynamic = false;
>@@ -116,6 +120,14 @@
>          {
>              xb.setId( _id );
>          }
>+
>+        if ( _actualType != null )
>+        {
>+            SetProperty prop = xb.addNewSetProperty();
>+            prop.setProperty( "actualType" );
>+            prop.setValue( _actualType );
>+            xb.setClassName( JPF_FORM_BEAN_CONFIG_CLASSNAME );
>+        }
>
>          if ( xb.getClassName() == null &&_className != null )
>          {