manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1501627 - /manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/
Date Wed, 10 Jul 2013 01:22:56 GMT
Author: kwright
Date: Wed Jul 10 01:22:55 2013
New Revision: 1501627

URL: http://svn.apache.org/r1501627
Log:
Debug connector

Modified:
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraIssue.java
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraJSONResponse.java
    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
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraUserQueryResults.java

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraIssue.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraIssue.java?rev=1501627&r1=1501626&r2=1501627&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraIssue.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraIssue.java
Wed Jul 10 01:22:55 2013
@@ -49,21 +49,21 @@ public class JiraIssue extends JiraJSONR
   }
 
   public String getKey() {
-    Object key = object.get(KEY_KEY);
+    Object key = ((JSONObject)object).get(KEY_KEY);
     if (key == null)
       return null;
     return key.toString();
   }
   
   public String getSelf() {
-    Object key = object.get(KEY_SELF);
+    Object key = ((JSONObject)object).get(KEY_SELF);
     if (key == null)
       return null;
     return key.toString();
   }
   
   public Date getCreatedDate() {
-    JSONObject fields = (JSONObject)object.get(KEY_FIELDS);
+    JSONObject fields = (JSONObject)((JSONObject)object).get(KEY_FIELDS);
     if (fields == null)
       return null;
     Object createdDate = fields.get(KEY_CREATED);
@@ -73,7 +73,7 @@ public class JiraIssue extends JiraJSONR
   }
   
   public Date getUpdatedDate() {
-    JSONObject fields = (JSONObject)object.get(KEY_FIELDS);
+    JSONObject fields = (JSONObject)((JSONObject)object).get(KEY_FIELDS);
     if (fields == null)
       return null;
     Object updatedDate = fields.get(KEY_UPDATED);
@@ -83,7 +83,7 @@ public class JiraIssue extends JiraJSONR
   }
   
   public String getDescription() {
-    JSONObject fields = (JSONObject)object.get(KEY_FIELDS);
+    JSONObject fields = (JSONObject)((JSONObject)object).get(KEY_FIELDS);
     if (fields == null)
       return null;
     Object description = fields.get(KEY_DESCRIPTION);
@@ -93,7 +93,7 @@ public class JiraIssue extends JiraJSONR
   }
   
   public String getSummary() {
-    JSONObject fields = (JSONObject)object.get(KEY_FIELDS);
+    JSONObject fields = (JSONObject)((JSONObject)object).get(KEY_FIELDS);
     if (fields == null)
       return null;
     Object summary = fields.get(KEY_SUMMARY);
@@ -104,7 +104,7 @@ public class JiraIssue extends JiraJSONR
   
   public Map<String,String[]> getMetadata() {
     Map<String,List<String>> map = new HashMap<String,List<String>>();
-    JSONObject fields = (JSONObject)object.get(KEY_FIELDS);
+    JSONObject fields = (JSONObject)((JSONObject)object).get(KEY_FIELDS);
     if (fields != null)
       addMetadataToMap("", fields, map);
     

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraJSONResponse.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraJSONResponse.java?rev=1501627&r1=1501626&r2=1501627&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraJSONResponse.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraJSONResponse.java
Wed Jul 10 01:22:55 2013
@@ -32,14 +32,14 @@ import org.json.simple.JSONObject;
 */
 public class JiraJSONResponse {
 
-  protected JSONObject object = null;
+  protected Object object = null;
 
   public JiraJSONResponse() {
   }
   
   /** Receive a parsed JSON object.
   */
-  public void acceptJSONObject(JSONObject object) {
+  public void acceptJSONObject(Object object) {
     this.object = object;
   }
   

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=1501627&r1=1501626&r2=1501627&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
Wed Jul 10 01:22:55 2013
@@ -41,12 +41,12 @@ public class JiraQueryResults extends Ji
   }
 
   public Long getTotal() {
-    return (Long)object.get(KEY_TOTAL);
+    return (Long)((JSONObject)object).get(KEY_TOTAL);
   }
   
   public void pushIds(XThreadStringBuffer seedBuffer)
     throws IOException, InterruptedException {
-    JSONArray issues = (JSONArray)object.get(KEY_ISSUES);
+    JSONArray issues = (JSONArray)((JSONObject)object).get(KEY_ISSUES);
     for (Object issue : issues) {
       if (issue instanceof JSONObject) {
         JSONObject jo = (JSONObject)issue;

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=1501627&r1=1501626&r2=1501627&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
Wed Jul 10 01:22:55 2013
@@ -883,6 +883,7 @@ public class JiraRepositoryConnector ext
                 activities.ingestDocument(nodeId, version, documentURI, rd);
                 // No errors.  Record the fact that we made it.
                 errorCode = "OK";
+                fileSize = new Long(documentBytes.length);
               } finally {
                 is.close();
               }
@@ -910,7 +911,7 @@ public class JiraRepositoryConnector ext
         body.append(" : ");
       body.append(description);
     }
-    return description.toString();
+    return body.toString();
   }
 
   /**

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=1501627&r1=1501626&r2=1501627&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
Wed Jul 10 01:22:55 2013
@@ -143,7 +143,7 @@ public class JiraSession {
     connectionManager = null;
   }
 
-  private static JSONObject convertToJSON(HttpResponse httpResponse)
+  private static Object convertToJSON(HttpResponse httpResponse)
     throws IOException {
     HttpEntity entity = httpResponse.getEntity();
     if (entity != null) {
@@ -153,7 +153,7 @@ public class JiraSession {
         if (charSet == null)
           charSet = "utf-8";
         Reader r = new InputStreamReader(is,charSet);
-        return (JSONObject)JSONValue.parse(r);
+        return JSONValue.parse(r);
       } finally {
         is.close();
       }
@@ -201,7 +201,7 @@ public class JiraSession {
       int resultCode = httpResponse.getStatusLine().getStatusCode();
       if (resultCode != 200)
         throw new IOException("Unexpected result code "+resultCode+": "+convertToString(httpResponse));
-      JSONObject jo = convertToJSON(httpResponse);
+      Object jo = convertToJSON(httpResponse);
       response.acceptJSONObject(jo);
     } finally {
       method.abort();
@@ -247,17 +247,14 @@ public class JiraSession {
     List<String> rval = new ArrayList<String>();
     long startAt = 0L;
     long setSize = 100L;
-    long totalAmt = 0L;
-    do {
+    while (true) {
       JiraUserQueryResults qr = new JiraUserQueryResults();
-      getRest("user/viewissue/search?issueKey="+URLEncoder.encode(issueKey,"utf-8")+"&maxResults="
+ setSize + "&startAt=" + startAt, qr);
-      Long total = qr.getTotal();
-      if (total == null)
-        break;
-      totalAmt = total.longValue();
+      getRest("user/viewissue/search?username=&issueKey="+URLEncoder.encode(issueKey,"utf-8")+"&maxResults="
+ setSize + "&startAt=" + startAt, qr);
       qr.getNames(rval);
       startAt += setSize;
-    } while (startAt < totalAmt);
+      if (rval.size() < startAt)
+        break;
+    }
     return rval;
   }
 

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraUserQueryResults.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraUserQueryResults.java?rev=1501627&r1=1501626&r2=1501627&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraUserQueryResults.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/jira/JiraUserQueryResults.java
Wed Jul 10 01:22:55 2013
@@ -34,8 +34,6 @@ import org.json.simple.JSONArray;
 public class JiraUserQueryResults extends JiraJSONResponse {
 
   // Specific keys we care about
-  private final static String KEY_TOTAL = "total";
-  private final static String KEY_USERS = "users";
   private final static String KEY_NAME = "name";
 
   public JiraUserQueryResults() {
@@ -43,17 +41,13 @@ public class JiraUserQueryResults extend
   }
 
   public void getNames(List<String> nameBuffer) {
-    JSONArray issues = (JSONArray)object.get(KEY_USERS);
-    for (Object issue : issues) {
-      if (issue instanceof JSONObject) {
-        JSONObject jo = (JSONObject)issue;
+    JSONArray users = (JSONArray)object;
+    for (Object user : users) {
+      if (user instanceof JSONObject) {
+        JSONObject jo = (JSONObject)user;
         nameBuffer.add(jo.get(KEY_NAME).toString());
       }
     }
   }
   
-  public Long getTotal() {
-    return (Long)object.get(KEY_TOTAL);
-  }
-  
 }



Mime
View raw message