You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/02/25 07:12:53 UTC
svn commit: r155308 - in incubator/beehive/trunk/netui/src:
compiler/org/apache/beehive/netui/compiler/model/
pageflow/org/apache/beehive/netui/pageflow/
pageflow/org/apache/beehive/netui/pageflow/internal/
Author: rich
Date: Thu Feb 24 22:12:50 2005
New Revision: 155308
URL: http://svn.apache.org/viewcvs?view=rev&rev=155308
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-361 : Redundant form-bean type information in generated Struts XML when form class extends ActionForm
DRT/BVT: netui (WinXP)
BB: self (linux)
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java?view=diff&r1=155307&r2=155308
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java Thu Feb 24 22:12:50 2005
@@ -97,7 +97,7 @@
private String _type = null; // required to be set
/** This is a NetUI-specific property. */
- private String _actualType = null; // required to be set
+ private String _actualType = null;
/** This is a NetUI-specific property. */
private boolean _pageFlowScoped; // required to be set
@@ -117,17 +117,12 @@
{
xb.setName( _name );
- if ( xb.getType() == null )
- {
- xb.setType( _type );
- }
-
- if ( xb.getId() == null && _id != null && _id.length() > 0 )
- {
- xb.setId( _id );
- }
+ if ( xb.getType() == null ) xb.setType( _type );
+ if ( xb.getId() == null && _id != null && _id.length() > 0 ) xb.setId( _id );
+ if ( xb.getClassName() == null &&_className != null ) xb.setClassName( _className );
+ if ( xb.getDynamic() == null && _dynamic ) xb.setDynamic( FormBeanDocument.FormBean.Dynamic.TRUE );
- if ( _actualType != null )
+ if ( _actualType != null && ! _actualType.equals( xb.getType() ) )
{
SetProperty prop = xb.addNewSetProperty();
prop.setProperty( "actualType" );
@@ -135,15 +130,6 @@
if ( xb.getClassName() == null ) xb.setClassName( JPF_ACTION_FORM_BEAN_CLASSNAME );
}
- if ( xb.getClassName() == null &&_className != null )
- {
- xb.setClassName( _className );
- }
-
- if ( xb.getDynamic() == null && _dynamic )
- {
- xb.setDynamic( FormBeanDocument.FormBean.Dynamic.TRUE );
- }
}
public String getId()
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java?view=diff&r1=155307&r2=155308
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java Thu Feb 24 22:12:50 2005
@@ -1150,14 +1150,7 @@
for ( int i = 0; i < formBeans.length; i++ )
{
FormBeanConfig formBeanConfig = formBeans[i];
- String formType = null;
-
- if ( formBeanConfig instanceof PageFlowActionFormBean )
- {
- formType = ( ( PageFlowActionFormBean ) formBeanConfig ).getActualType();
- }
-
- if ( formType == null ) formType = formBeanConfig.getType();
+ String formType = InternalUtils.getFormBeanType( formBeanConfig );
try
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java?view=diff&r1=155307&r2=155308
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java Thu Feb 24 22:12:50 2005
@@ -465,17 +465,9 @@
for ( int j = 0; j < formBeans.length; ++j )
{
assert formBeans[j] != null;
- String formBeanType;
- if ( formBeans[j] instanceof PageFlowActionFormBean )
- {
- formBeanType = ( ( PageFlowActionFormBean ) formBeans[j] ).getActualType();
- }
- else
- {
- formBeanType = formBeans[j].getType();
- }
-
+ String formBeanType = InternalUtils.getFormBeanType( formBeans[j] );
List< String > formBeanNames = formNameMap.get( formBeanType );
+
if ( formBeanNames == null )
{
formBeanNames = new ArrayList< String >();
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java?view=diff&r1=155307&r2=155308
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java Thu Feb 24 22:12:50 2005
@@ -20,6 +20,7 @@
import org.apache.beehive.netui.pageflow.*;
import org.apache.beehive.netui.pageflow.config.PageFlowActionMapping;
import org.apache.beehive.netui.pageflow.config.PageFlowControllerConfig;
+import org.apache.beehive.netui.pageflow.config.PageFlowActionFormBean;
import org.apache.beehive.netui.pageflow.handler.Handlers;
import org.apache.beehive.netui.pageflow.handler.ReloadableClassHandler;
import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
@@ -1041,5 +1042,21 @@
public static String getForwardingModule( ServletRequest request )
{
return ( String ) request.getAttribute( FORWARDING_MODULE_ATTR );
+ }
+
+ public static String getFormBeanType( FormBeanConfig formBeanConfig )
+ {
+ String formBeanType = null;
+
+ // First, try to read the form bean type from our custom property, which supports the any-bean feature.
+ if ( formBeanConfig instanceof PageFlowActionFormBean )
+ {
+ formBeanType = ( ( PageFlowActionFormBean ) formBeanConfig ).getActualType();
+ }
+
+ // If we didn't find it there, this is a normal Struts ActionForm. Just get it from the type attr.
+ if ( formBeanType == null ) formBeanType = formBeanConfig.getType();
+
+ return formBeanType;
}
}