manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1501628 - in /manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira: JiraJSONResponse.java JiraSession.java JiraUserQueryResults.java
Date Wed, 10 Jul 2013 01:27:24 GMT
Author: kwright
Date: Wed Jul 10 01:27:24 2013
New Revision: 1501628

URL: http://svn.apache.org/r1501628
Log:
Fix up authority too

Modified:
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
    manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java?rev=1501628&r1=1501627&r2=1501628&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraJSONResponse.java
Wed Jul 10 01:27:24 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/authorities/authorities/jira/JiraSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java?rev=1501628&r1=1501627&r2=1501628&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
Wed Jul 10 01:27:24 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();
@@ -215,7 +215,6 @@ public class JiraSession {
     HashMap<String, String> statistics = new HashMap<String, String>();
     JiraUserQueryResults qr = new JiraUserQueryResults();
     getRest("user/search?username=&maxResults=1&startAt=0", qr);
-    statistics.put("Total Users", qr.getTotal().toString());
     return statistics;
   }
 
@@ -224,9 +223,6 @@ public class JiraSession {
   public boolean checkUserExists(String userName) throws IOException {
     JiraUserQueryResults qr = new JiraUserQueryResults();
     getRest("user/search?username="+URLEncoder.encode(userName,"utf-8")+"&maxResults=1&startAt=0",
qr);
-    Long total = qr.getTotal();
-    if (total == null || total.longValue() == 0)
-      return false;
     List<String> values = new ArrayList<String>();
     qr.getNames(values);
     if (values.size() == 0)

Modified: manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java?rev=1501628&r1=1501627&r2=1501628&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java
(original)
+++ manifoldcf/branches/CONNECTORS-731/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java
Wed Jul 10 01:27:24 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