svn commit: r1094505 - in /ofbiz/trunk/framework/common: data/GeoData_CN.xml src/org/ofbiz/common/CommonWorkers.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1094505 - in /ofbiz/trunk/framework/common: data/GeoData_CN.xml src/org/ofbiz/common/CommonWorkers.java

jleroux@apache.org
Author: jleroux
Date: Mon Apr 18 12:02:47 2011
New Revision: 1094505

URL: http://svn.apache.org/viewvc?rev=1094505&view=rev
Log:
A patch from Leon "Add "MUNICIPALITY" to getStateList's search condition to make "municipality" of china visible in state list" https://issues.apache.org/jira/browse/OFBIZ-4258

In china, city like "Shanghai","Beijing", "Chongqin" and "Tianjin" is municipality which is equivalent to province, but there's no such municipality in the state list displayed in client end.
In Geo entity, these municipalities is stored with geoTypeId="MUNICIPALITY", So I add it as a new search condition to CommonWorkers.getStateList to fix this issue.

Fixes some problem in current GeoData_CN.xml

Also changes the geoTypeId from "REGIONS" to "MUNICIPALITY" for some "Autonomous regions" and "Special administrative Regions" and add some missing country-state associations.
It's better to add new geo types for "Autonomous regions" or "Special Administrative Regions", but I don't want to make the thing complex if there's no such strong demand.


Modified:
    ofbiz/trunk/framework/common/data/GeoData_CN.xml
    ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java

Modified: ofbiz/trunk/framework/common/data/GeoData_CN.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/GeoData_CN.xml?rev=1094505&r1=1094504&r2=1094505&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/data/GeoData_CN.xml (original)
+++ ofbiz/trunk/framework/common/data/GeoData_CN.xml Mon Apr 18 12:02:47 2011
@@ -51,13 +51,13 @@ under the License.
     <Geo abbreviation="粤" geoCode="44" geoId="CN-44" geoName="广东" geoTypeId="PROVINCE" wellKnownText="Guangdong"/>
     <Geo abbreviation="闽" geoCode="35" geoId="CN-35" geoName="福建" geoTypeId="PROVINCE" wellKnownText="Fujian"/>
     <Geo abbreviation="台" geoCode="71" geoId="CN-71" geoName="台湾" geoTypeId="PROVINCE" wellKnownText="Taiwan"/>
-    <Geo abbreviation="桂" geoCode="45" geoId="CN-45" geoName="广西" geoTypeId="REGION" wellKnownText="Guangxi"/>
-    <Geo abbreviation="内蒙古" geoCode="15" geoId="CN-15" geoName="内蒙古" geoTypeId="REGION" wellKnownText="Inner Mongolia"/>
-    <Geo abbreviation="宁" geoCode="64" geoId="CN-64" geoName="宁夏" geoTypeId="REGION" wellKnownText="Ningxia"/>
-    <Geo abbreviation="新" geoCode="65" geoId="CN-65" geoName="新疆" geoTypeId="REGION" wellKnownText="Xinjiang"/>
-    <Geo abbreviation="藏" geoCode="54" geoId="CN-54" geoName="西藏" geoTypeId="REGION" wellKnownText="Tibet"/>
-    <Geo abbreviation="香港" geoCode="91" geoId="CN-91" geoName="香港" geoTypeId="REGION" wellKnownText="Hong Kong"/>
-    <Geo abbreviation="澳门" geoCode="92" geoId="CN-92" geoName="澳门" geoTypeId="REGION" wellKnownText="Macau"/>
+    <Geo abbreviation="桂" geoCode="45" geoId="CN-45" geoName="广西" geoTypeId="MUNICIPALITY" wellKnownText="Guangxi"/>
+    <Geo abbreviation="内蒙古" geoCode="15" geoId="CN-15" geoName="内蒙古" geoTypeId="MUNICIPALITY" wellKnownText="Inner Mongolia"/>
+    <Geo abbreviation="宁" geoCode="64" geoId="CN-64" geoName="宁夏" geoTypeId="MUNICIPALITY" wellKnownText="Ningxia"/>
+    <Geo abbreviation="新" geoCode="65" geoId="CN-65" geoName="新疆" geoTypeId="MUNICIPALITY" wellKnownText="Xinjiang"/>
+    <Geo abbreviation="藏" geoCode="54" geoId="CN-54" geoName="西藏" geoTypeId="MUNICIPALITY" wellKnownText="Tibet"/>
+    <Geo abbreviation="香港" geoCode="91" geoId="CN-91" geoName="香港" geoTypeId="MUNICIPALITY" wellKnownText="Hong Kong"/>
+    <Geo abbreviation="澳门" geoCode="92" geoId="CN-92" geoName="澳门" geoTypeId="MUNICIPALITY" wellKnownText="Macau"/>
 
     <GeoAssoc geoId="CHN" geoIdTo="CN-11" geoAssocTypeId="REGIONS"/>    
     <GeoAssoc geoId="CHN" geoIdTo="CN-50" geoAssocTypeId="REGIONS"/>
@@ -86,6 +86,8 @@ under the License.
     <GeoAssoc geoId="CHN" geoIdTo="CN-44" geoAssocTypeId="REGIONS"/>
     <GeoAssoc geoId="CHN" geoIdTo="CN-35" geoAssocTypeId="REGIONS"/>
     <GeoAssoc geoId="CHN" geoIdTo="CN-71" geoAssocTypeId="REGIONS"/>
+    <GeoAssoc geoId="CHN" geoIdTo="CN-45" geoAssocTypeId="REGIONS"/>
+    <GeoAssoc geoId="CHN" geoIdTo="CN-15" geoAssocTypeId="REGIONS"/>
     <GeoAssoc geoId="CHN" geoIdTo="CN-64" geoAssocTypeId="REGIONS"/>
     <GeoAssoc geoId="CHN" geoIdTo="CN-65" geoAssocTypeId="REGIONS"/>
     <GeoAssoc geoId="CHN" geoIdTo="CN-54" geoAssocTypeId="REGIONS"/>

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=1094505&r1=1094504&r2=1094505&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Mon Apr 18 12:02:47 2011
@@ -91,7 +91,7 @@ public class CommonWorkers {
         List<GenericValue> geoList = FastList.newInstance();
         EntityCondition condition = EntityCondition.makeCondition(EntityOperator.OR,
                 EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"),
-                EntityCondition.makeCondition("geoTypeId", "TERRITORY"));
+                EntityCondition.makeCondition("geoTypeId", "TERRITORY"), EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"));
         List<String> sortList = UtilMisc.toList("geoName");
         try {
             geoList = delegator.findList("Geo", condition, null, sortList, null, true);
@@ -119,6 +119,7 @@ public class CommonWorkers {
                 EntityCondition.makeCondition(EntityOperator.OR,
                         EntityCondition.makeCondition("geoTypeId", "STATE"),
                         EntityCondition.makeCondition("geoTypeId", "PROVINCE"),
+                        EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"),
                         EntityCondition.makeCondition("geoTypeId", "COUNTY")));
 
         if (UtilValidate.isEmpty(listOrderBy)) {