manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1501028 - in /manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira: JiraQueryResults.java JiraRepositoryConnector.java JiraSession.java
Date Tue, 09 Jul 2013 00:07:53 GMT
Author: kwright
Date: Tue Jul  9 00:07:52 2013
New Revision: 1501028

URL: http://svn.apache.org/r1501028
Log:
Standardize on using issue key (rather than ID) for a document identifier.  It's clearer,
and probably more general.

Modified:
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraQueryResults.java
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraQueryResults.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraQueryResults.java?rev=1501028&r1=1501027&r2=1501028&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraQueryResults.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraQueryResults.java
Tue Jul  9 00:07:52 2013
@@ -34,7 +34,7 @@ public class JiraQueryResults extends Ji
   // Specific keys we care about
   private final static String KEY_TOTAL = "total";
   private final static String KEY_ISSUES = "issues";
-  private final static String KEY_ID = "id";
+  private final static String KEY_KEY = "key";
 
   public JiraQueryResults() {
     super();
@@ -50,7 +50,7 @@ public class JiraQueryResults extends Ji
     for (Object issue : issues) {
       if (issue instanceof JSONObject) {
         JSONObject jo = (JSONObject)issue;
-        seedBuffer.add(jo.get(KEY_ID).toString());
+        seedBuffer.add(jo.get(KEY_KEY).toString());
       }
     }
   }

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java?rev=1501028&r1=1501027&r2=1501028&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraRepositoryConnector.java
Tue Jul  9 00:07:52 2013
@@ -739,11 +739,11 @@ public class JiraRepositoryConnector ext
         // Pick up the paths, and add them to the activities, before we join with the child
thread.
         while (true) {
           // The only kind of exceptions this can throw are going to shut the process down.
-          String issueID = seedBuffer.fetch();
-          if (issueID ==  null)
+          String issueKey = seedBuffer.fetch();
+          if (issueKey ==  null)
             break;
           // Add the pageID to the queue
-          activities.addSeedDocument("I"+issueID);
+          activities.addSeedDocument("I-"+issueKey);
         }
       } catch (InterruptedException e) {
         wasInterrupted = true;
@@ -801,14 +801,14 @@ public class JiraRepositoryConnector ext
     Logging.connectors.debug("JIRA: Inside processDocuments");
 
     for (int i = 0; i < documentIdentifiers.length; i++) {
-      // MHL for access tokens
+      String nodeId = documentIdentifiers[i];
+      String version = versions[i];
+      
       long startTime = System.currentTimeMillis();
       String errorCode = "FAILED";
       String errorDesc = StringUtils.EMPTY;
       Long fileSize = null;
       boolean doLog = false;
-      String nodeId = documentIdentifiers[i];
-      String version = versions[i];
       
       try {
         if (Logging.connectors.isDebugEnabled()) {
@@ -819,13 +819,17 @@ public class JiraRepositoryConnector ext
         if (!scanOnly[i]) {
           doLog = true;
 
-          if (nodeId.startsWith("I")) {
+          if (nodeId.startsWith("I-")) {
             // It's an issue
-            String issueID = nodeId.substring(1);
-            JiraIssue jiraFile = getIssue(issueID);
+            String issueKey = nodeId.substring(2);
+            JiraIssue jiraFile = getIssue(issueKey);
+            if (jiraFile == null) {
+              activities.deleteDocument(nodeId, version);
+              continue;
+            }
             
             if (Logging.connectors.isDebugEnabled()) {
-              Logging.connectors.debug("JIRA: have this file:\t" + jiraFile.getKey());
+              Logging.connectors.debug("JIRA: This issue exists: " + jiraFile.getKey());
             }
 
             // Unpack the version string

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java?rev=1501028&r1=1501027&r2=1501028&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraSession.java
Tue Jul  9 00:07:52 2013
@@ -264,9 +264,9 @@ public class JiraSession {
   /**
    * Get an individual issue.
    */
-  public JiraIssue getIssue(String id) throws IOException {
+  public JiraIssue getIssue(String issueKey) throws IOException {
     JiraIssue ji = new JiraIssue();
-    getRest("issue/" + id, ji);
+    getRest("issue/" + URLEncoder.encode(issueKey,"utf-8"), ji);
     return ji;
   }
 



Mime
View raw message