private final Collection<String> reporters;
private final Collection<String> assignees;
private final Collection<String> languages;
+ private final Collection<String> tags;
private final Boolean assigned;
private final Boolean planned;
private final Boolean resolved;
this.reporters = defaultCollection(builder.reporters);
this.assignees = defaultCollection(builder.assignees);
this.languages = defaultCollection(builder.languages);
+ this.tags = defaultCollection(builder.tags);
this.assigned = builder.assigned;
this.planned = builder.planned;
this.resolved = builder.resolved;
return languages;
}
+ public Collection<String> tags() {
+ return tags;
+ }
+
@CheckForNull
public Boolean assigned() {
return assigned;
private Collection<String> reporters;
private Collection<String> assignees;
private Collection<String> languages;
+ private Collection<String> tags;
private Boolean assigned = null;
private Boolean planned = null;
private Boolean resolved = null;
return this;
}
+ public Builder tags(@Nullable Collection<String> t) {
+ this.tags = t;
+ return this;
+ }
+
/**
* If true, it will return all issues assigned to someone
* If false, it will return all issues not assigned to someone
.reporters(RubyUtils.toStrings(params.get(IssueFilterParameters.REPORTERS)))
.assignees(RubyUtils.toStrings(params.get(IssueFilterParameters.ASSIGNEES)))
.languages(RubyUtils.toStrings(params.get(IssueFilterParameters.LANGUAGES)))
+ .tags(RubyUtils.toStrings(params.get(IssueFilterParameters.TAGS)))
.assigned(RubyUtils.toBoolean(params.get(IssueFilterParameters.ASSIGNED)))
.planned(RubyUtils.toBoolean(params.get(IssueFilterParameters.PLANNED)))
.hideRules(RubyUtils.toBoolean(params.get(IssueFilterParameters.HIDE_RULES)))
.reporters(request.paramAsStrings(IssueFilterParameters.REPORTERS))
.assignees(request.paramAsStrings(IssueFilterParameters.ASSIGNEES))
.languages(request.paramAsStrings(IssueFilterParameters.LANGUAGES))
+ .tags(request.paramAsStrings(IssueFilterParameters.TAGS))
.assigned(request.paramAsBoolean(IssueFilterParameters.ASSIGNED))
.planned(request.paramAsBoolean(IssueFilterParameters.PLANNED))
.createdAt(request.paramAsDateTime(IssueFilterParameters.CREATED_AT))
public static final String REPORTERS = "reporters";
public static final String ASSIGNEES = "assignees";
public static final String LANGUAGES = "languages";
+ public static final String TAGS = "tags";
public static final String ASSIGNED = "assigned";
public static final String PLANNED = "planned";
public static final String HIDE_RULES = "hideRules";
public static final String ASC = "asc";
public static final String IGNORE_PAGING = "ignorePaging";
- public static final List<String> ALL = ImmutableList.of(ISSUES, SEVERITIES, STATUSES, RESOLUTIONS, RESOLVED, COMPONENTS, COMPONENT_ROOTS, RULES, ACTION_PLANS, REPORTERS,
+ public static final List<String> ALL = ImmutableList.of(ISSUES, SEVERITIES, STATUSES, RESOLUTIONS, RESOLVED, COMPONENTS, COMPONENT_ROOTS, RULES, ACTION_PLANS, REPORTERS, TAGS,
ASSIGNEES, LANGUAGES, ASSIGNED, PLANNED, HIDE_RULES, CREATED_AT, CREATED_AFTER, CREATED_BEFORE, PAGE_SIZE, PAGE_INDEX, SORT, ASC, COMPONENT_UUIDS, COMPONENT_ROOT_UUIDS,
PROJECTS, PROJECT_UUIDS, IGNORE_PAGING);
filters.put(IssueIndexDefinition.FIELD_ISSUE_COMPONENT_UUID, matchFilter(IssueIndexDefinition.FIELD_ISSUE_COMPONENT_UUID, query.componentUuids()));
filters.put(IssueIndexDefinition.FIELD_ISSUE_PROJECT_UUID, matchFilter(IssueIndexDefinition.FIELD_ISSUE_PROJECT_UUID, query.projectUuids()));
filters.put(IssueIndexDefinition.FIELD_ISSUE_LANGUAGE, matchFilter(IssueIndexDefinition.FIELD_ISSUE_LANGUAGE, query.languages()));
+ filters.put(IssueIndexDefinition.FIELD_ISSUE_TAGS, matchFilter(IssueIndexDefinition.FIELD_ISSUE_TAGS, query.tags()));
filters.put(IssueIndexDefinition.FIELD_ISSUE_RESOLUTION, matchFilter(IssueIndexDefinition.FIELD_ISSUE_RESOLUTION, query.resolutions()));
filters.put(IssueIndexDefinition.FIELD_ISSUE_REPORTER, matchFilter(IssueIndexDefinition.FIELD_ISSUE_REPORTER, query.reporters()));
filters.put(IssueIndexDefinition.FIELD_ISSUE_RULE_KEY, matchFilter(IssueIndexDefinition.FIELD_ISSUE_RULE_KEY, query.rules()));
IssueFilterParameters.PROJECT_UUIDS, IssueNormalizer.IssueField.PROJECT.field(), query.projectUuids().toArray());
addSimpleStickyFacetIfNeeded(options, stickyFacetBuilder, esSearch,
IssueFilterParameters.LANGUAGES, IssueNormalizer.IssueField.LANGUAGE.field(), query.languages().toArray());
+ addSimpleStickyFacetIfNeeded(options, stickyFacetBuilder, esSearch,
+ IssueFilterParameters.TAGS, IssueNormalizer.IssueField.TAGS.field(), query.tags().toArray());
addSimpleStickyFacetIfNeeded(options, stickyFacetBuilder, esSearch,
IssueFilterParameters.RULES, IssueNormalizer.IssueField.RULE_KEY.field(), query.rules().toArray());
addSimpleStickyFacetIfNeeded(options, stickyFacetBuilder, esSearch,
public static final IndexField SEVERITY = add(IndexField.Type.STRING, "severity");
public static final IndexField SEVERITY_VALUE = addSortable(IndexField.Type.INTEGER, "severityValue");
public static final IndexField LANGUAGE = add(IndexField.Type.STRING, "language");
+ public static final IndexField TAGS = add(IndexField.Type.STRING, "tags");
public static final IndexField RULE_KEY = add(IndexField.Type.STRING, "ruleKey");
public static final IndexField FILE_PATH = addSortable(IndexField.Type.STRING, "filePath");
}
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Maps.newHashMap;
action.createParam(IssueFilterParameters.RULES)
.setDescription("Comma-separated list of coding rule keys. Format is <repository>:<rule>")
.setExampleValue("squid:AvoidCycles");
+ action.createParam(IssueFilterParameters.TAGS)
+ .setDescription("Comma-separated list of tags.")
+ .setExampleValue("security,convention");
action.createParam(IssueFilterParameters.HIDE_RULES)
.setDescription("To not return rules")
.setDefaultValue(false)
IssueFilterParameters.ASSIGNEES,
IssueFilterParameters.REPORTERS,
IssueFilterParameters.COMPONENT_UUIDS,
- IssueFilterParameters.LANGUAGES
+ IssueFilterParameters.LANGUAGES,
+ IssueFilterParameters.TAGS,
});
}
addMandatoryFacetValues(results, IssueFilterParameters.REPORTERS, request.paramAsStrings(IssueFilterParameters.REPORTERS));
addMandatoryFacetValues(results, IssueFilterParameters.RULES, request.paramAsStrings(IssueFilterParameters.RULES));
addMandatoryFacetValues(results, IssueFilterParameters.LANGUAGES, request.paramAsStrings(IssueFilterParameters.LANGUAGES));
+ addMandatoryFacetValues(results, IssueFilterParameters.TAGS, request.paramAsStrings(IssueFilterParameters.TAGS));
List<String> actionPlans = Lists.newArrayList("");
List<String> actionPlansFromRequest = request.paramAsStrings(IssueFilterParameters.ACTION_PLANS);
if (actionPlansFromRequest != null) {
.prop("fUpdateAge", formatAgeDate(updateDate))
.prop("closeDate", isoDate(issue.closeDate()));
+ Collection<String> tags = ((IssueDoc) issue).tags();
+ if (tags != null && !tags.isEmpty()) {
+ json.name("tags").beginArray();
+ for (String tag: tags) {
+ json.value(tag);
+ }
+ json.endArray();
+ }
+
writeIssueComments(commentsByIssues.get(issue.key()), usersByLogin, json);
writeIssueAttributes(issue, json);
writeIssueExtraFields(issue, project != null ? project.getKey() : null, usersByLogin, actionPlanByKeys, extraFields, json);
map.put("reporters", newArrayList("marilyn"));
map.put("assignees", newArrayList("joanna"));
map.put("languages", newArrayList("xoo"));
+ map.put("tags", newArrayList("tag1", "tag2"));
map.put("assigned", true);
map.put("planned", true);
map.put("hideRules", true);
assertThat(query.reporters()).containsOnly("marilyn");
assertThat(query.assignees()).containsOnly("joanna");
assertThat(query.languages()).containsOnly("xoo");
+ assertThat(query.tags()).containsOnly("tag1", "tag2");
assertThat(query.assigned()).isTrue();
assertThat(query.planned()).isTrue();
assertThat(query.hideRules()).isTrue();
.reporters(newArrayList("crunky"))
.assignees(newArrayList("gargantua"))
.languages(newArrayList("xoo"))
+ .tags(newArrayList("tag1", "tag2"))
.assigned(true)
.hideRules(true)
.createdAfter(new Date())
assertThat(query.reporters()).containsOnly("crunky");
assertThat(query.assignees()).containsOnly("gargantua");
assertThat(query.languages()).containsOnly("xoo");
+ assertThat(query.tags()).containsOnly("tag1", "tag2");
assertThat(query.assigned()).isTrue();
assertThat(query.hideRules()).isTrue();
assertThat(query.rules()).containsOnly(RuleKey.of("squid", "AvoidCycle"));
.rules(null)
.severities(null)
.languages(null)
+ .tags(null)
.build();
assertThat(query.issueKeys()).isEmpty();
assertThat(query.componentUuids()).isEmpty();
assertThat(query.rules()).isEmpty();
assertThat(query.severities()).isEmpty();
assertThat(query.languages()).isEmpty();
+ assertThat(query.tags()).isEmpty();
}
@Test
assertThat(query.rules()).isEmpty();
assertThat(query.severities()).isEmpty();
assertThat(query.languages()).isEmpty();
+ assertThat(query.tags()).isEmpty();
assertThat(query.assigned()).isNull();
assertThat(query.createdAfter()).isNull();
assertThat(query.createdBefore()).isNull();
assertThat(show.isPost()).isFalse();
assertThat(show.isInternal()).isFalse();
assertThat(show.responseExampleAsString()).isNotEmpty();
- assertThat(show.params()).hasSize(31);
+ assertThat(show.params()).hasSize(32);
}
@Test