Author: lemovice
Date: Sat Oct 12 19:47:36 2013
New Revision: 4613
Log:
update module name according ancestris policy
Added:
trunk/AncestrisExtensions/place.geoname/nbproject/platform.properties
- copied unchanged from r4605,
/trunk/AncestrisExtensions/nbproject/platform.properties
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/Bundle.properties
- copied, changed from r4605,
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/Bundle.properties
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/GeonamesPlace.java
- copied, changed from r4607,
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/GeonamesPlace.java
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/GeonamesPlacesList.java
- copied, changed from r4607,
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/GeonamesPlacesList.java
Modified:
trunk/AncestrisExtensions/place.geoname/build.xml
trunk/AncestrisExtensions/place.geoname/manifest.mf
trunk/AncestrisExtensions/place.geoname/nbproject/build-impl.xml
trunk/AncestrisExtensions/place.geoname/nbproject/genfiles.properties
trunk/AncestrisExtensions/place.geoname/nbproject/project.properties
trunk/AncestrisExtensions/place.geoname/nbproject/project.xml
Modified: trunk/AncestrisExtensions/place.geoname/build.xml
==============================================================================
--- trunk/AncestrisExtensions/place.geoname/build.xml (original)
+++ trunk/AncestrisExtensions/place.geoname/build.xml Sat Oct 12 19:47:36 2013
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See
harness/README in the NetBeans platform --><!-- for some information on what
you could do (e.g. targets to override). --><!-- If you delete this file and
reopen the project it will be recreated. -->
-<project name="ancestris.place.geonames" default="netbeans" basedir=".">
- <description>Builds, tests, and runs the project
ancestris.place.geonames.</description>
+<project name="ancestris.modules.place.geonames" default="netbeans"
basedir=".">
+ <description>Builds, tests, and runs the project
ancestris.modules.place.geonames.</description>
<import file="nbproject/build-impl.xml"/>
<import file="${suite.dir}/nbproject/ancestris-tasks.xml"/>
<target name="jar" depends="ancestris-tasks.jar" />
Modified: trunk/AncestrisExtensions/place.geoname/manifest.mf
==============================================================================
--- trunk/AncestrisExtensions/place.geoname/manifest.mf (original)
+++ trunk/AncestrisExtensions/place.geoname/manifest.mf Sat Oct 12 19:47:36 2013
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
-OpenIDE-Module: ancestris.place.geonames
-OpenIDE-Module-Localizing-Bundle: ancestris/place/geonames/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
+OpenIDE-Module: ancestris.modules.place.geonames
+OpenIDE-Module-Localizing-Bundle:
ancestris/modules/place/geonames/Bundle.properties
+OpenIDE-Module-Specification-Version: 0.8
Modified: trunk/AncestrisExtensions/place.geoname/nbproject/build-impl.xml
==============================================================================
--- trunk/AncestrisExtensions/place.geoname/nbproject/build-impl.xml
(original)
+++ trunk/AncestrisExtensions/place.geoname/nbproject/build-impl.xml Sat Oct
12 19:47:36 2013
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
---><project name="ancestris.place.geonames-impl" basedir="..">
+--><project name="ancestris.modules.place.geonames-impl" basedir="..">
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
Modified: trunk/AncestrisExtensions/place.geoname/nbproject/genfiles.properties
==============================================================================
--- trunk/AncestrisExtensions/place.geoname/nbproject/genfiles.properties
(original)
+++ trunk/AncestrisExtensions/place.geoname/nbproject/genfiles.properties
Sat Oct 12 19:47:36 2013
@@ -3,6 +3,6 @@
[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated
files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never
regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=edd3ad3b
-nbproject/build-impl.xml.script.CRC32=8ffa56d2
+nbproject/build-impl.xml.data.CRC32=afddeee8
+nbproject/build-impl.xml.script.CRC32=fdd0be08
nbproject/[email protected]
Modified: trunk/AncestrisExtensions/place.geoname/nbproject/project.properties
==============================================================================
--- trunk/AncestrisExtensions/place.geoname/nbproject/project.properties
(original)
+++ trunk/AncestrisExtensions/place.geoname/nbproject/project.properties
Sat Oct 12 19:47:36 2013
@@ -1,2 +1,4 @@
javac.source=1.6
javac.compilerargs=-Xlint -Xlint:-serial
+license.file=../gpl-2.0.txt
+nbm.module.author=lemovice
Modified: trunk/AncestrisExtensions/place.geoname/nbproject/project.xml
==============================================================================
--- trunk/AncestrisExtensions/place.geoname/nbproject/project.xml
(original)
+++ trunk/AncestrisExtensions/place.geoname/nbproject/project.xml Sat Oct
12 19:47:36 2013
@@ -3,7 +3,7 @@
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
- <code-name-base>ancestris.place.geonames</code-name-base>
+ <code-name-base>ancestris.modules.place.geonames</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
@@ -23,16 +23,17 @@
</run-dependency>
</dependency>
<dependency>
- <code-name-base>ancestris.modules.jdom</code-name-base>
+ <code-name-base>ancestris.libs.geonames</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
- <specification-version>1.1.3</specification-version>
+ <release-version>1</release-version>
+ <specification-version>1.1.9</specification-version>
</run-dependency>
</dependency>
</module-dependencies>
<public-packages>
- <package>ancestris.place.geonames</package>
+ <package>ancestris.modules.place.geonames</package>
</public-packages>
</data>
</configuration>
Copied:
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/Bundle.properties
(from r4605,
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/Bundle.properties)
==============================================================================
---
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/Bundle.properties
(original)
+++
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/Bundle.properties
Sat Oct 12 19:47:36 2013
@@ -1 +1,2 @@
-OpenIDE-Module-Name=place.geoname
+OpenIDE-Module-Display-Category=Biblioth\u00e8ques
+OpenIDE-Module-Name=place.geonames
Copied:
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/GeonamesPlace.java
(from r4607,
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/GeonamesPlace.java)
==============================================================================
---
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/GeonamesPlace.java
(original)
+++
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/GeonamesPlace.java
Sat Oct 12 19:47:36 2013
@@ -1,9 +1,7 @@
-package ancestris.place.geonames;
+package ancestris.modules.place.geonames;
import ancestris.api.place.Place;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.geonames.InsufficientStyleException;
+import org.geonames.PostalCode;
import org.geonames.Toponym;
/**
@@ -12,9 +10,11 @@
*/
public class GeonamesPlace implements Place {
- private Toponym toponym = null;
+ private PostalCode postalCode= null;
+ private Toponym toponym= null;
- public GeonamesPlace(Toponym toponym) {
+ public GeonamesPlace(Toponym toponym, PostalCode postalCode) {
+ this.postalCode = postalCode;
this.toponym = toponym;
}
@@ -25,17 +25,12 @@
@Override
public String getCity() {
- return toponym.getName();
+ return postalCode.getPlaceName();
}
@Override
public String getFirstAvailableJurisdiction() {
- try {
- return toponym.getAdminCode1();
- } catch (InsufficientStyleException ex) {
- Logger.getLogger(GeonamesPlace.class.getName()).log(Level.SEVERE,
null, ex);
- return "";
- }
+ return postalCode.getAdminCode1();
}
@Override
@@ -57,20 +52,17 @@
public String[] getJurisdictions() {
String[] jurisdictions = new String[10];
int index = 0;
- try {
- jurisdictions[index++] = toponym.getName();
- jurisdictions[index++] = toponym.getAdminName1();
- jurisdictions[index++] = toponym.getAdminCode1();
- jurisdictions[index++] = toponym.getAdminName2();
- jurisdictions[index++] = toponym.getAdminCode2();
- jurisdictions[index++] = toponym.getAdminName3();
- jurisdictions[index++] = toponym.getAdminCode3();
- jurisdictions[index++] = toponym.getPostcode();
- jurisdictions[index++] = toponym.getCountryCode();
-
- } catch (InsufficientStyleException ex) {
- Logger.getLogger(GeonamesPlace.class.getName()).log(Level.SEVERE,
null, ex);
- }
+
+ jurisdictions[index++] = postalCode.getPlaceName();
+ jurisdictions[index++] = postalCode.getAdminName1();
+ jurisdictions[index++] = postalCode.getAdminCode1();
+ jurisdictions[index++] = postalCode.getAdminName2();
+ jurisdictions[index++] = postalCode.getAdminCode2();
+ jurisdictions[index++] = postalCode.getAdminName3();
+ jurisdictions[index++] = postalCode.getAdminCode3();
+ jurisdictions[index++] = postalCode.getPostalCode();
+ jurisdictions[index++] = postalCode.getCountryCode();
+
return jurisdictions;
}
@@ -86,23 +78,18 @@
@Override
public Double getLongitude() {
- return toponym.getLongitude();
+ return postalCode.getLongitude();
}
@Override
public Double getLatitude() {
- return toponym.getLatitude();
+ return postalCode.getLatitude();
}
@Override
public String toString() {
- try {
- return toponym.getName() + "," + toponym.getAdminName1() + ","
- + toponym.getAdminName2() + "," + toponym.getAdminName3()
+ ","
- + toponym.getPostcode() + "," + toponym.getCountryCode();
- } catch (InsufficientStyleException ex) {
- Logger.getLogger(GeonamesPlace.class.getName()).log(Level.SEVERE,
null, ex);
- return "";
- }
+ return postalCode.getPlaceName() + "," + postalCode.getAdminName1() +
","
+ + postalCode.getAdminName2() + "," +
postalCode.getAdminName3() + ","
+ + postalCode.getPostalCode() + "," +
postalCode.getCountryCode();
}
}
Copied:
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/GeonamesPlacesList.java
(from r4607,
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/GeonamesPlacesList.java)
==============================================================================
---
/trunk/AncestrisExtensions/place.geoname/src/ancestris/place/geonames/GeonamesPlacesList.java
(original)
+++
trunk/AncestrisExtensions/place.geoname/src/ancestris/modules/place/geonames/GeonamesPlacesList.java
Sat Oct 12 19:47:36 2013
@@ -1,11 +1,10 @@
-package ancestris.place.geonames;
+package ancestris.modules.place.geonames;
import ancestris.api.place.Place;
import ancestris.api.place.PlacesList;
import genj.gedcom.PropertyPlace;
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.geonames.*;
@@ -21,18 +20,44 @@
@Override
public List<Place> findPlace(PropertyPlace place) {
- ToponymSearchCriteria searchCriteria = new ToponymSearchCriteria();
- searchCriteria.setLanguage(Locale.getDefault().toString());
- searchCriteria.setStyle(Style.FULL);
- ToponymSearchResult searchResult;
+
+ ToponymSearchResult toponymSearchResult;
+ String[] jurisdictions = place.getJurisdictions();
try {
- searchCriteria.setQ(place.getDisplayValue().replaceAll(",", " "));
- searchResult = WebService.search(searchCriteria);
+ WebService.setUserName("lemovice");
+ int index = 0;
- for (Toponym toponym : searchResult.getToponyms()) {
- placesList.add(new GeonamesPlace(toponym));
+ do {
+ // parse format
+ StringBuilder result = new StringBuilder();
+ for (int i = index; i < jurisdictions.length; i++) {
+ result.append(jurisdictions[i].trim());
+ if (i < jurisdictions.length) {
+ result.append(" ");
+ }
+ }
+ index += 1;
+ ToponymSearchCriteria toponymSearchCriteria = new
ToponymSearchCriteria();
+ toponymSearchCriteria.setQ(result.toString());
+ toponymSearchResult = WebService.search(toponymSearchCriteria);
+
+ } while (index < jurisdictions.length &&
toponymSearchResult.getToponyms().isEmpty());
+
+ for (Toponym toponym : toponymSearchResult.getToponyms()) {
+ PostalCodeSearchCriteria postalCodeSearchCriteria = new
PostalCodeSearchCriteria();
+ postalCodeSearchCriteria.setStyle(Style.FULL);
+ List<PostalCode> postalCodeSearchResult;
+
+ postalCodeSearchCriteria.setPlaceName(toponym.getName());
+
postalCodeSearchCriteria.setCountryCode(toponym.getCountryCode());
+ postalCodeSearchResult =
WebService.postalCodeSearch(postalCodeSearchCriteria);
+
+ for (PostalCode postalCode : postalCodeSearchResult) {
+ placesList.add(new GeonamesPlace(toponym, postalCode));
+ }
}
+
return placesList;
} catch (Exception e) {
logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
---------------------------------------------------------------------
Site Web Ancestris : http://www.ancestris.org
<*> Pour vous desinscrire de cette liste, envoyez un mail a :
[email protected]
<*> Pour obtenir de l'aide sur les commandes de la liste :
[email protected]
Pour obtenir tous les messages lies a ce fil de discussion, cliquez sur le
lien ci-dessous, cela ouvrira votre logiciel de messagerie. Il vous suffira
d'envoyer le message :
[email protected]