import java.util.Map;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import org.apache.commons.lang.BooleanUtils;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
return getField(IssueIndexDefinition.FIELD_ISSUE_SEVERITY);
}
- public boolean isManualSeverity() {
- return BooleanUtils.isTrue(getField(IssueIndexDefinition.FIELD_ISSUE_MANUAL_SEVERITY));
- }
-
- @Nullable
- public String checksum() {
- return getNullableField(IssueIndexDefinition.FIELD_ISSUE_CHECKSUM);
- }
-
- @CheckForNull
- public String message() {
- return getNullableField(IssueIndexDefinition.FIELD_ISSUE_MESSAGE);
- }
-
@CheckForNull
public Integer line() {
return getNullableField(IssueIndexDefinition.FIELD_ISSUE_LINE);
return this;
}
- public IssueDoc setManualSeverity(boolean b) {
- setField(IssueIndexDefinition.FIELD_ISSUE_MANUAL_SEVERITY, b);
- return this;
- }
-
- public IssueDoc setMessage(@Nullable String s) {
- setField(IssueIndexDefinition.FIELD_ISSUE_MESSAGE, s);
- return this;
- }
-
- public IssueDoc setChecksum(@Nullable String s) {
- setField(IssueIndexDefinition.FIELD_ISSUE_CHECKSUM, s);
- return this;
- }
-
public IssueDoc setLine(@Nullable Integer i) {
setField(IssueIndexDefinition.FIELD_ISSUE_LINE, i);
return this;
public static final String FIELD_ISSUE_KEY = "key";
public static final String FIELD_ISSUE_LANGUAGE = "language";
public static final String FIELD_ISSUE_LINE = "line";
- public static final String FIELD_ISSUE_MESSAGE = "message";
public static final String FIELD_ISSUE_MODULE_UUID = "module";
public static final String FIELD_ISSUE_MODULE_PATH = "modulePath";
public static final String FIELD_ISSUE_ORGANIZATION_UUID = "organization";
public static final String FIELD_ISSUE_RULE_KEY = "ruleKey";
public static final String FIELD_ISSUE_SEVERITY = "severity";
public static final String FIELD_ISSUE_SEVERITY_VALUE = "severityValue";
- public static final String FIELD_ISSUE_MANUAL_SEVERITY = "manualSeverity";
public static final String FIELD_ISSUE_STATUS = "status";
- public static final String FIELD_ISSUE_CHECKSUM = "checksum";
public static final String FIELD_ISSUE_TAGS = "tags";
public static final String FIELD_ISSUE_TYPE = "type";
type.stringFieldBuilder(FIELD_ISSUE_KEY).disableNorms().addSubFields(SORTABLE_ANALYZER).build();
type.stringFieldBuilder(FIELD_ISSUE_LANGUAGE).disableNorms().build();
type.createIntegerField(FIELD_ISSUE_LINE);
- type.stringFieldBuilder(FIELD_ISSUE_MESSAGE).disableNorms().build();
type.stringFieldBuilder(FIELD_ISSUE_MODULE_UUID).disableNorms().build();
type.createUuidPathField(FIELD_ISSUE_MODULE_PATH);
type.stringFieldBuilder(FIELD_ISSUE_ORGANIZATION_UUID).disableNorms().build();
"root.uuid",
"i.assignee",
"i.line",
- "i.message",
"i.resolution",
"i.severity",
- "i.manual_severity",
- "i.checksum",
"i.status",
-
- // column 11
"i.effort",
"i.author_login",
"i.issue_close_date",
+
+ // column 11
"i.issue_creation_date",
"i.issue_update_date",
"r.plugin_name",
"r.language",
"p.uuid",
"p.module_uuid_path",
-
- // column 21
"p.path",
"p.scope",
"p.organization_uuid",
+
+ // column 21
"i.tags",
"i.issue_type"
};
doc.setProjectUuid(projectUuid);
doc.setAssignee(rs.getString(3));
doc.setLine(DatabaseUtils.getInt(rs, 4));
- doc.setMessage(rs.getString(5));
- doc.setResolution(rs.getString(6));
- doc.setSeverity(rs.getString(7));
- doc.setManualSeverity(rs.getBoolean(8));
- doc.setChecksum(rs.getString(9));
- doc.setStatus(rs.getString(10));
- doc.setEffort(getLong(rs, 11));
- doc.setAuthorLogin(rs.getString(12));
- doc.setFuncCloseDate(longToDate(getLong(rs, 13)));
- doc.setFuncCreationDate(longToDate(getLong(rs, 14)));
- doc.setFuncUpdateDate(longToDate(getLong(rs, 15)));
- String ruleRepo = rs.getString(16);
- String ruleKey = rs.getString(17);
+ doc.setResolution(rs.getString(5));
+ doc.setSeverity(rs.getString(6));
+ doc.setStatus(rs.getString(7));
+ doc.setEffort(getLong(rs, 8));
+ doc.setAuthorLogin(rs.getString(9));
+ doc.setFuncCloseDate(longToDate(getLong(rs, 10)));
+ doc.setFuncCreationDate(longToDate(getLong(rs, 11)));
+ doc.setFuncUpdateDate(longToDate(getLong(rs, 12)));
+ String ruleRepo = rs.getString(13);
+ String ruleKey = rs.getString(14);
doc.setRuleKey(RuleKey.of(ruleRepo, ruleKey).toString());
- doc.setLanguage(rs.getString(18));
- doc.setComponentUuid(rs.getString(19));
- String moduleUuidPath = rs.getString(20);
+ doc.setLanguage(rs.getString(15));
+ doc.setComponentUuid(rs.getString(16));
+ String moduleUuidPath = rs.getString(17);
doc.setModuleUuid(extractModule(moduleUuidPath));
doc.setModuleUuidPath(moduleUuidPath);
- String scope = rs.getString(22);
- String filePath = extractFilePath(rs.getString(21), scope);
+ String scope = rs.getString(19);
+ String filePath = extractFilePath(rs.getString(18), scope);
doc.setFilePath(filePath);
doc.setDirectoryPath(extractDirPath(doc.filePath(), scope));
- doc.setOrganizationUuid(rs.getString(23));
- String tags = rs.getString(24);
+ doc.setOrganizationUuid(rs.getString(20));
+ String tags = rs.getString(21);
doc.setTags(ImmutableList.copyOf(IssueIteratorForSingleChunk.TAGS_SPLITTER.split(tags == null ? "" : tags)));
- doc.setType(RuleType.valueOf(rs.getInt(25)));
+ doc.setType(RuleType.valueOf(rs.getInt(22)));
return doc;
}
doc.setComponentUuid("FILE_1");
doc.setFilePath("src/Foo.xoo");
doc.setDirectoryPath("/src");
- doc.setMessage("the message");
doc.setModuleUuid("MODULE_1");
doc.setModuleUuidPath("MODULE_1");
doc.setProjectUuid("PROJECT_1");
doc.setStatus(Issue.STATUS_OPEN);
doc.setResolution(null);
doc.setSeverity(Severity.MAJOR);
- doc.setManualSeverity(true);
doc.setEffort(10L);
- doc.setChecksum("12345");
doc.setFuncCreationDate(DateUtils.parseDate("2014-09-04"));
doc.setFuncUpdateDate(DateUtils.parseDate("2014-12-04"));
doc.setFuncCloseDate(null);
assertThat(issue.resolution()).isEqualTo("FIXED");
assertThat(issue.status()).isEqualTo("RESOLVED");
assertThat(issue.severity()).isEqualTo("BLOCKER");
- assertThat(issue.isManualSeverity()).isFalse();
assertThat(issue.assignee()).isEqualTo("guy1");
assertThat(issue.authorLogin()).isEqualTo("guy2");
- assertThat(issue.checksum()).isEqualTo("FFFFF");
assertThat(issue.line()).isEqualTo(444);
assertThat(issue.ruleKey()).isEqualTo(RuleKey.of("squid", "AvoidCycles"));
assertThat(issue.componentUuid()).isEqualTo("FILE1");