Search in sources :

Example 1 with GitHubPoster

use of org.monarchinitiative.loinc2hpo.github.GitHubPoster in project loinc2hpo by monarch-initiative.

the class AnnotateTabController method postGitHubIssue.

private void postGitHubIssue(String message, String title, String uname, String pword, List<String> chosenLabels) {
    GitHubPoster poster = new GitHubPoster(uname, pword, title, message);
    this.githubUsername = uname;
    this.githubPassword = pword;
    if (chosenLabels != null && !chosenLabels.isEmpty()) {
        logger.trace("Labels being chosen: ");
        chosenLabels.forEach(logger::trace);
        poster.setLabel(chosenLabels);
        logger.trace("Labels sent to poster: \t");
        logger.trace(poster.debugLabelsArray4Json());
    }
    try {
        logger.trace("Message sent to Github: \t" + poster.debugReformatpayloadWithLabel());
        poster.postIssue();
    } catch (NetPostException he) {
        PopUps.showException("GitHub error", "Bad Request (400): Could not post issue", he);
    } catch (Exception ex) {
        PopUps.showException("GitHub error", "GitHub error: Could not post issue", ex);
        return;
    }
    String response = poster.getHttpResponse();
    PopUps.showInfoMessage(String.format("Created issue for %s\nServer response: %s", loincIdSelected.toString(), response), "Created new issue");
}
Also used : NetPostException(org.monarchinitiative.loinc2hpo.exception.NetPostException) GitHubPoster(org.monarchinitiative.loinc2hpo.github.GitHubPoster) MalformedLoincCodeException(org.monarchinitiative.loinc2hpo.exception.MalformedLoincCodeException) LoincCodeNotFoundException(org.monarchinitiative.loinc2hpo.exception.LoincCodeNotFoundException) NetPostException(org.monarchinitiative.loinc2hpo.exception.NetPostException)

Aggregations

LoincCodeNotFoundException (org.monarchinitiative.loinc2hpo.exception.LoincCodeNotFoundException)1 MalformedLoincCodeException (org.monarchinitiative.loinc2hpo.exception.MalformedLoincCodeException)1 NetPostException (org.monarchinitiative.loinc2hpo.exception.NetPostException)1 GitHubPoster (org.monarchinitiative.loinc2hpo.github.GitHubPoster)1