Skip to content

Instantly share code, notes, and snippets.

@senocak
Created September 26, 2024 10:30
Show Gist options
  • Save senocak/1dbd5fa933746c08cd231ba651ba95b9 to your computer and use it in GitHub Desktop.
Save senocak/1dbd5fa933746c08cd231ba651ba95b9 to your computer and use it in GitHub Desktop.
Jira Java
/*
<dependency>
<groupId>com.dorkbox</groupId>
<artifactId>SystemTray</artifactId>
<version>3.14</version>
</dependency>
*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.rcarz.jiraclient.BasicCredentials;
import net.rcarz.jiraclient.Issue;
import net.rcarz.jiraclient.JiraClient;
public class JiraSystemTray {
public static void main(String[] args) {
JiraClient jira;
String user = "";
try {
BasicCredentials creds = new BasicCredentials(user, "");
jira = new JiraClient("https://jira.com.tr/", creds);
Issue.SearchResult sr = jira.searchIssues("assignee="+user+" AND project = ABC");
final HashMap<String, List<Issue>> issueMap = new HashMap<>();
for (Issue i : sr.issues) {
final String status = i.getStatus().getName();
List<Issue> issueListByStatus = issueMap.get(status);
if (issueListByStatus == null){
issueListByStatus = new ArrayList<>();
}
issueListByStatus.add(i);
issueMap.put(status, issueListByStatus);
}
for (Map.Entry<String, List<Issue>> entry : issueMap.entrySet()){
entry.getValue().forEach(value -> {
System.out.println(entry.getKey() + " > " +value.getSummary() + " - " + value.getStatus().getName());
});
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment