manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1603880 - /manifoldcf/branches/CONNECTORS-971/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
Date Thu, 19 Jun 2014 13:57:53 GMT
Author: kwright
Date: Thu Jun 19 13:57:53 2014
New Revision: 1603880

URL: http://svn.apache.org/r1603880
Log:
Add upgrade

Modified:
    manifoldcf/branches/CONNECTORS-971/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java

Modified: manifoldcf/branches/CONNECTORS-971/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-971/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java?rev=1603880&r1=1603879&r2=1603880&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-971/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
(original)
+++ manifoldcf/branches/CONNECTORS-971/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
Thu Jun 19 13:57:53 2014
@@ -176,7 +176,6 @@ public class Jobs extends org.apache.man
   public final static String lastTimeField = "lasttime";
   /** If active, paused, activewait, or pausedwait, the start time of the current session,
else null. */
   public final static String startTimeField = "starttime";
-  //public final static String lastCheckTimeField = "lastchecktime";
   /** This text data represents the seeding version string, which for many connectors is
simply the last time seeding was done */
   public final static String seedingVersionField = "seedingversion";
   /** If inactive, the end time of the LAST session, if any. */
@@ -378,6 +377,7 @@ public class Jobs extends org.apache.man
       // These are fields we want to get rid of.
       String oldOutputSpecField = "outputspec";
       String oldOutputNameField = "outputname";
+      String oldLastCheckTimeField = "lastchecktime";
 
       // A place to keep the outputs we find, so we can add them into the pipeline at the
end.
       IResultSet outputSet = null;
@@ -462,6 +462,33 @@ public class Jobs extends org.apache.man
           map.put(statusField,statusToString(STATUS_ACTIVESEEDING_UNINSTALLED));
           performUpdate(map,"WHERE "+query,list,null);
         }
+        if (existing.get(seedingVersionField) == null)
+        {
+          Map insertMap = new HashMap();
+          insertMap.put(seedingVersionField,new ColumnDescription("LONGTEXT",false,true,null,null,false));
+          performAlter(insertMap,null,null,null);
+          // Populate it with data from the old last check version field
+          IResultSet set = performQuery("SELECT "+idField+","+oldLastCheckTimeField+" FROM
"+getTableName(),null,null,null);
+          for (int i = 0; i < set.getRowCount(); i++)
+          {
+            IResultRow row = set.getRow(i);
+            Long jobID = (Long)row.getValue(idField);
+            Long oldTime = (Long)row.getValue(oldLastCheckTimeField);
+            if (oldTime != null)
+            {
+              HashMap map = new HashMap();
+              map.put(seedingVersionField,oldTime.toString());
+              ArrayList list = new ArrayList();
+              String query = buildConjunctionClause(list,new ClauseDescription[]{
+                new UnitaryClause(idField,jobID)});
+              performUpdate(map,"WHERE "+query,list,null);
+            }
+          }
+          List<String> deleteList = new ArrayList<String>();
+          deleteList.add(oldLastCheckTimeField);
+          performAlter(null,null,deleteList,null);
+        }
+        
         if (existing.get(oldOutputNameField) != null)
         {
           // Remove output name and spec fields, but first read them so we can put them into
the pipeline manager



Mime
View raw message