*
* @throws IOException if there is a problem communicating with the server
* @throws ServiceException if the service is unable to handle the request
*/
private void addAndRunQuery() throws IOException, ServiceException {
IssuesQuery query = new IssuesQuery(client.getIssuesFeedUrl());
while (true) {
System.out.println(
DIVIDER
+ "Set query parameters. Choose [1] when you're done.\n"
+ "[0] Return to the main menu\n"
+ "[1] Done. Query issues now.\n"
+ "[2] Set full-text query\n"
+ "[3] Set published-min\n"
+ "[4] Set published-max\n"
+ "[5] Set updated-min\n"
+ "[6] Set updated-max\n"
+ "[7] Set start-index\n"
+ "[8] Set max-results\n"
+ "[9] Set owner\n"
+ "[10] Set reporter\n"
+ "[11] Set status\n"
+ "[12] Set label\n"
+ "[13] Set canned-query");
int choice = readInteger("action");
switch (choice) {
case 0:
return;
case 1:
IssuesFeed resultFeed = client.queryIssues(query);
int numResult = resultFeed.getEntries().size();
System.out.println(
"Query returned " + numResult + " matching issues.");
client.printIssues(resultFeed);
return;
case 2:
String textQuery = readString("full-text query");
query.setFullTextQuery(textQuery);
break;
case 3:
String publishedMin = readString("published-min");
query.setPublishedMin(DateTime.parseDate(publishedMin));
break;
case 4:
String publishedMax = readString("published-max");
query.setPublishedMax(DateTime.parseDate(publishedMax));
break;
case 5:
String updatedMin = readString("updated-min");
query.setUpdatedMin(DateTime.parseDate(updatedMin));
break;
case 6:
String updatedMax = readString("updated-max");
query.setUpdatedMax(DateTime.parseDate(updatedMax));
break;
case 7:
int startIndex = readInteger("start-index");
query.setStartIndex(startIndex);
break;
case 8:
int maxResults = readInteger("max-results");
query.setMaxResults(maxResults);
break;
case 9:
String owner = readString("owner");
query.setOwner(owner);
break;
case 10:
String reporter = readString("reporter");
query.setAuthor(reporter);
break;
case 11:
String status = readString("status");
query.setStatus(status);
break;
case 12:
String label = readString("label");
query.setLabel(label);
break;
case 13:
String cannedQuery = readString("canned-query");
query.setCan(cannedQuery);
break;
default:
System.out.println("Invalid choice " + choice);
break;
}