/** * Creates an Agile client. * * @param jira JIRA client */ public AgileClient(JiraClient jira) { restclient = jira.getRestClient(); }
/** * Search for issues with the given query. * * @param jql JQL statement * * @return a search result structure with results (issues include all * navigable fields) * * @throws JiraException when the search fails */ public Issue.SearchResult searchIssues(String jql) throws JiraException { return searchIssues(jql, null, null, null, null); }
public JiraContext(String url, String username, String password) { this.credentials = new BasicCredentials(username, password); this.jiraClient = new JiraClient(url, credentials); final HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 10000); ((DefaultHttpClient)getJiraClient().getRestClient().getHttpClient()).setParams(httpParams); }
public Issue getIssue(String ticket) { Issue issue = null; try { issue = getJiraClient().getIssue(ticket); } catch (Exception e) { LOGGER.error("Unable to find Jira issue: " + ticket, e); } return issue; }
@Override public boolean isConnected() { boolean connected = false; try { connected = getJiraClient() != null && getJiraClient().getProjects() != null; } catch (Exception e) { LOGGER.error("Unable to connect to JIRA", e); } return connected; }
public ArrayList<IssueHistory> getIssueChangeLog(Issue issue) throws JiraException { try { ArrayList<IssueHistory> changes = null; JSON response = getNextPortion(issue, 0); while (true) { JSONObject object = JSONObject.fromObject(response); Object opers = object.get("changelog"); object = JSONObject.fromObject(opers); Integer totalObj = (Integer)object.get("total"); JSONArray histories = JSONArray.fromObject(object.get("histories")); if (changes == null) { changes = new ArrayList<IssueHistory>(totalObj); } for (int i = 0; i < histories.size(); i++) { JSONObject p = histories.getJSONObject(i); changes.add(new IssueHistory(restclient, p)); } if (changes.size() >= totalObj) { break; } else { response = getNextPortion(issue,changes.size()); } } return changes; } catch (Exception ex) { throw new JiraException(ex.getMessage(), ex); } }
Issue bug = jira.getIssue(bugId); return String.format("Bug %s \"%s\" with status \"%s\" associated", bugUrl, bug.getSummary(), bug.getStatus().getName()); } catch (Exception e) {
/** * Search for issues with the given query and max results. * * @param jql JQL statement * @param maxResults limit the number of results * * @return a search result structure with results (issues include all * navigable fields) * * @throws JiraException when the search fails */ public Issue.SearchResult searchIssues(String jql, Integer maxResults) throws JiraException { return searchIssues(jql, null, null, maxResults, null); }
/** * Creates a GreenHopper client. * * @param jira JIRA client */ public GreenHopperClient(JiraClient jira) { restclient = jira.getRestClient(); }
Issue bug = jira.getIssue(bugId); return String.format("Bug %s \"%s\" with status \"%s\" associated", bugUrl, bug.getSummary(), bug.getStatus().getName()); } catch (Exception e) {
/** * Search for issues with the given query and specify which fields to * retrieve and expand. * * @param jql JQL statement * * @param includedFields Specifies which issue fields will be included in * the result. * <br>Some examples how this parameter works: * <ul> * <li>*all - include all fields</li> * <li>*navigable - include just navigable fields</li> * <li>summary,comment - include just the summary and comments</li> * <li>*all,-comment - include all fields</li> * </ul> * * @param expandFields Specifies with issue fields should be expanded * * @return a search result structure with results * * @throws JiraException when the search fails */ public Issue.SearchResult searchIssues(String jql, String includedFields, String expandFields) throws JiraException { return searchIssues(jql, includedFields, expandFields, null, null); }
/** * Creates a GreenHopper client. * * @param jira JIRA client */ public GreenHopperClient(JiraClient jira) { restclient = jira.getRestClient(); }
/** * Search for issues with the given query and specify which fields to * retrieve. * * @param jql JQL statement * @param maxResults limit the number of results * * @param includedFields Specifies which issue fields will be included in * the result. * <br>Some examples how this parameter works: * <ul> * <li>*all - include all fields</li> * <li>*navigable - include just navigable fields</li> * <li>summary,comment - include just the summary and comments</li> * <li>*all,-comment - include all fields</li> * </ul> * * * @return a search result structure with results * * @throws JiraException when the search fails */ public Issue.SearchResult searchIssues(String jql, String includedFields, Integer maxResults) throws JiraException { return searchIssues(jql, includedFields, null, maxResults, null); }
/** * Search for issues with the given query and specify which fields to * retrieve. * * @param jql JQL statement * * @param includedFields Specifies which issue fields will be included in * the result. * <br>Some examples how this parameter works: * <ul> * <li>*all - include all fields</li> * <li>*navigable - include just navigable fields</li> * <li>summary,comment - include just the summary and comments</li> * <li>*all,-comment - include all fields</li> * </ul> * * * @return a search result structure with results * * @throws JiraException when the search fails */ public Issue.SearchResult searchIssues(String jql, String includedFields) throws JiraException { return searchIssues(jql, includedFields, null, null, null); }
Integer maxResults, Integer startAt) throws JiraException { return searchIssues(jql, includedFields, null, maxResults, startAt);
BasicCredentials credentials=new BasicCredentials(userName,passWord); JiraClient jira=new JiraClient("https://myproject.info",credentials); Issue.SearchResult sr = jira.searchIssues("Your project Name(in my case TC)", 100); for (Issue i : sr.issues) { System.out.println(i.getSummary()); System.out.println(i.getKey()); etc ... }