You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2005/06/24 15:48:52 UTC

svn commit: r201619 - in /struts/sandbox/trunk/overdrive/PhoneBook: Core/ Core/Commands/ Test/Commands/ Test/Forms/ Test/Resources/Command/ Test/Resources/Query/ Web/ Web/Forms/ Web/Resources/Command/ Web/Resources/Query/

Author: husted
Date: Fri Jun 24 06:48:49 2005
New Revision: 201619

URL: http://svn.apache.org/viewcvs?rev=201619&view=rev
Log:
OVR-5
* Update to use Nexus IEntryList interface and EntryListProcessor
* Stub in code and queries need to support editing, based on examples from intranet application.

Added:
    struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseSave.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/AppGridHelper.cs
Modified:
    struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContext.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContextList.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/AppProcessor.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/AppCommand.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Query/SelectAll.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/Catalog.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Query/SelectAll.xml
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/App.cs Fri Jun 24 06:48:49 2005
@@ -28,6 +28,12 @@
 		}
 
 		/// <summary>
+		/// Token for entry_key property.
+		/// </summary>
+		/// 
+		public const string ENTRY_KEY = "entry_key";
+
+		/// <summary>
 		/// Token for first_name property.
 		/// </summary>
 		/// 

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContext.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContext.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContext.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContext.cs Fri Jun 24 06:48:49 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-using Agility.Core;
+using System.Collections;
 
 namespace PhoneBook.Core
 {
@@ -21,51 +21,75 @@
 	/// Expose field attributes as public properties.
 	/// </summary>
 	/// 
-	public class AppContext : Context
+	public class AppEntry
 	{
 
+		public void Add(string key, string value)
+		{
+			_Value.Add (key,value);
+		}
+
+		private IDictionary _Value = new Hashtable(5);
+
+		private string Get(string key)
+		{
+			return _Value[key] as string;
+		}
+
+		private void Set(string key, string value)
+		{
+			_Value[key] = value;
+		}
+
+
 		/*
-		public string property
+		public string Property
 		{
-			get { return _Store[App.PROPERTY] as string; }
-			set { _Store[App.PROPERTY] = value; }
+			get { return Get(App.PROPERTY); }
+			set { Set(App.PROPERTY, value); }
 		}
 		*/
 
+		public string entry_key
+		{
+			get { return Get(App.ENTRY_KEY); }
+			set { Set(App.ENTRY_KEY, value); }
+		}
+
 		public string first_name
 		{
-			get { return this [App.FIRST_NAME] as string; }
-			set { this [App.FIRST_NAME] = value; }
+			get { return Get(App.FIRST_NAME); }
+			set { Set(App.FIRST_NAME, value); }
 		}
 
 		public string last_name
 		{
-			get { return this [App.LAST_NAME] as string; }
-			set { this [App.LAST_NAME] = value; }
+			get { return Get(App.LAST_NAME); }
+			set { Set(App.LAST_NAME, value); }
 		}
 
 		public string extension
 		{
-			get { return this [App.EXTENSION] as string; }
-			set { this [App.EXTENSION] = value; }
+			get { return Get(App.EXTENSION); }
+			set { Set(App.EXTENSION, value); }
 		}
 
 		public string user_name
 		{
-			get { return this [App.USER_NAME] as string; }
-			set { this [App.USER_NAME] = value; }
+			get { return Get(App.USER_NAME); }
+			set { Set(App.USER_NAME, value); }
 		}
 
 		public string hired
 		{
-			get { return this [App.HIRED] as string; }
-			set { this [App.HIRED] = value; }
+			get { return Get(App.HIRED); }
+			set { Set(App.HIRED, value); }
 		}
 
 		public string hours
 		{
-			get { return this [App.HOURS] as string; }
-			set { this [App.HOURS] = value; }
+			get { return Get(App.HOURS); }
+			set { Set(App.HOURS, value); }
 		}
 
 	}

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContextList.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContextList.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContextList.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/AppContextList.cs Fri Jun 24 06:48:49 2005
@@ -1,31 +1,29 @@
 using System.Collections;
-using Agility.Core;
 using Nexus.Core;
 
 namespace PhoneBook.Core
 {
 	/// <summary>
-	/// List AppContext objects.
+	/// Implement IEntryList for AppEntry objects.
 	/// </summary>
 	/// 
-	public class AppContextList : ArrayList, IContextList
+	public class AppEntryList : ArrayList, IEntryList
 	{
 
-		public IContext Insert (string key)
+		public object Insert (string key)
 		{
-			AppContext entry = new AppContext();
-			entry.last_name = key;
+			AppEntry entry = new AppEntry();
+			entry.entry_key = key;
 			this.Insert (0,entry);
 			return entry;
 		}
 
 		public void AddEntry(IDictionary row)
 		{
-			AppContext entry = new AppContext();
+			AppEntry entry = new AppEntry();
 			foreach (DictionaryEntry col in row) 
-				entry.Add (col.Key,col.Value);
+				entry.Add (col.Key.ToString (),col.Value.ToString ());
 			Add(entry);
 		}
-
 	}
 }

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/AppProcessor.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/AppProcessor.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/AppProcessor.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/AppProcessor.cs Fri Jun 24 06:48:49 2005
@@ -1,40 +1,14 @@
-using System.Collections;
-using Agility.Nexus.Validators;
 using Nexus.Core;
 using Nexus.Core.Validators;
 
 namespace PhoneBook.Core
 {
-	/// <summary>
-	/// Transform IDictionary entries into formatted AppContext properties.
-	/// </summary>
-	public class AppProcessor : Processor
-	{
-		public override bool ConvertInput (IProcessorContext incoming)
-		{
-			incoming.Target = incoming.Source;
-			return true;
-		}
 
-		public override bool FormatOutput (IProcessorContext outgoing)
+	public class AppEntryListProcessor : EntryListProcessor
+	{
+		public override IEntryList NewEntryList()
 		{
-			ProcessorCommand formatter = new FormatOutput ();
-			IList source = outgoing.Source as IList;
-			AppContextList target = new AppContextList ();
-			foreach (IDictionary row in source)
-			{
-				IRequestContext context = new RequestContext (row);
-				context.FieldTable = outgoing.FieldTable;
-				ICollection keys = row.Keys;
-				foreach (string key in keys)
-				{
-					IProcessorContext _context = new ProcessorContext (key, context);
-					formatter.ExecuteProcess (_context);
-				}
-				target.AddEntry (context.Criteria);
-			}
-			outgoing.Target = target;
-			return true;
+			return new AppEntryList();
 		}
 	}
 }

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/AppCommand.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/AppCommand.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/AppCommand.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/AppCommand.cs Fri Jun 24 06:48:49 2005
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+using System;
 using IBatisNet.DataMapper;
 using Nexus.Core;
 
@@ -29,5 +30,18 @@
 			// return IBatisNet.DataMapper.Mapper.Instance();
 			return IBatisNet.DataMapper.Mapper.Instance ();
 		}
+
+		public bool IsEmpty (string input)
+		{
+			return ((input == null) || (input.Equals (String.Empty)));
+		}
+
+		public string GuidString ()
+		{
+			Guid guid = Guid.NewGuid ();
+			string gs = guid.ToString ();
+			return gs;
+		}
+
 	}
 }

Added: struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseSave.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseSave.cs?rev=201619&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseSave.cs (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Commands/BaseSave.cs Fri Jun 24 06:48:49 2005
@@ -0,0 +1,70 @@
+using Nexus.Core;
+
+namespace PhoneBook.Core.Commands
+{
+	/// <summary>
+	/// Base Command for saving an Entity to the persistant store (database).
+	/// </summary>
+	public class BaseSave : AppCommand
+	{
+		private string _KeyID = null;
+		/// <summary>
+		/// The name of the key field.
+		/// </summary>
+		public string KeyID
+		{
+			get { return _KeyID; }
+			set { _KeyID = value; }
+		}
+
+		private string _InsertID = null;
+		/// <summary>
+		/// The name of the "insert" mapping for the Entity.
+		/// </summary>
+		public string InsertID
+		{
+			get { return _InsertID; }
+			set { _InsertID = value; }
+		}
+
+		private string _UpdateID = null;
+		/// <summary>
+		/// The name of the "update" mapping for the Entity.
+		/// </summary>
+		public string UpdateID
+		{
+			get { return _UpdateID; }
+			set { _UpdateID = value; }
+		}
+
+		/// <summary>
+		/// If the "fieldID" is empty, use the insertID statement, 
+		/// otherwise, use the updateID statement.
+		/// </summary>
+		/// <param name="context">The INexusContext we are processing.</param>
+		/// <param name="fieldID">The name of the key field.</param>
+		/// <param name="insertID">The name of the "insert" mapping for the Entity.</param>
+		/// <param name="updateID">The name of the "update" mapping for the Entity.</param>
+		/// <returns>False</returns>
+		protected bool Save (IRequestContext context, string fieldID, string insertID, string updateID)
+		{
+			bool insert = IsEmpty (context [fieldID] as string);
+
+			if (insert)
+			{
+				context [fieldID] = GuidString ();
+				Mapper().Insert (insertID, context);
+			}
+			else
+				Mapper().Update (updateID, context);
+
+			return CONTINUE;
+		}
+
+		public override bool RequestExecute (IRequestContext context)
+		{
+			return Save (context, KeyID, InsertID, UpdateID);
+		}
+
+	}
+}

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Core/Core.csproj Fri Jun 24 06:48:49 2005
@@ -149,6 +149,11 @@
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "Commands\BaseSave.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
             </Include>
         </Files>
     </CSHARP>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Commands/SelectAllTest.cs Fri Jun 24 06:48:49 2005
@@ -63,10 +63,10 @@
 		{
 			IViewHelper helper = catalog.GetHelper ("directory_find_helper");
 			helper.Execute ();
-			AppContextList list = helper.Outcome as AppContextList;
+			AppEntryList list = helper.Outcome as AppEntryList;
 			// AppContextList list = helper.Context.Criteria["filter"] as AppContextList;
 			Assert.IsNotNull (list, "Expected list to be AppContextList");
-			AppContext row = list [0] as AppContext;
+			AppEntry row = list [0] as AppEntry;
 			Assert.IsNotNull (row, "Expected rows to be AppContexts");
 
 			string hired = row.hired;

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Forms/DirectoryTest.cs Fri Jun 24 06:48:49 2005
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+using System.Net;
 using NUnit.Extensions.Asp;
 using NUnit.Extensions.Asp.AspTester;
 using NUnit.Framework;
@@ -35,7 +36,6 @@
 		private DropDownListTester hours_list;
 		// TODO: private DropDownListTester editor_list;
 		private ButtonTester cmdListAll;
-		private ButtonTester cmdPrint;
 
 		private PanelTester pnlList;
 		private DataGridTester repList;
@@ -59,6 +59,9 @@
 		protected override void SetUp ()
 		{
 			base.SetUp ();
+			string[] userLanguages = {"en-us"};
+			Browser.UserLanguages = userLanguages;
+			Browser.Credentials = CredentialCache.DefaultCredentials;
 
 			pnlFind = new PanelTester ("pnlFind", CurrentWebForm);
 			last_name_list = new DropDownListTester (App.LAST_NAME_LIST, CurrentWebForm);
@@ -69,7 +72,6 @@
 			hours_list = new DropDownListTester (App.HOURS_LIST, CurrentWebForm);
 			// TODO: editor_list = new DropDownListTester (App.EDITOR_LIST, CurrentWebForm);
 			cmdListAll = new ButtonTester ("cmdListAll", CurrentWebForm);
-			cmdPrint = new ButtonTester ("cmdPrint", CurrentWebForm);
 
 			pnlList = new PanelTester ("pnlList", CurrentWebForm);
 			repList = new DataGridTester ("repList", CurrentWebForm);
@@ -92,7 +94,6 @@
 				WebAssert.Visible (list);
 			}
 			WebAssert.Visible (cmdListAll);
-			WebAssert.Visible (cmdPrint);
 			WebAssert.Visible (pnlList);
 			WebAssert.Visible (repList);
 			WebAssert.NotVisible (cmdAdd); // Visible if Editor

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/AppConfig.xml Fri Jun 24 06:48:49 2005
@@ -8,8 +8,12 @@
 	<object id="FieldTable" type="Nexus.Core.Tables.FieldTable">
 		<property name="AddFieldContexts">
 			<list>
-				<ref object="hired"/> 
+				<ref object="last_name"/> 
+				<ref object="first_name"/> 
 				<ref object="extension"/> 
+				<ref object="user_name"/> 
+				<ref object="hired"/> 
+				<ref object="hours"/> 				
 				<ref object="_filter"/> 
 				<ref object="_extension_list"/>
 				<ref object="_hired_list"/>
@@ -19,28 +23,51 @@
 			<list>
 				<ref object="DateTimeProcessor"/> 
 				<ref object="TelephoneProcessor"/> 
-				<ref object="AppProcessor"/> 
+				<ref object="EntryListProcessor"/> 
 				<ref object="ExtensionListProcessor"/>
 				<ref object="HiredListProcessor"/>
 			</list>
 		</property>
 	</object>
+
+	<object id="last_name" parent="BaseFieldContext">
+		<property name="ID"><value>last_name</value></property>	
+		<property name="Label"><value>Last Name</value></property>	
+	</object>
+
+	<object id="first_name" parent="BaseFieldContext">
+		<property name="ID"><value>first_name</value></property>	
+		<property name="Label"><value>First Name</value></property>	
+	</object>
+
+	<object id="user_name" parent="BaseFieldContext">
+		<property name="ID"><value>user_name</value></property>	
+		<property name="Label"><value>UserName</value></property>	
+	</object>
 	
+	<object id="extension" parent="BaseFieldContext">
+		<property name="ID"><value>extension</value></property>		
+		<property name="ProcessorID"><value>TelephoneProcessor</value></property>
+		<property name="Label"><value>Extension</value></property>	
+	</object>
+
 	<object id="hired" parent="BaseFieldContext">
 		<property name="ID"><value>hired</value></property>	
 		<property name="Alert"><value>{0} must be a valid date</value></property>
 		<property name="ProcessorID"><value>DateTimeProcessor</value></property>
+		<property name="Label"><value>Hired</value></property>	
 	</object>
-
-	<object id="extension" parent="BaseFieldContext">
-		<property name="ID"><value>extension</value></property>		
-		<property name="ProcessorID"><value>TelephoneProcessor</value></property>
+	
+	<object id="hours" parent="BaseFieldContext">
+		<property name="ID"><value>hours</value></property>	
+		<property name="Label"><value>Hours</value></property>	
 	</object>
 	
+
 	<!-- We need to "hash" the name with "_" to avoid conflict with the filter Command -->
 	<object id="_filter" parent="BaseFieldContext">
 		<property name="ID"><value>filter</value></property>
-		<property name="ProcessorID"><value>AppProcessor</value></property>
+		<property name="ProcessorID"><value>EntryListProcessor</value></property>
 	</object>
 		
 	<object id="_extension_list" parent="BaseFieldContext">
@@ -63,8 +90,8 @@
 		<property name="ID"><value>TelephoneProcessor</value></property>
 	</object>
 
-	<object id="AppProcessor" type="PhoneBook.Core.AppProcessor">
-		<property name="ID"><value>AppProcessor</value></property>
+	<object id="EntryListProcessor" type="PhoneBook.Core.AppEntryListProcessor">
+		<property name="ID"><value>EntryListProcessor</value></property>
 	</object>
 	
 	<object id="ExtensionListProcessor" parent="BaseKeyValueProcessor">

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Command/Catalog.xml Fri Jun 24 06:48:49 2005
@@ -9,6 +9,7 @@
 		<property name="RelatedIDs">
 			<list>
 				<value>filter</value>
+				<value>entry_key</value>
 				<value>last_name</value>
 				<value>first_name</value>
 				<value>extension</value>
@@ -72,7 +73,7 @@
 	</object>
 	
 		
-  <!-- helpers -->
+  <!-- directory1 helpers -->
 
   <object id="directory_view_helper" parent="BaseHelper" singleton="false">
 		<property name="Command">
@@ -85,5 +86,75 @@
 			<ref object="filter" />
 		</property>
   </object>
+  
+  <!-- directory2 helpers -->
+  
+  	<object id="BaseGridHelper" type="PhoneBook.Web.AppGridHelper, PhoneBook.Web" singleton="false">
+		<property name="Catalog">
+			<ref object="Catalog" />
+		</property>
+	</object>
+
+  <object id="directory_grid_helper" parent="BaseGridHelper" singleton="false">
+		<property name="ListHelper">
+			<ref object="directory_find_helper" />
+		</property>
+		<property name="SaveHelper">
+			<ref object="entry_save_helper" />
+		</property>
+		<property name="HasCriteria">
+			<value>true</value>
+		</property>
+		<property name="DataKeyField">
+			<value>entry_key</value>
+		</property>
+		<property name="FieldSet">
+			<list>
+				<ref object="first_name"/>
+				<ref object="last_name"/>
+				<ref object="extension"/> 
+				<ref object="user_name"/>
+				<ref object="hired"/> 
+				<ref object="hours"/>
+			</list>
+		</property>
+	</object>  
 
+  <object id="entry_save_helper" parent="BaseHelper" singleton="false">
+		<property name="Command">
+			<ref object="entry_save" />
+		</property>
+  </object>
+
+  <object id="entry_save" type="PhoneBook.Core.Commands.BaseSave, PhoneBook.Core">
+		<property name="ID">
+			<value>entry_save</value>
+		</property>
+		<property name="KeyID">
+			<value>entry_key</value>
+		</property>
+		<property name="InsertID">
+			<value>entry_insert</value>
+		</property>
+		<property name="UpdateID">
+			<value>entry_update</value>
+		</property>
+		<property name="RelatedIDs">
+			<list>
+				<value>entry_key</value>
+			</list>
+		</property>
+		<property name="RequiredIDs">
+			<list>
+				<value>first_name</value>
+				<value>last_name</value>
+				<value>extension</value>
+				<value>user_name</value>
+				<value>hours</value>
+				<value>hired</value>
+				<value>editor</value>
+			</list>
+		</property>
+	</object>
+  
 </objects>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Query/SelectAll.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Query/SelectAll.xml?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Query/SelectAll.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Test/Resources/Query/SelectAll.xml Fri Jun 24 06:48:49 2005
@@ -5,10 +5,25 @@
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 	xsi:noNamespaceSchemaLocation="SqlMap.xsd" >
 	
+    <parameterMaps>
+		
+   		<parameterMap id="entry_save_param">
+			<parameter property="last_name"/>
+			<parameter property="first_name"/>
+			<parameter property="extension"/>
+			<parameter property="user_name"/>
+			<parameter property="hired"/>
+			<parameter property="hours"/>
+			<parameter property="editor"/>
+   			<parameter property="entry_key"/>   		
+        </parameterMap>    		
+  	
+  	</parameterMaps>
+		
 	<statements>
 		<select id="filter" paramClass="Hashtable" resultClass="Hashtable">
 			SELECT 
-				pk_entry,
+				pk_entry AS entry_key,
 				last_name,
 				first_name,
 				extension,
@@ -38,8 +53,34 @@
 				</isNotNull>
 			</dynamic>			
 		</select>
-				
+
+		<insert id="entry_insert" parameterMap="entry_save_param">
+    		INSERT INTO entry (    			
+				last_name,
+				first_name,
+				extension,
+				user_name,
+				hired,
+				hours,
+				editor,
+				pk_entry
+				)
+			VALUES (?,?,?,?, ?,?,?,?)
+		</insert>		
+
+		<update id="entry_update" parameterMap="entry_save_param">
+			UPDATE entry SET
+				last_name=?,
+				first_name=?,
+				extension=?,
+				user_name=?,
+				hired=?,
+				hours=?,
+				editor=?
+			WHERE 
+				pk_entry=?
+		</update>
+						
 	</statements>
 	
-
 </sqlMap>

Added: struts/sandbox/trunk/overdrive/PhoneBook/Web/AppGridHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/AppGridHelper.cs?rev=201619&view=auto
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/AppGridHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/AppGridHelper.cs Fri Jun 24 06:48:49 2005
@@ -0,0 +1,15 @@
+using Nexus;
+using Nexus.Core;
+using PhoneBook.Core;
+
+namespace PhoneBook.Web
+{
+
+	public class AppGridHelper : GridViewHelper
+	{
+		public override IEntryList NewEntryList ()
+		{
+			return new AppEntryList();
+		}
+	}
+}

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx Fri Jun 24 06:48:49 2005
@@ -27,7 +27,7 @@
 			  <table><tr>
 			  <td colspan="6" >
 				  <asp:Button ID="cmdListAll" Runat="server"></asp:Button>
-				  <INPUT onclick="javascript:window.print();" type="button" value="PRINT" name="cmd_print" id="cmd_print"> </asp:Button>
+				  <INPUT onclick="javascript:window.print();" type="button" value="PRINT" name="cmd_print" id="cmd_print">
 			  </td>
 			  <tr>
 			  <td>Last Name</td>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory.aspx.cs Fri Jun 24 06:48:49 2005
@@ -2,7 +2,7 @@
 using System.Collections;
 using System.Web.UI.WebControls;
 using Nexus.Core.Helpers;
-using Spring.Web.UI;
+using System.Web.UI;
 
 namespace PhoneBook.Web.Forms
 {

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx Fri Jun 24 06:48:49 2005
@@ -49,18 +49,10 @@
 			<!-- LIST -->			
 			<asp:Panel ID="pnlList" Runat="server">
             	<asp:DataGrid id="repList" Runat="server" 
-					PagerStyle-Mode="NumericPages" AllowPaging="true" PageSize="10" AutoGenerateColumns=False>
+					PagerStyle-Mode="NumericPages" AllowPaging="true" PageSize="10" >
 					<HeaderStyle CssClass="HeaderStyle" BackColor="#CCCC99"></HeaderStyle>
 					<AlternatingItemStyle CssClass="AlternatingItemStyle" BackColor="#CCCC99"></AlternatingItemStyle>
 					<EditItemStyle CssClass="EditItemStyle"></EditItemStyle>
-					<Columns>
-						<asp:BoundColumn DataField="last_name" HeaderText="LAST NAME"></asp:BoundColumn>
-						<asp:BoundColumn DataField="first_name" HeaderText="FIRST NAME"></asp:BoundColumn>
-						<asp:BoundColumn DataField="extension" HeaderText="EXTENSION"></asp:BoundColumn>
-						<asp:BoundColumn DataField="user_name" HeaderText="USER"></asp:BoundColumn>
-						<asp:BoundColumn DataField="hired" HeaderText="HIRE DATE"></asp:BoundColumn>
-						<asp:BoundColumn DataField="hours" HeaderText="HOURS"></asp:BoundColumn>
-					</Columns>
             	</asp:DataGrid>
         		<p><asp:Button ID="cmdAdd" Runat="server"></asp:Button></p>
 			</asp:Panel>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Directory2.aspx.cs Fri Jun 24 06:48:49 2005
@@ -12,6 +12,7 @@
 	/// 
 	public class Directory2 : BaseGridPage
 	{
+
 		#region Messages
 
 		private const string msg_ADD_CMD = "ADD NEW";
@@ -27,7 +28,7 @@
 		/// <summary>
 		/// Display a list of error mesasges.
 		/// </summary>
-		public IViewHelper Page_Error
+		protected override IViewHelper Page_Error
 		{
 			set
 			{
@@ -204,5 +205,6 @@
 		}
 
 		#endregion
+
 	}
 }

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Forms/Web.config Fri Jun 24 06:48:49 2005
@@ -21,6 +21,8 @@
 		</object>
               
 		<object id="Directory2" type="Directory2.aspx">
+			<property name="Helper"><ref object="directory_grid_helper"/></property>
+		
 			<property name="ViewHelper"><ref object="directory_view_helper"/></property>		
 			<property name="FindHelper"><ref object="directory_find_helper"/></property>		
 		</object>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/AppConfig.xml Fri Jun 24 06:48:49 2005
@@ -8,8 +8,12 @@
 	<object id="FieldTable" type="Nexus.Core.Tables.FieldTable">
 		<property name="AddFieldContexts">
 			<list>
-				<ref object="hired"/> 
+				<ref object="last_name"/> 
+				<ref object="first_name"/> 
 				<ref object="extension"/> 
+				<ref object="user_name"/> 
+				<ref object="hired"/> 
+				<ref object="hours"/> 				
 				<ref object="_filter"/> 
 				<ref object="_extension_list"/>
 				<ref object="_hired_list"/>
@@ -19,28 +23,51 @@
 			<list>
 				<ref object="DateTimeProcessor"/> 
 				<ref object="TelephoneProcessor"/> 
-				<ref object="AppProcessor"/> 
+				<ref object="EntryListProcessor"/> 
 				<ref object="ExtensionListProcessor"/>
 				<ref object="HiredListProcessor"/>
 			</list>
 		</property>
 	</object>
+
+	<object id="last_name" parent="BaseFieldContext">
+		<property name="ID"><value>last_name</value></property>	
+		<property name="Label"><value>Last Name</value></property>	
+	</object>
+
+	<object id="first_name" parent="BaseFieldContext">
+		<property name="ID"><value>first_name</value></property>	
+		<property name="Label"><value>First Name</value></property>	
+	</object>
+
+	<object id="user_name" parent="BaseFieldContext">
+		<property name="ID"><value>user_name</value></property>	
+		<property name="Label"><value>UserName</value></property>	
+	</object>
 	
+	<object id="extension" parent="BaseFieldContext">
+		<property name="ID"><value>extension</value></property>		
+		<property name="ProcessorID"><value>TelephoneProcessor</value></property>
+		<property name="Label"><value>Extension</value></property>	
+	</object>
+
 	<object id="hired" parent="BaseFieldContext">
 		<property name="ID"><value>hired</value></property>	
 		<property name="Alert"><value>{0} must be a valid date</value></property>
 		<property name="ProcessorID"><value>DateTimeProcessor</value></property>
+		<property name="Label"><value>Hired</value></property>	
 	</object>
-
-	<object id="extension" parent="BaseFieldContext">
-		<property name="ID"><value>extension</value></property>		
-		<property name="ProcessorID"><value>TelephoneProcessor</value></property>
+	
+	<object id="hours" parent="BaseFieldContext">
+		<property name="ID"><value>hours</value></property>	
+		<property name="Label"><value>Hours</value></property>	
 	</object>
 	
+
 	<!-- We need to "hash" the name with "_" to avoid conflict with the filter Command -->
 	<object id="_filter" parent="BaseFieldContext">
 		<property name="ID"><value>filter</value></property>
-		<property name="ProcessorID"><value>AppProcessor</value></property>
+		<property name="ProcessorID"><value>EntryListProcessor</value></property>
 	</object>
 		
 	<object id="_extension_list" parent="BaseFieldContext">
@@ -63,8 +90,8 @@
 		<property name="ID"><value>TelephoneProcessor</value></property>
 	</object>
 
-	<object id="AppProcessor" type="PhoneBook.Core.AppProcessor">
-		<property name="ID"><value>AppProcessor</value></property>
+	<object id="EntryListProcessor" type="PhoneBook.Core.AppEntryListProcessor">
+		<property name="ID"><value>EntryListProcessor</value></property>
 	</object>
 	
 	<object id="ExtensionListProcessor" parent="BaseKeyValueProcessor">

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/Catalog.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/Catalog.xml?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/Catalog.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Command/Catalog.xml Fri Jun 24 06:48:49 2005
@@ -9,6 +9,7 @@
 		<property name="RelatedIDs">
 			<list>
 				<value>filter</value>
+				<value>entry_key</value>
 				<value>last_name</value>
 				<value>first_name</value>
 				<value>extension</value>
@@ -72,7 +73,7 @@
 	</object>
 	
 		
-  <!-- helpers -->
+  <!-- directory1 helpers -->
 
   <object id="directory_view_helper" parent="BaseHelper" singleton="false">
 		<property name="Command">
@@ -85,5 +86,75 @@
 			<ref object="filter" />
 		</property>
   </object>
+  
+  <!-- directory2 helpers -->
+  
+  	<object id="BaseGridHelper" type="PhoneBook.Web.AppGridHelper, PhoneBook.Web" singleton="false">
+		<property name="Catalog">
+			<ref object="Catalog" />
+		</property>
+	</object>
+
+  <object id="directory_grid_helper" parent="BaseGridHelper" singleton="false">
+		<property name="ListHelper">
+			<ref object="directory_find_helper" />
+		</property>
+		<property name="SaveHelper">
+			<ref object="entry_save_helper" />
+		</property>
+		<property name="HasCriteria">
+			<value>true</value>
+		</property>
+		<property name="DataKeyField">
+			<value>entry_key</value>
+		</property>
+		<property name="FieldSet">
+			<list>
+				<ref object="first_name"/>
+				<ref object="last_name"/>
+				<ref object="extension"/> 
+				<ref object="user_name"/>
+				<ref object="hired"/> 
+				<ref object="hours"/>
+			</list>
+		</property>
+	</object>  
 
+  <object id="entry_save_helper" parent="BaseHelper" singleton="false">
+		<property name="Command">
+			<ref object="entry_save" />
+		</property>
+  </object>
+
+  <object id="entry_save" type="PhoneBook.Core.Commands.BaseSave, PhoneBook.Core">
+		<property name="ID">
+			<value>entry_save</value>
+		</property>
+		<property name="KeyID">
+			<value>entry_key</value>
+		</property>
+		<property name="InsertID">
+			<value>entry_insert</value>
+		</property>
+		<property name="UpdateID">
+			<value>entry_update</value>
+		</property>
+		<property name="RelatedIDs">
+			<list>
+				<value>entry_key</value>
+			</list>
+		</property>
+		<property name="RequiredIDs">
+			<list>
+				<value>first_name</value>
+				<value>last_name</value>
+				<value>extension</value>
+				<value>user_name</value>
+				<value>hours</value>
+				<value>hired</value>
+				<value>editor</value>
+			</list>
+		</property>
+	</object>
+  
 </objects>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Query/SelectAll.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Query/SelectAll.xml?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Query/SelectAll.xml (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Resources/Query/SelectAll.xml Fri Jun 24 06:48:49 2005
@@ -5,10 +5,25 @@
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 	xsi:noNamespaceSchemaLocation="SqlMap.xsd" >
 	
+    <parameterMaps>
+		
+   		<parameterMap id="entry_save_param">
+			<parameter property="last_name"/>
+			<parameter property="first_name"/>
+			<parameter property="extension"/>
+			<parameter property="user_name"/>
+			<parameter property="hired"/>
+			<parameter property="hours"/>
+			<parameter property="editor"/>
+   			<parameter property="entry_key"/>   		
+        </parameterMap>    		
+  	
+  	</parameterMaps>
+		
 	<statements>
 		<select id="filter" paramClass="Hashtable" resultClass="Hashtable">
 			SELECT 
-				pk_entry,
+				pk_entry AS entry_key,
 				last_name,
 				first_name,
 				extension,
@@ -38,8 +53,34 @@
 				</isNotNull>
 			</dynamic>			
 		</select>
-				
+
+		<insert id="entry_insert" parameterMap="entry_save_param">
+    		INSERT INTO entry (    			
+				last_name,
+				first_name,
+				extension,
+				user_name,
+				hired,
+				hours,
+				editor,
+				pk_entry
+				)
+			VALUES (?,?,?,?, ?,?,?,?)
+		</insert>		
+
+		<update id="entry_update" parameterMap="entry_save_param">
+			UPDATE entry SET
+				last_name=?,
+				first_name=?,
+				extension=?,
+				user_name=?,
+				hired=?,
+				hours=?,
+				editor=?
+			WHERE 
+				pk_entry=?
+		</update>
+						
 	</statements>
 	
-
 </sqlMap>

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj?rev=201619&r1=201618&r2=201619&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj (original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Web.csproj Fri Jun 24 06:48:49 2005
@@ -144,6 +144,11 @@
         <Files>
             <Include>
                 <File
+                    RelPath = "AppGridHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "AppHelper.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -221,7 +226,7 @@
                 <File
                     RelPath = "Forms\Directory2.aspx.cs"
                     DependentUpon = "Directory2.aspx"
-                    SubType = "Code"
+                    SubType = "ASPXCodeBehind"
                     BuildAction = "Compile"
                 />
                 <File



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org