Author: gbayon
Date: Sat Sep 20 11:15:29 2008
New Revision: 697402

URL: http://svn.apache.org/viewvc?rev=697402&view=rev
Log:
fix IBATISNET-281

Added:
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessCaseElement.cs
      - copied, changed from r697358, 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessSubMapElement.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessDefaultElement.cs
   (with props)
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/CaseDeSerializer.cs
      - copied, changed from r697358, 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/SubMapDeSerializer.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Case.cs
      - copied, changed from r697358, 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/SubMap.cs
Removed:
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessSubMapElement.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/SubMapDeSerializer.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/SubMap.cs
Modified:
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Document.xml
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Mapping3.xml
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Apache.Ibatis.DataMapper.20005.csproj
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/ConfigConstants.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessArgumentElement.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/XmlMappingProcessor.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/DiscriminatorExpression.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/DiscriminatorDeSerializer.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Discriminator.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/NullResultMap.cs
    
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Document.xml
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Document.xml?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Document.xml
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Document.xml
 Sat Sep 20 11:15:29 2008
@@ -12,16 +12,16 @@
        <resultMaps>    
                <resultMap id="document" class="Document" 
extends="NewsPaper.baseDocument">
                        <result property="Test"                 
column="Document_Title"/>
-                       <discriminator column="Document_Type" type="string"> 
-                               <subMap value="Book" resultMapping="book" />
-                               <subMap value="Newspaper" 
resultMapping="NewsPaper.newspaper" />
+                       <discriminator column="Document_Type" type="string">
+        <case value="Newspaper" resultMap="NewsPaper.newspaper"/>
+        <default resultMap="book"/>
                        </discriminator>        
                </resultMap>
                
                <resultMap id="document-custom-handler" class="Document" 
extends="NewsPaper.baseDocument">
-                       <discriminator column="Document_Type"  
typeHandler="CustomInheritance"> 
-                               <subMap value="Book" resultMapping="book" />
-                               <subMap value="Newspaper" 
resultMapping="NewsPaper.newspaper" />
+                       <discriminator column="Document_Type"  
typeHandler="CustomInheritance">
+        <case value="Book" resultMap="book"/>
+        <case value="Newspaper" resultMap="NewsPaper.newspaper"/>
                        </discriminator>
                </resultMap>
                

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Mapping3.xml
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Mapping3.xml?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Mapping3.xml
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/Maps/Mapping3.xml
 Sat Sep 20 11:15:29 2008
@@ -13,16 +13,16 @@
                <resultMap id="document" class="Document" 
extends="NewsPaper.baseDocument">
                        <result property="Test"                 
column="Document_Title"/>
                        <discriminator column="Document_Type" type="string">
-                               <subMap value="Book" resultMapping="book" />
-                               <subMap value="Newspaper" 
resultMapping="NewsPaper.newspaper" />
-                       </discriminator >
-               </resultMap>
-
-               <resultMap id="document-custom-handler" class="Document" 
extends="NewsPaper.baseDocument">
-                       <discriminator column="Document_Type"  
typeHandler="CustomInheritance">
-                               <subMap value="Book" resultMapping="book" />
-                               <subMap value="Newspaper" 
resultMapping="NewsPaper.newspaper" />
-                       </discriminator >
+        <case value="Book" resultMap="book"/>
+        <case value="Newspaper" resultMap="NewsPaper.newspaper"/>
+      </discriminator >
+    </resultMap>
+
+    <resultMap id="document-custom-handler" class="Document" 
extends="NewsPaper.baseDocument">
+      <discriminator column="Document_Type"  typeHandler="CustomInheritance">
+        <case value="Book" resultMap="book"/>
+        <case value="Newspaper" resultMap="NewsPaper.newspaper"/>
+      </discriminator >
                </resultMap>
 
                <resultMap id="book" class="Book" extends="document">

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Apache.Ibatis.DataMapper.20005.csproj
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Apache.Ibatis.DataMapper.20005.csproj?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Apache.Ibatis.DataMapper.20005.csproj
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Apache.Ibatis.DataMapper.20005.csproj
 Sat Sep 20 11:15:29 2008
@@ -102,6 +102,7 @@
     <Compile Include="Configuration\DefaultConfigurationEngine.cs" />
     <Compile Include="Configuration\DefaultConfigurationStore.cs" />
     <Compile Include="Configuration\DefaultModelBuilder.cs" />
+    <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessDefaultElement.cs"
 />
     <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessIncludeElement.cs"
 />
     <Compile Include="Configuration\IConfigurationEngine.cs" />
     <Compile Include="Configuration\IConfigurationStore.cs" />
@@ -157,7 +158,7 @@
     <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessSqlElement.cs"
 />
     <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessSqlMapElement.cs"
 />
     <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessStatementElement.cs"
 />
-    <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessSubMapElement.cs"
 />
+    <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessCaseElement.cs"
 />
     <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessTextElement.cs"
 />
     <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessTypeAliasElement.cs"
 />
     <Compile 
Include="Configuration\Interpreters\Config\Xml\Processor\Handlers\ProcessTypeHandlerElement.cs"
 />
@@ -316,7 +317,7 @@
     <Compile Include="Configuration\Serializers\StatementDeSerializer.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Configuration\Serializers\SubMapDeSerializer.cs">
+    <Compile Include="Configuration\Serializers\CaseDeSerializer.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Configuration\Serializers\TypeAliasDeSerializer.cs">
@@ -434,7 +435,7 @@
     <Compile Include="Model\ResultMapping\ResultMapCollection.cs" />
     <Compile Include="Model\ResultMapping\ResultProperty.cs" />
     <Compile Include="Model\ResultMapping\ResultPropertyCollection.cs" />
-    <Compile Include="Model\ResultMapping\SubMap.cs" />
+    <Compile Include="Model\ResultMapping\Case.cs" />
     <Compile Include="Model\Sql\Dynamic\DynamicSql.cs" />
     <Compile Include="Model\Sql\Dynamic\Elements\BaseTag.cs" />
     <Compile Include="Model\Sql\Dynamic\Elements\Conditional.cs" />

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/ConfigConstants.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/ConfigConstants.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/ConfigConstants.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/ConfigConstants.cs
 Sat Sep 20 11:15:29 2008
@@ -263,6 +263,7 @@
         /// Token for attribute share.
         /// </summary>
         public const string ATTRIBUTE_SHARE = "share";
+ 
         #endregion
 
         #region Token element
@@ -339,7 +340,7 @@
         /// <summary>
         /// Token for xml path to subMap element.
         /// </summary>
-        public const string ELEMENT_SUBMAP = "subMap";
+        public const string ELEMENT_CASE = "case";
         /// <summary>
         /// Token for xml path to parameterMap element.
         /// </summary>
@@ -458,8 +459,11 @@
         /// <summary>
         /// Token for CDATA element.
         /// </summary>
-        public const string ELEMENT_CDATA = "CDATA"; 
-
+        public const string ELEMENT_CDATA = "CDATA";
+        /// <summary>
+        /// Token for default element.
+        /// </summary>
+        public const string ELEMENT_DEFAULT = "default"; 
 
         #endregion
 

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessArgumentElement.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessArgumentElement.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessArgumentElement.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessArgumentElement.cs
 Sat Sep 20 11:15:29 2008
@@ -23,12 +23,7 @@
  
********************************************************************************/
 #endregion
 
-using System;
-using System.Text;
-using System.Xml;
-
 using Apache.Ibatis.Common.Configuration;
-using Apache.Ibatis.Common.Resources;
 
 namespace 
Apache.Ibatis.DataMapper.Configuration.Interpreters.Config.Xml.Processor
 {

Copied: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessCaseElement.cs
 (from r697358, 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessSubMapElement.cs)
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessCaseElement.cs?p2=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessCaseElement.cs&p1=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessSubMapElement.cs&r1=697358&r2=697402&rev=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessSubMapElement.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessCaseElement.cs
 Sat Sep 20 11:15:29 2008
@@ -23,23 +23,18 @@
  
********************************************************************************/
 #endregion
 
-using System;
-using System.Text;
-using System.Xml;
-
 using Apache.Ibatis.Common.Configuration;
-using Apache.Ibatis.Common.Resources;
 
 namespace 
Apache.Ibatis.DataMapper.Configuration.Interpreters.Config.Xml.Processor
 {
     public partial class XmlMappingProcessor
     {
         /// <summary>
-        /// Processes the sub map element.
+        /// Processes the discriminator/case element.
         /// </summary>
         /// <param name="element">The element.</param>
         /// <param name="configurationStore">The configuration store.</param>
-        private void ProcessSubMapElement(Tag element, IConfigurationStore 
configurationStore)
+        private void ProcessCaseElement(Tag element, IConfigurationStore 
configurationStore)
         {
             if (element.Parent != null && element.Parent.Name == 
ConfigConstants.ELEMENT_DISCRIMINATOR)
             {
@@ -48,8 +43,8 @@
                     element.Attributes[ConfigConstants.ATTRIBUTE_VALUE]);
                 config.CreateAttributes(element.Attributes);
 
-                config.Attributes[ConfigConstants.ATTRIBUTE_RESULTMAPPING] =
-                        
ApplyNamespace(config.Attributes[ConfigConstants.ATTRIBUTE_RESULTMAPPING]);
+                config.Attributes[ConfigConstants.ATTRIBUTE_RESULTMAP] =
+                        
ApplyNamespace(config.Attributes[ConfigConstants.ATTRIBUTE_RESULTMAP]);
 
                 element.Parent.Configuration.Children.Add(config);
             }

Added: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessDefaultElement.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessDefaultElement.cs?rev=697402&view=auto
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessDefaultElement.cs
 (added)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessDefaultElement.cs
 Sat Sep 20 11:15:29 2008
@@ -0,0 +1,55 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 591621 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2008/2005 - 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.
+ * 
+ 
********************************************************************************/
+#endregion
+
+using Apache.Ibatis.Common.Configuration;
+using Apache.Ibatis.DataMapper.Model.ResultMapping;
+
+namespace 
Apache.Ibatis.DataMapper.Configuration.Interpreters.Config.Xml.Processor
+{
+    public partial class XmlMappingProcessor
+    {
+        /// <summary>
+        /// Processes the discriminator/default element.
+        /// </summary>
+        /// <param name="element">The element.</param>
+        /// <param name="configurationStore">The configuration store.</param>
+        private void ProcessDefaultElement(Tag element, IConfigurationStore 
configurationStore)
+        {
+            if (element.Parent != null && element.Parent.Name == 
ConfigConstants.ELEMENT_DISCRIMINATOR)
+            {
+                MutableConfiguration config = new MutableConfiguration(
+                    ConfigConstants.ELEMENT_CASE,
+                    Discriminator.DEFAULT_KEY);
+                config.CreateAttributes(element.Attributes);
+                config.CreateAttribute(ConfigConstants.ATTRIBUTE_VALUE, 
Discriminator.DEFAULT_KEY);
+
+                config.Attributes[ConfigConstants.ATTRIBUTE_RESULTMAP] =
+                        
ApplyNamespace(config.Attributes[ConfigConstants.ATTRIBUTE_RESULTMAP]);
+
+                element.Parent.Configuration.Children.Add(config);
+            }
+        }
+    }
+}

Propchange: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessDefaultElement.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/Handlers/ProcessDefaultElement.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/XmlMappingProcessor.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/XmlMappingProcessor.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/XmlMappingProcessor.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Interpreters/Config/Xml/Processor/XmlMappingProcessor.cs
 Sat Sep 20 11:15:29 2008
@@ -49,7 +49,8 @@
             RegisterElementHandler(ConfigConstants.ELEMENT_CONSTRUCTOR, 
ProcessConstructorElement);
             RegisterElementHandler(ConfigConstants.ELEMENT_RESULT, 
ProcessResultElement);
             RegisterElementHandler(ConfigConstants.ELEMENT_DISCRIMINATOR, 
ProcessDiscriminatorElement);
-            RegisterElementHandler(ConfigConstants.ELEMENT_SUBMAP, 
ProcessSubMapElement);
+            RegisterElementHandler(ConfigConstants.ELEMENT_CASE, 
ProcessCaseElement);
+            RegisterElementHandler(ConfigConstants.ELEMENT_DEFAULT, 
ProcessDefaultElement);
             RegisterElementHandler(ConfigConstants.ELEMENT_ARGUMENT, 
ProcessArgumentElement);
             RegisterElementHandler(ConfigConstants.ELEMENT_PARAMETERMAP, 
ProcessParameterMapElement);
             RegisterElementHandler(ConfigConstants.ELEMENT_PARAMETER, 
ProcessParameterElement);

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/DiscriminatorExpression.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/DiscriminatorExpression.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/DiscriminatorExpression.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/DiscriminatorExpression.cs
 Sat Sep 20 11:15:29 2008
@@ -57,8 +57,8 @@
             Contract.Require.That(id, Is.Not.Null & 
Is.Not.Empty).When("retrieving id argument in UsingResultMap method");
 
             id = builder.ApplyNamespace(id);
-            currentSubMap = new 
MutableConfiguration(ConfigConstants.ELEMENT_SUBMAP, id);
-            
currentSubMap.CreateAttribute(ConfigConstants.ATTRIBUTE_RESULTMAPPING, id);
+            currentSubMap = new 
MutableConfiguration(ConfigConstants.ELEMENT_CASE, id);
+            currentSubMap.CreateAttribute(ConfigConstants.ATTRIBUTE_RESULTMAP, 
id);
             parentConfiguration.Children.Add(currentSubMap);
  
             return this;

Copied: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/CaseDeSerializer.cs
 (from r697358, 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/SubMapDeSerializer.cs)
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/CaseDeSerializer.cs?p2=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/CaseDeSerializer.cs&p1=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/SubMapDeSerializer.cs&r1=697358&r2=697402&rev=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/SubMapDeSerializer.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/CaseDeSerializer.cs
 Sat Sep 20 11:15:29 2008
@@ -23,36 +23,29 @@
  
********************************************************************************/
 #endregion
 
-#region Using
 
-using System.Collections.Specialized;
-using System.Xml;
 using Apache.Ibatis.Common.Configuration;
-using Apache.Ibatis.Common.Xml;
 using Apache.Ibatis.DataMapper.Model.ResultMapping;
-using Apache.Ibatis.DataMapper.Scope;
 using Apache.Ibatis.DataMapper.Configuration.Interpreters.Config;
-#endregion 
-
 
 namespace Apache.Ibatis.DataMapper.Configuration.Serializers
 {
        /// <summary>
-       /// Summary description for SubMapDeSerializer.
+       /// Summary description for CaseDeSerializer.
        /// </summary>
-       public sealed class SubMapDeSerializer
+       public sealed class CaseDeSerializer
        {
         /// <summary>
-        /// Build a SubMap object
+        /// Build a Case object
         /// </summary>
         /// <param name="configuration">The configuration.</param>
-        /// <returns>a SubMap object</returns>
-        public static SubMap Deserialize(IConfiguration configuration)
+        /// <returns>a Case object</returns>
+        public static Case Deserialize(IConfiguration configuration)
         {
             string discriminatorValue = 
ConfigurationUtils.GetStringAttribute(configuration.Attributes, 
ConfigConstants.ATTRIBUTE_VALUE);
-            string resultMapName = 
ConfigurationUtils.GetStringAttribute(configuration.Attributes, 
ConfigConstants.ATTRIBUTE_RESULTMAPPING);
+            string resultMapName = 
ConfigurationUtils.GetStringAttribute(configuration.Attributes, 
ConfigConstants.ATTRIBUTE_RESULTMAP);
 
-            return new SubMap(discriminatorValue, resultMapName);
+            return new Case(discriminatorValue, resultMapName);
         }
 
        }

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/DiscriminatorDeSerializer.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/DiscriminatorDeSerializer.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/DiscriminatorDeSerializer.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/DiscriminatorDeSerializer.cs
 Sat Sep 20 11:15:29 2008
@@ -51,13 +51,13 @@
         /// <param name="configuration">The configuration.</param>
         /// <param name="resultClass">The result class.</param>
         /// <param name="dataExchangeFactory">The data exchange 
factory.</param>
-        /// <param name="subMaps">The sub maps.</param>
+        /// <param name="cases">The case element.</param>
         /// <returns></returns>
         public static Discriminator Deserialize(
             IConfiguration configuration,
             Type resultClass, 
             DataExchangeFactory dataExchangeFactory, 
-            IList<SubMap> subMaps)
+            IList<Case> cases)
         {
             string callBackName = 
ConfigurationUtils.GetStringAttribute(configuration.Attributes, 
ConfigConstants.ATTRIBUTE_TYPEHANDLER);
             string clrType = 
ConfigurationUtils.GetStringAttribute(configuration.Attributes, 
ConfigConstants.ATTRIBUTE_TYPE);
@@ -73,7 +73,7 @@
                 columnName, 
                 dbType, 
                 nullValue,
-                subMaps,
+                cases,
                 resultClass,
                 dataExchangeFactory
                 );

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
 Sat Sep 20 11:15:29 2008
@@ -257,27 +257,27 @@
             WaitDiscriminatorResolution waitDiscriminatorResolution)
         {
             Discriminator discriminator = null;
-            // Build the Discriminator/SubMap Property
+            // Build the Discriminator/Case Property
 
             ConfigurationCollection discriminatorsConfig = 
resultMapConfig.Children.Find(ConfigConstants.ELEMENT_DISCRIMINATOR);
             if (discriminatorsConfig.Count > 0)
             {
                 //configScope.ErrorContext.MoreInfo = "initialize 
discriminator";
 
-                // Find the subMaps
-                IList<SubMap> subMaps = new List<SubMap>();
-                ConfigurationCollection subMapsConfig = 
discriminatorsConfig[0].Children.Find(ConfigConstants.ELEMENT_SUBMAP);
-                foreach (IConfiguration subMapConfig in subMapsConfig)
+                // Find the cases
+                IList<Case> cases = new List<Case>();
+                ConfigurationCollection caseConfigs = 
discriminatorsConfig[0].Children.Find(ConfigConstants.ELEMENT_CASE);
+                foreach (IConfiguration caseConfig in caseConfigs)
                 {
-                    SubMap subMap = 
SubMapDeSerializer.Deserialize(subMapConfig);
-                    subMaps.Add(subMap);
+                    Case caseElement = 
CaseDeSerializer.Deserialize(caseConfig);
+                    cases.Add(caseElement);
                 }
 
                 discriminator = DiscriminatorDeSerializer.Deserialize(
                     discriminatorsConfig[0], 
                     resultClass, 
                     dataExchangeFactory,
-                    subMaps
+                    cases
                     );
                 waitDiscriminatorResolution(discriminator);
             }

Copied: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Case.cs 
(from r697358, 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/SubMap.cs)
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Case.cs?p2=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Case.cs&p1=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/SubMap.cs&r1=697358&r2=697402&rev=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/SubMap.cs 
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Case.cs 
Sat Sep 20 11:15:29 2008
@@ -35,11 +35,11 @@
 namespace Apache.Ibatis.DataMapper.Model.ResultMapping
 {
        /// <summary>
-       /// Summary description for SubMap.
+       /// Summary description for Case.
        /// </summary>
        [Serializable]
-    [DebuggerDisplay("SubMap: {discriminatorValue}-{resultMapName}")]
-       public class SubMap
+    [DebuggerDisplay("case: {discriminatorValue}-{resultMapName}")]
+       public class Case
        {
                #region Fields
                [NonSerialized]
@@ -82,14 +82,14 @@
                #region Constructor
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="SubMap"/> class.
+        /// Initializes a new instance of the <see cref="Case"/> class.
         /// </summary>
         /// <param name="discriminatorValue">The discriminator value.</param>
         /// <param name="resultMapName">Name of the result map.</param>
-        public SubMap(string discriminatorValue, string resultMapName)
+        public Case(string discriminatorValue, string resultMapName)
                {
-            Contract.Require.That(discriminatorValue, Is.Not.Null & 
Is.Not.Empty).When("retrieving argument discriminatorValue in SubMap 
constructor");
-            Contract.Require.That(resultMapName, Is.Not.Null & 
Is.Not.Empty).When("retrieving argument resultMapName in SubMap constructor");
+            Contract.Require.That(discriminatorValue, Is.Not.Null & 
Is.Not.Empty).When("retrieving argument discriminatorValue in Case 
constructor");
+            Contract.Require.That(resultMapName, Is.Not.Null & 
Is.Not.Empty).When("retrieving argument resultMapName in Case constructor");
 
             this.discriminatorValue = discriminatorValue;
             this.resultMapName = resultMapName;

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Discriminator.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Discriminator.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Discriminator.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/Discriminator.cs
 Sat Sep 20 11:15:29 2008
@@ -46,6 +46,7 @@
     public class Discriminator
        {
         private static readonly ILog logger = 
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+        public const string DEFAULT_KEY = "\002_DEFAULT_KEY_\002";
 
                #region Fields
                [NonSerialized]
@@ -56,10 +57,10 @@
                [NonSerialized]
                private readonly IDictionary<string, IResultMap> resultMaps = 
null;
                /// <summary>
-               /// The subMaps name who used this discriminator
+               /// The case value who used this discriminator
                /// </summary>
                [NonSerialized]
-               private readonly IList<SubMap> subMaps = null;
+               private readonly IList<Case> cases = null;
 
                [NonSerialized]
                private readonly string nullValue = string.Empty;
@@ -156,7 +157,7 @@
         /// <param name="columnName">Name of the column.</param>
         /// <param name="dbType">Type of the db.</param>
         /// <param name="nullValue">The null value.</param>
-        /// <param name="subMaps">The sub maps.</param>
+        /// <param name="cases">The cases.</param>
         /// <param name="resultClass">The result class.</param>
         /// <param name="dataExchangeFactory">The data exchange 
factory.</param>
         public Discriminator(
@@ -166,7 +167,7 @@
             string columnName,
             string dbType,
             string nullValue,
-            IList<SubMap> subMaps,
+            IList<Case> cases,
             Type resultClass,
             DataExchangeFactory dataExchangeFactory)
                {
@@ -178,7 +179,7 @@
             this.columnIndex = columnIndex;
             this.columnName = columnName;
             this.dbType = dbType;
-            this.subMaps = subMaps;
+            this.cases = cases;
 
                        resultMaps = new Dictionary<string, IResultMap>();
 
@@ -210,16 +211,16 @@
         public void Initialize(IModelStore modelStore)
                {
                        // Set the ResultMaps
-                       int count = subMaps.Count;
+                       int count = cases.Count;
                        for(int index=0; index<count; index++)
                        {
-                               SubMap subMap = subMaps[index];
-                resultMaps.Add(subMap.DiscriminatorValue, 
modelStore.GetResultMap(subMap.ResultMapName) );
+                               Case kase = cases[index];
+                resultMaps.Add(kase.DiscriminatorValue, 
modelStore.GetResultMap(kase.ResultMapName));
                        }
                }
 
                /// <summary>
-               /// Find the SubMap to use.
+               /// Find the Case to use.
                /// </summary>
                /// <param name="discriminatorValue">the discriminator 
value</param>
                /// <returns>The find ResultMap</returns>
@@ -228,7 +229,14 @@
             IResultMap resultMap = null;
             if (!resultMaps.TryGetValue(discriminatorValue, out resultMap))
             {
-                logger.Info("There's no SubMap for the key '" + 
discriminatorValue + "'. Checks yours mapping files.");
+                logger.Info("There's no Case for the key '" + 
discriminatorValue + "'. Checks yours mapping files.");
+            }
+            if (resultMap==null)
+            {
+                if (!resultMaps.TryGetValue(DEFAULT_KEY, out resultMap))
+                {
+                    logger.Info("There's no Case for the key '" + 
discriminatorValue + "'. Checks yours mapping files.");                   
+                }
             }
             return resultMap;
                }

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/NullResultMap.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/NullResultMap.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/NullResultMap.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/NullResultMap.cs
 Sat Sep 20 11:15:29 2008
@@ -83,7 +83,7 @@
         }
 
         /// <summary>
-        /// The discriminator used to choose the good SubMap
+        /// The discriminator used to choose the good Case
         /// </summary>
         public Discriminator Discriminator
         {
@@ -146,10 +146,10 @@
         /// <summary>
         /// Create an instance Of result.
         /// </summary>
-        /// <param name="parameters">An array of values that matches the 
number, order and type
+        /// <param name="parms">An array of values that matches the number, 
order and type
         /// of the parameters for this constructor.</param>
         /// <returns>An object.</returns>
-        public object CreateInstanceOfResult(object[] parameters)
+        public object CreateInstanceOfResult(object[] parms)
         {
             return null;
         }

Modified: 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
 (original)
+++ 
ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
 Sat Sep 20 11:15:29 2008
@@ -107,7 +107,7 @@
         }
 
         /// <summary>
-        /// The discriminator used to choose the good SubMap
+        /// The discriminator used to choose the good Case
         /// </summary>
         public Discriminator Discriminator
         {
@@ -295,7 +295,7 @@
 
 
         /// <summary>
-        /// Resolve the SubMap
+        /// Resolve the submap
         /// </summary>
         /// <param name="dataReader"></param>
         /// <returns></returns>

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd?rev=697402&r1=697401&r2=697402&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd Sat Sep 20 
11:15:29 2008
@@ -30,7 +30,8 @@
        <xs:element name="discriminator">
                <xs:complexType>
                        <xs:sequence>
-                               <xs:element ref="subMap" minOccurs="0" 
maxOccurs="unbounded"/>
+                               <xs:element ref="case" minOccurs="0" 
maxOccurs="unbounded"/>
+                               <xs:element ref="default" minOccurs="0" 
maxOccurs="1"/>
                        </xs:sequence>
                        <xs:attribute name="column" type="xs:string"/>
                        <xs:attribute name="type" type="xs:string"/>
@@ -38,10 +39,16 @@
                </xs:complexType>
        </xs:element>
 
-       <xs:element name="subMap">
+       <xs:element name="case">
                <xs:complexType>
                        <xs:attribute name="value" use="required" 
type="xs:string"/>
-                       <xs:attribute name="resultMapping" use="required" 
type="xs:string"/>
+                       <xs:attribute name="resultMap" use="required" 
type="xs:string"/>
+               </xs:complexType>
+       </xs:element>
+
+       <xs:element name="default">
+               <xs:complexType>
+                       <xs:attribute name="resultMap" use="required" 
type="xs:string"/>
                </xs:complexType>
        </xs:element>
 


Reply via email to