You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2010/07/26 10:41:44 UTC

svn commit: r979199 - /incubator/lcf/trunk/modules/connectors/jdbc/connector/org/apache/lcf/crawler/connectors/jdbc/JDBCConnector.java

Author: kwright
Date: Mon Jul 26 08:41:44 2010
New Revision: 979199

URL: http://svn.apache.org/viewvc?rev=979199&view=rev
Log:
Revise connector to deal with change to the way getValue() handles empty values, which was modified for API support.

Modified:
    incubator/lcf/trunk/modules/connectors/jdbc/connector/org/apache/lcf/crawler/connectors/jdbc/JDBCConnector.java

Modified: incubator/lcf/trunk/modules/connectors/jdbc/connector/org/apache/lcf/crawler/connectors/jdbc/JDBCConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/jdbc/connector/org/apache/lcf/crawler/connectors/jdbc/JDBCConnector.java?rev=979199&r1=979198&r2=979199&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/jdbc/connector/org/apache/lcf/crawler/connectors/jdbc/JDBCConnector.java (original)
+++ incubator/lcf/trunk/modules/connectors/jdbc/connector/org/apache/lcf/crawler/connectors/jdbc/JDBCConnector.java Mon Jul 26 08:41:44 2010
@@ -997,29 +997,34 @@ public class JDBCConnector extends org.a
   public void outputSpecificationBody(IHTTPOutput out, DocumentSpecification ds, String tabName)
     throws LCFException, IOException
   {
-    String idQuery = null;
-    String versionQuery = null;
-    String dataQuery = null;
+    String idQuery = "SELECT idfield AS $(IDCOLUMN) FROM documenttable WHERE modifydatefield > $(STARTTIME) AND modifydatefield <= $(ENDTIME)";
+    String versionQuery = "SELECT idfield AS $(IDCOLUMN), versionfield AS $(VERSIONCOLUMN) FROM documenttable WHERE idfield IN $(IDLIST)";
+    String dataQuery = "SELECT idfield AS $(IDCOLUMN), urlfield AS $(URLCOLUMN), datafield AS $(DATACOLUMN) FROM documenttable WHERE idfield IN $(IDLIST)";
 
     int i = 0;
     while (i < ds.getChildCount())
     {
       SpecificationNode sn = ds.getChild(i++);
       if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode))
+      {
         idQuery = sn.getValue();
+        if (idQuery == null)
+          idQuery = "";
+      }
       else if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode))
+      {
         versionQuery = sn.getValue();
+        if (versionQuery == null)
+          versionQuery = "";
+      }
       else if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode))
+      {
         dataQuery = sn.getValue();
+        if (dataQuery == null)
+          dataQuery = "";
+      }
     }
 
-    if (idQuery == null)
-      idQuery = "SELECT idfield AS $(IDCOLUMN) FROM documenttable WHERE modifydatefield > $(STARTTIME) AND modifydatefield <= $(ENDTIME)";
-    if (versionQuery == null)
-      versionQuery = "SELECT idfield AS $(IDCOLUMN), versionfield AS $(VERSIONCOLUMN) FROM documenttable WHERE idfield IN $(IDLIST)";
-    if (dataQuery == null)
-      dataQuery = "SELECT idfield AS $(IDCOLUMN), urlfield AS $(URLCOLUMN), datafield AS $(DATACOLUMN) FROM documenttable WHERE idfield IN $(IDLIST)";
-
     // The Queries tab
 
     if (tabName.equals("Queries"))
@@ -1253,29 +1258,34 @@ public class JDBCConnector extends org.a
   public void viewSpecification(IHTTPOutput out, DocumentSpecification ds)
     throws LCFException, IOException
   {
-    String idQuery = null;
-    String versionQuery = null;
-    String dataQuery = null;
+    String idQuery = "";
+    String versionQuery = "";
+    String dataQuery = "";
 
     int i = 0;
     while (i < ds.getChildCount())
     {
       SpecificationNode sn = ds.getChild(i++);
       if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode))
+      {
         idQuery = sn.getValue();
+        if (idQuery == null)
+          idQuery = "";
+      }
       else if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode))
+      {
         versionQuery = sn.getValue();
+        if (versionQuery == null)
+          versionQuery = "";
+      }
       else if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode))
+      {
         dataQuery = sn.getValue();
+        if (dataQuery == null)
+          dataQuery = "";
+      }
     }
 
-    if (idQuery == null)
-      idQuery = "";
-    if (versionQuery == null)
-      versionQuery = "";
-    if (dataQuery == null)
-      dataQuery = "";
-
     out.print(
 "<table class=\"displaytable\">\n"+
 "  <tr>\n"+
@@ -1820,11 +1830,23 @@ public class JDBCConnector extends org.a
       {
         SpecificationNode sn = ds.getChild(i++);
         if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.idQueryNode))
+        {
           idQuery = sn.getValue();
+          if (idQuery == null)
+            idQuery = "";
+        }
         else if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.versionQueryNode))
+        {
           versionQuery = sn.getValue();
+          if (versionQuery == null)
+            versionQuery = "";
+        }
         else if (sn.getType().equals(org.apache.lcf.crawler.connectors.jdbc.JDBCConstants.dataQueryNode))
+        {
           dataQuery = sn.getValue();
+          if (dataQuery == null)
+            dataQuery = "";
+        }
       }
 
     }