Author: rich
Date: Thu Feb 17 13:45:33 2005
New Revision: 154197

URL: http://svn.apache.org/viewcvs?view=rev&rev=154197
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-246 : Struts merge feature 
doesn't set my actionmapping className attribute

DRT/BVT: netui (WinXP)
BB: self (linux)


Modified:
    
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
    
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ExceptionModel.java
    
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/FormBeanModel.java
    
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ForwardModel.java
    
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java

Modified: 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java?view=diff&r1=154196&r2=154197
==============================================================================
--- 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ActionModel.java
 Thu Feb 17 13:45:33 2005
@@ -136,45 +136,14 @@
     {
         xb.setPath( _path );
         
-        if ( xb.getName() == null && _formBeanName != null )
-        {
-            xb.setName( _formBeanName );
-        }
-
-        if ( xb.getClassName() == null && _className != null )
-        {
-            xb.setClassName( _className );
-        }
-        
-        if ( xb.getType() == null && _type != null )
-        {
-            xb.setType( _type );
-        }
-        
-        if ( xb.getAttribute() == null && _attribute != null )
-        {
-            xb.setAttribute( _attribute );
-        }
-        
-        if ( xb.getInput() == null && _input != null )
-        {
-            xb.setInput( _input );
-        }
-        
-        if ( xb.getParameter() == null && _parameter != null )
-        {
-            xb.setParameter( _parameter ); 
-        }
-        
-        if ( xb.getPrefix() == null && _prefix != null )
-        {
-            xb.setPrefix( _prefix );
-        }
-        
-        if ( xb.getSuffix() == null && _suffix != null )
-        {
-            xb.setSuffix( _suffix );
-        }
+        if ( xb.getName() == null && _formBeanName != null ) xb.setName( 
_formBeanName );
+        if ( xb.getClassName() == null && _className != null ) 
xb.setClassName( _className );
+        if ( xb.getType() == null && _type != null ) xb.setType( _type );
+        if ( xb.getAttribute() == null && _attribute != null ) 
xb.setAttribute( _attribute );
+        if ( xb.getInput() == null && _input != null ) xb.setInput( _input );
+        if ( xb.getParameter() == null && _parameter != null ) 
xb.setParameter( _parameter ); 
+        if ( xb.getPrefix() == null && _prefix != null ) xb.setPrefix( _prefix 
);
+        if ( xb.getSuffix() == null && _suffix != null ) xb.setSuffix( _suffix 
);
         
         if ( xb.getScope() == null )
         {
@@ -199,30 +168,11 @@
             }
         }
         
-        if ( xb.getRoles() == null && _roles != null )
-        {
-            xb.setRoles( _roles );
-        }
-        
-        if ( xb.getForward2() == null &&  _forward != null )
-        {
-            xb.setForward2( _forward );
-        }
-        
-        if ( xb.getInclude() == null && _include != null )
-        {
-            xb.setInclude( _include );
-        }
-        
-        if ( xb.getUnknown() == null && _unknown )
-        {
-            xb.setUnknown( Action.Unknown.TRUE );
-        }
-        
-        if ( xb.getValidate() == null )
-        {
-            xb.setValidate( _validate ? Action.Validate.TRUE : 
Action.Validate.FALSE );
-        }
+        if ( xb.getRoles() == null && _roles != null ) xb.setRoles( _roles );
+        if ( xb.getForward2() == null &&  _forward != null ) xb.setForward2( 
_forward );
+        if ( xb.getInclude() == null && _include != null ) xb.setInclude( 
_include );
+        if ( xb.getUnknown() == null && _unknown ) xb.setUnknown( 
Action.Unknown.TRUE );
+        if ( xb.getValidate() == null ) xb.setValidate( _validate ? 
Action.Validate.TRUE : Action.Validate.FALSE );
         
         if (  _unqualifiedActionPath != null ) addSetProperty( xb, 
"unqualifiedActionPath", _unqualifiedActionPath );
         if ( _formMember != null ) addSetProperty( xb, "formMember", 
_formMember );
@@ -289,7 +239,7 @@
         SetProperty prop = xb.addNewSetProperty();
         prop.setProperty( propertyName );
         prop.setValue( propertyValue );
-        xb.setClassName( JPF_ACTION_MAPPING_CLASSNAME );
+        if ( xb.getClassName() == null ) xb.setClassName( 
JPF_ACTION_MAPPING_CLASSNAME );
     }
     
     protected ForwardDocument.Forward addNewForward( XmlObject xmlObject )

Modified: 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ExceptionModel.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ExceptionModel.java?view=diff&r1=154196&r2=154197
==============================================================================
--- 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ExceptionModel.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ExceptionModel.java
 Thu Feb 17 13:45:33 2005
@@ -128,54 +128,33 @@
             else
             {
                 xb.setPath( _path );
-                SetProperty prop = xb.addNewSetProperty();
-                prop.setProperty( "isPathContextRelative" );
-                prop.setValue( "true" );
-                xb.setClassName( JPF_EXCEPTION_CONFIG_CLASSNAME );
+                addSetProperty( xb, "isPathContextRelative", "true" );
             }
         }
         
-        if ( xb.getKey() == null && _messageKey != null )
-        {
-            xb.setKey( _messageKey );
-        }
-        
-        if ( xb.getKey() == null )
-        {
-            xb.setKey( "" );
-        }
+        if ( xb.getKey() == null && _messageKey != null ) xb.setKey( 
_messageKey );
+        if ( xb.getKey() == null ) xb.setKey( "" );
+        if ( _message != null ) addSetProperty( xb, "defaultMessage", _message 
);
         
-        if ( _message != null )
-        {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "defaultMessage" );
-            prop.setValue( _message );
-            xb.setClassName( JPF_EXCEPTION_CONFIG_CLASSNAME );
-        }
         //
         // Note that we're setting the handler *method* as the handler.  This 
would break Struts.
         //
         if ( xb.getHandler() == null && _handlerMethod != null && 
_handlerClass == null )
         {
             xb.setHandler( _handlerMethod );
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "isHandlerMethod" );
-            prop.setValue( "true" );
-            xb.setClassName( JPF_EXCEPTION_CONFIG_CLASSNAME );
-        }
-        
-        if ( _readonly )
-        {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "readonly" );
-            prop.setValue( "true" );
-            xb.setClassName( JPF_EXCEPTION_CONFIG_CLASSNAME );
+            addSetProperty( xb, "isHandlerMethod", "true" );
         }
         
-        if ( xb.getHandler() == null && _handlerClass != null )
-        {
-            xb.setHandler( _handlerClass );
-        }
+        if ( _readonly ) addSetProperty( xb, "readonly", "true" );
+        if ( xb.getHandler() == null && _handlerClass != null ) xb.setHandler( 
_handlerClass );
+    }
+    
+    private void addSetProperty( ExceptionDocument.Exception xb, String 
propertyName, String propertyValue )
+    {
+        SetProperty prop = xb.addNewSetProperty();
+        prop.setProperty( propertyName );
+        prop.setValue( propertyValue );
+        if ( xb.getClassName() == null ) xb.setClassName( 
JPF_EXCEPTION_CONFIG_CLASSNAME );
     }
 
     public boolean isReadonly()

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=154196&r2=154197
==============================================================================
--- 
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 17 13:45:33 2005
@@ -33,57 +33,57 @@
 {
     public static class Property
     {
-        String name;
-        String type;
-        boolean required;
-        boolean multiValue;
+        private String _name;
+        private String _type;
+        private boolean _required;
+        private boolean _multiValue;
 
         public Property( String name, String type, boolean required, boolean 
multival )
         {
-            this.name = name;
-            this.type = type;
-            this.required = required;
-            this.multiValue = multival;
+            _name = name;
+            _type = type;
+            _required = required;
+            _multiValue = multival;
         }
 
         public String getName()
         {
-            return name;
+            return _name;
         }
 
         public void setName( String name )
         {
-            this.name = name;
+            _name = name;
         }
 
         public String getType()
         {
-            return type;
+            return _type;
         }
 
         public void setType( String type )
         {
-            this.type = type;
+            _type = type;
         }
 
         public boolean isRequired()
         {
-            return required;
+            return _required;
         }
 
         public void setRequired( boolean required )
         {
-            this.required = required;
+            _required = required;
         }
 
         public boolean isMultiValue ()
         {
-            return multiValue;
+            return _multiValue;
         }
 
         public void setMultiValue ( boolean multi )
         {
-            this.multiValue = multi;
+            _multiValue = multi;
         }
     }
 
@@ -132,7 +132,7 @@
             SetProperty prop = xb.addNewSetProperty();
             prop.setProperty( "actualType" );
             prop.setValue( _actualType );
-            xb.setClassName( JPF_ACTION_FORM_BEAN_CLASSNAME );
+            if ( xb.getClassName() == null ) xb.setClassName( 
JPF_ACTION_FORM_BEAN_CLASSNAME );
         }
         
         if ( xb.getClassName() == null &&_className != null )
@@ -153,7 +153,7 @@
 
     public void setId( String id )
     {
-        this._id = id;
+        _id = id;
     }
 
     public String getClassName()
@@ -168,7 +168,7 @@
             if ("org.apache.struts.action.DynaActionForm".equals( className ) 
)  // NOI18N
                 _dynamic = true;
 
-            this._className = className;
+            _className = className;
         }
     }
 
@@ -179,7 +179,7 @@
 
     public void setDynamic( boolean dynamic )
     {
-        this._dynamic = dynamic;
+        _dynamic = dynamic;
     }
 
     public String getName()
@@ -189,7 +189,7 @@
 
     public void setName( String name )
     {
-        this._name = name;
+        _name = name;
     }
 
     public String getType()
@@ -199,7 +199,7 @@
 
     public void setType( String type )
     {
-        this._type = type;
+        _type = type;
     }
 
     public String getActualType()
@@ -256,7 +256,7 @@
     public Property findProperty( String name )
     {
         int index = findPropertyIndex( name );
-        return ( index != -1 ? ( Property ) _properties.get( index ) : null );
+        return index != -1 ? ( Property ) _properties.get( index ) : null;
     }
 
     protected int findPropertyIndex( String name )

Modified: 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ForwardModel.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ForwardModel.java?view=diff&r1=154196&r2=154197
==============================================================================
--- 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ForwardModel.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/ForwardModel.java
 Thu Feb 17 13:45:33 2005
@@ -83,57 +83,27 @@
         // "externalRedirect" is set using set-property, to indicate that the 
redirect
         // is to another app.
         //
-        if ( _externalRedirect )
-        {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "externalRedirect" );
-            prop.setValue( "true" );
-            xb.setClassName( JPF_ACTION_FWD_CLASSNAME );
-        }
+        if ( _externalRedirect ) addSetProperty( xb, "externalRedirect", 
"true" );
         
         //
         // "returnToPage" is set using set-property, which requires us to 
override the
         // ActionForward class.
         //
-        if ( _returnToPage )
-        {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "returnToPage" );
-            prop.setValue( "true" );
-            xb.setClassName( JPF_ACTION_FWD_CLASSNAME );
-        }
+        if ( _returnToPage ) addSetProperty( xb, "returnToPage", "true" );
 
         //
         // "returnToAction" is set using set-property, which requires us to 
override the
         // ActionForward class.
         //
-        if ( _returnToAction )
-        {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "returnToAction" );
-            prop.setValue( "true" );
-            xb.setClassName( JPF_ACTION_FWD_CLASSNAME );
-        }
+        if ( _returnToAction ) addSetProperty( xb, "returnToAction", "true" );
 
-        if ( _hasExplicitRedirectValue )
-        {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "hasExplicitRedirectValue" );
-            prop.setValue( "true" );
-            xb.setClassName( JPF_ACTION_FWD_CLASSNAME );
-        }
+        if ( _hasExplicitRedirectValue ) addSetProperty( xb, 
"hasExplicitRedirectValue", "true" );
 
-        if ( _restoreQueryString )
-        {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "restoreQueryString" );
-            prop.setValue( "true" );
-            xb.setClassName( JPF_ACTION_FWD_CLASSNAME );
-        }
+        if ( _restoreQueryString ) addSetProperty( xb, "restoreQueryString", 
"true" );
         
         if ( _actionOutputs != null && _actionOutputs.size() > 0 )
         {
-            xb.setClassName( JPF_ACTION_FWD_CLASSNAME );
+            if ( xb.getClassName() == null ) xb.setClassName( 
JPF_ACTION_FWD_CLASSNAME );
 
             int n = _actionOutputs.size();
             SetProperty countProp = xb.addNewSetProperty();
@@ -145,7 +115,7 @@
                 ActionOutputModel pi = ( ActionOutputModel ) 
_actionOutputs.get( i );
                 SetProperty prop = xb.addNewSetProperty();
                 prop.setProperty( "actionOutput" + i );
-                prop.setValue( pi.getType() + "|" + pi.getNullable() + "|" + 
pi.getName() );
+                prop.setValue( pi.getType() + '|' + pi.getNullable() + '|' + 
pi.getName() );
             }
         }
         
@@ -155,25 +125,9 @@
         //
         if ( _isNestedReturn )
         {
-            SetProperty prop = xb.addNewSetProperty();
-            prop.setProperty( "nestedReturn" );
-            prop.setValue( "true" );
-
-            if ( _returnFormType != null )
-            {
-                prop = xb.addNewSetProperty();
-                prop.setProperty( "returnFormType" );
-                prop.setValue( _returnFormType );
-            }
-            
-            if ( _returnFormMember != null )
-            {
-                prop = xb.addNewSetProperty();
-                prop.setProperty( "returnFormMember" );
-                prop.setValue( _returnFormMember );
-            }
-            
-            xb.setClassName( JPF_ACTION_FWD_CLASSNAME );
+            addSetProperty( xb, "nestedReturn", "true" );
+            if ( _returnFormType != null ) addSetProperty( xb, 
"returnFormType", _returnFormType );
+            if ( _returnFormMember != null ) addSetProperty( xb, 
"returnFormMember", _returnFormMember );
         }
         
         addComment( xb );
@@ -345,5 +299,13 @@
     public boolean isNestedReturn()
     {
         return _isNestedReturn;
+    }
+    
+    private void addSetProperty( Forward xb, String propertyName, String 
propertyValue )
+    {
+        SetProperty prop = xb.addNewSetProperty();
+        prop.setProperty( propertyName );
+        prop.setValue( propertyValue );
+        if ( xb.getClassName() == null ) xb.setClassName( 
JPF_ACTION_FWD_CLASSNAME );
     }
 }

Modified: 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java?view=diff&r1=154196&r2=154197
==============================================================================
--- 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/model/StrutsApp.java
 Thu Feb 17 13:45:33 2005
@@ -757,7 +757,7 @@
     
     protected static void addSetProperty( ControllerDocument.Controller 
controller, String propName, String propValue )
     {
-        controller.setClassName( PAGEFLOW_CONTROLLER_CONFIG_CLASSNAME );
+        if ( controller.getClassName() == null ) controller.setClassName( 
PAGEFLOW_CONTROLLER_CONFIG_CLASSNAME );
         SetPropertyDocument.SetProperty prop = controller.addNewSetProperty();
         prop.setProperty( propName );
         prop.setValue( propValue );


Reply via email to