Skip to content

Commit

Permalink
add generic customize method to JiraIssueCheckResultDecorator
Browse files Browse the repository at this point in the history
to have maximum freedom for customizability without having to adapt
dash-core all the time.

In our example we want to read all jira issues and then apply teams
instead of creating one check for each team. Advantage then is that
issues without any team would also be displayed and less jira API calls
are needed if you have many teams
  • Loading branch information
ulich committed Aug 26, 2018
1 parent ffd6a3b commit 32b746a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public CheckResult withLink(String link) {
return this;
}

public CheckResult withTeams(List<Team> teams) {
public CheckResult withTeams(List<? extends Team> teams) {

if (teams != null) {
teams.forEach(team -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ CheckResult createCheckResultForIssue(JiraCheck jiraCheck, Issue issue) {
final String info = checkResultDecorator.info(issue);

final CheckResult checkResult = new CheckResult(state, name, info, 1, state == State.GREEN ? 0 : 1, jiraCheck.getGroup())
.withLink(jiraCheck.getUrl() + "/browse/" + issue.getKey()).withTeams(jiraCheck.getTeams())
.withLink(jiraCheck.getUrl() + "/browse/" + issue.getKey())
.withTeams(jiraCheck.getTeams())
.withCheckResultIdentifier(jiraCheck.getUrl() + "_" + issue.getKey());

if (jiraProjectConfiguration.isIssueInProgress(issue)) {
checkResult.markRunning();
}

return checkResult;
return checkResultDecorator.decorate(checkResult, jiraCheck, issue);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.axelspringer.ideas.tools.dash.business.jira.issuecheckresultdecorator;

import de.axelspringer.ideas.tools.dash.business.check.checkresult.CheckResult;
import de.axelspringer.ideas.tools.dash.business.jira.JiraCheck;
import de.axelspringer.ideas.tools.dash.business.jira.rest.Issue;

Expand All @@ -11,4 +12,8 @@ public interface JiraIssueCheckResultDecorator {
String info(Issue issue);

String name(JiraCheck jiraCheck, Issue issue);

default CheckResult decorate(CheckResult checkResult, JiraCheck jiraCheck, Issue issue) {
return checkResult;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Fields {
* Team
*/
private CustomField customfield_10144;
private CustomField customfield_11400;

private Assignee assignee;

Expand Down Expand Up @@ -69,6 +70,14 @@ public void setCustomfield_10144(CustomField customfield_10144) {
this.customfield_10144 = customfield_10144;
}

public CustomField getCustomfield_11400() {
return customfield_11400;
}

public void setCustomfield_11400(CustomField customfield_11400) {
this.customfield_11400 = customfield_11400;
}

public Assignee getAssignee() {
return this.assignee;
}
Expand Down

0 comments on commit 32b746a

Please sign in to comment.