Added:
/branches/0.9.7/lib/commons-lang-2.4.jar
Modified:
/branches/0.9.7/.classpath
/branches/0.9.7/src/ca/sqlpower/matchmaker/munge/AddressCorrectionMungeStep.java
=======================================
--- /dev/null
+++ /branches/0.9.7/lib/commons-lang-2.4.jar Mon Jan 24 11:36:23 2011
Binary file, no diff available.
=======================================
--- /branches/0.9.7/.classpath Fri Jan 21 08:25:46 2011
+++ /branches/0.9.7/.classpath Mon Jan 24 11:36:23 2011
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="jdbc_drivers"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM
1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM
1.5.0"/>
<classpathentry kind="src" path="regress"/>
<classpathentry kind="src" path="testbed"/>
<classpathentry kind="lib" path="lib/commons-digester.jar"/>
@@ -48,6 +48,7 @@
<classpathentry exported="true" kind="lib" path="lib/je-3.3.75.jar"
sourcepath="libsrc/je-3.3.75_src.zip"/>
<classpathentry kind="lib" path="lib/antlr-3.1.1-runtime.jar"
sourcepath="libsrc/antlr-3.1.1-runtime_src.zip"/>
<classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/>
+ <classpathentry kind="lib" path="lib/commons-lang-2.4.jar"/>
<classpathentry combineaccessrules="false" exported="true" kind="src"
path="/sqlpower_library"/>
<classpathentry kind="lib" path="buildlib/junit.jar"/>
<classpathentry kind="output" path="bin"/>
=======================================
---
/branches/0.9.7/src/ca/sqlpower/matchmaker/munge/AddressCorrectionMungeStep.java
Wed Jan 20 13:09:10 2010
+++
/branches/0.9.7/src/ca/sqlpower/matchmaker/munge/AddressCorrectionMungeStep.java
Mon Jan 24 11:36:23 2011
@@ -25,6 +25,7 @@
import java.util.List;
import org.apache.log4j.Logger;
+import org.apache.commons.lang.StringUtils;
import ca.sqlpower.matchmaker.MatchMakerSession;
import ca.sqlpower.matchmaker.MatchMakerSessionContext;
@@ -289,6 +290,17 @@
return Boolean.TRUE;
}
+
+ private Boolean isAddressEqualToSuggested(Address address, Address
suggestedAddress) {
+ if (StringUtils.equals(address.getAddress(),
suggestedAddress.getAddress()) &&
+ StringUtils.equals(address.getMunicipality(),
suggestedAddress.getMunicipality()) &&
+ StringUtils.equals(address.getProvince(),
suggestedAddress.getProvince())) {
+ logger.debug("Suggested address is exactly the same, so skipping");
+ logger.debug("Only one suggestion and it's the same, so skipping");
+ return Boolean.TRUE;
+ }
+ return Boolean.FALSE;
+ }
private Boolean doCallParseAndCorrect() throws Exception{
addressCorrected = false;
@@ -343,12 +355,11 @@
return Boolean.TRUE;
} else if (suggestions.size() == 1) {
Address suggestedAddress = suggestions.get(0);
- if (address.getAddress().equals(suggestedAddress.getAddress()) &&
- address.getMunicipality().equals(suggestedAddress.getMunicipality())
&&
- address.getProvince().equals(suggestedAddress.getProvince())) {
logger.debug("Suggested address is exactly the same, so skipping");
- logger.debug("Only one suggestion and it's the same, so skipping");
- return Boolean.TRUE;
- }
+ Boolean isEqual = this.isAddressEqualToSuggested(address,
suggestedAddress);
+ if (Boolean.TRUE.equals(isEqual)) {
+ return isEqual;
+ }
+
}
} else if (setting == PoolFilterSetting.VALID_ONLY) {
if (!validator.isSerpValid()) {
@@ -367,11 +378,9 @@
// if only one suggestion and it's the same as the original, then skip
if (suggestions.size() == 1) {
Address suggestedAddress = suggestions.get(0);
- if (address.getAddress().equals(suggestedAddress.getAddress()) &&
-
address.getMunicipality().equals(suggestedAddress.getMunicipality()) &&
- address.getProvince().equals(suggestedAddress.getProvince())) {
logger.debug("Suggested address is exactly the same, so skipping");
- logger.debug("Only one suggestion and it's the same, so skipping");
- return Boolean.TRUE;
+ Boolean isEqual = this.isAddressEqualToSuggested(address,
suggestedAddress);
+ if (Boolean.TRUE.equals(isEqual)) {
+ return isEqual;
}
}
}