diff options
Diffstat (limited to 'sonar-db')
4 files changed, 8 insertions, 23 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDto.java b/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDto.java index 2f6328e413d..0112420c6c7 100644 --- a/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDto.java +++ b/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDto.java @@ -27,11 +27,10 @@ import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.sonar.api.rule.RuleKey; import org.sonar.api.rules.ActiveRule; -import org.sonar.db.rule.SeverityUtil; -import org.sonar.db.Dto; import org.sonar.db.rule.RuleDto; +import org.sonar.db.rule.SeverityUtil; -public class ActiveRuleDto extends Dto<ActiveRuleKey> { +public class ActiveRuleDto { public static final String INHERITED = ActiveRule.INHERITED; public static final String OVERRIDES = ActiveRule.OVERRIDES; @@ -45,7 +44,7 @@ public class ActiveRuleDto extends Dto<ActiveRuleKey> { private long createdAtInMs; private long updatedAtInMs; - //These fields do not exists in db, it's only retrieve by joins + // These fields do not exists in db, it's only retrieve by joins private Integer parentId; private String repository; private String ruleField; @@ -54,7 +53,6 @@ public class ActiveRuleDto extends Dto<ActiveRuleKey> { /** * @deprecated for internal use, should be private */ - @Deprecated public ActiveRuleDto setKey(ActiveRuleKey key) { this.repository = key.ruleKey().repository(); this.ruleField = key.ruleKey().rule(); @@ -62,7 +60,6 @@ public class ActiveRuleDto extends Dto<ActiveRuleKey> { return this; } - @Override public ActiveRuleKey getKey() { return ActiveRuleKey.of(profileKey, RuleKey.of(repository, ruleField)); } diff --git a/sonar-db/src/main/java/org/sonar/db/rule/RuleDto.java b/sonar-db/src/main/java/org/sonar/db/rule/RuleDto.java index 11e38b067c9..3bf350b777c 100644 --- a/sonar-db/src/main/java/org/sonar/db/rule/RuleDto.java +++ b/sonar-db/src/main/java/org/sonar/db/rule/RuleDto.java @@ -33,12 +33,10 @@ import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.RuleStatus; -import org.sonar.db.Dto; import static com.google.common.base.Preconditions.checkArgument; -// TODO remove extends Dto -public class RuleDto extends Dto<RuleKey> { +public class RuleDto { public static final int DISABLED_CHARACTERISTIC_ID = -1; @@ -79,7 +77,6 @@ public class RuleDto extends Dto<RuleKey> { private long createdAtInMs; private long updatedAtInMs; - @Override public RuleKey getKey() { if (key == null) { key = RuleKey.of(getRepositoryKey(), getRuleKey()); diff --git a/sonar-db/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml b/sonar-db/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml index ebeecc1030d..a79f5e4103e 100644 --- a/sonar-db/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml @@ -12,8 +12,6 @@ r.plugin_rule_key as "rulefield", r.plugin_name as "repository", qp.kee as "profileKey", - a.created_at as "createdAt", - a.updated_at as "updatedAt", a.created_at_ms as "createdAtInMs", a.updated_at_ms as "updatedAtInMs" </sql> @@ -31,8 +29,6 @@ a.failure_level as severity, a.inheritance as inheritance, active_rule_parent.id as parentId, - a.created_at as "createdAt", - a.updated_at as "updatedAt", a.created_at_ms as "createdAtInMs", a.updated_at_ms as "updatedAtInMs" </sql> @@ -58,8 +54,8 @@ </select> <insert id="insert" parameterType="ActiveRule" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - INSERT INTO active_rules (profile_id, rule_id, failure_level, inheritance, created_at, updated_at, created_at_ms, updated_at_ms) - VALUES (#{profileId}, #{ruleId}, #{severity}, #{inheritance}, #{createdAt}, #{updatedAt}, #{createdAtInMs}, #{updatedAtInMs}) + INSERT INTO active_rules (profile_id, rule_id, failure_level, inheritance, created_at_ms, updated_at_ms) + VALUES (#{profileId}, #{ruleId}, #{severity}, #{inheritance}, #{createdAtInMs}, #{updatedAtInMs}) </insert> <update id="update" parameterType="ActiveRule"> @@ -68,7 +64,6 @@ rule_id=#{ruleId}, failure_level=#{severity}, inheritance=#{inheritance}, - updated_at=#{updatedAt}, updated_at_ms=#{updatedAtInMs} WHERE id=#{id} </update> diff --git a/sonar-db/src/main/resources/org/sonar/db/rule/RuleMapper.xml b/sonar-db/src/main/resources/org/sonar/db/rule/RuleMapper.xml index 3673dc55619..4d98081a923 100644 --- a/sonar-db/src/main/resources/org/sonar/db/rule/RuleMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/rule/RuleMapper.xml @@ -31,8 +31,6 @@ r.effort_to_fix_description as "effortToFixDescription", r.tags as "tagsField", r.system_tags as "systemTagsField", - r.created_at as "createdAt", - r.updated_at as "updatedAt", r.created_at_ms as "createdAtInMs", r.updated_at_ms as "updatedAtInMs" </sql> @@ -160,7 +158,6 @@ effort_to_fix_description=#{effortToFixDescription}, tags=#{tagsField}, system_tags=#{systemTagsField}, - updated_at=#{updatedAt}, updated_at_ms=#{updatedAtInMs} WHERE id=#{id} </update> @@ -171,7 +168,7 @@ characteristic_id, default_characteristic_id, remediation_function, default_remediation_function, remediation_coeff, default_remediation_coeff, remediation_offset, default_remediation_offset, effort_to_fix_description, tags, system_tags, note_data, note_user_login, note_created_at, note_updated_at, - created_at, updated_at, created_at_ms, updated_at_ms) + created_at_ms, updated_at_ms) </sql> <insert id="insert" parameterType="Rule" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> @@ -182,7 +179,7 @@ #{subCharacteristicId}, #{defaultSubCharacteristicId}, #{remediationFunction}, #{defaultRemediationFunction}, #{remediationCoefficient}, #{defaultRemediationCoefficient}, #{remediationOffset}, #{defaultRemediationOffset}, #{effortToFixDescription}, #{tagsField}, #{systemTagsField}, #{noteData}, #{noteUserLogin}, #{noteCreatedAt}, - #{noteUpdatedAt}, #{createdAt}, #{updatedAt}, #{createdAtInMs}, #{updatedAtInMs}) + #{noteUpdatedAt}, #{createdAtInMs}, #{updatedAtInMs}) </insert> <insert id="batchInsert" parameterType="Rule" useGeneratedKeys="false"> @@ -199,7 +196,6 @@ #{remediationOffset,jdbcType=VARCHAR}, #{defaultRemediationOffset,jdbcType=VARCHAR}, #{effortToFixDescription}, #{tagsField}, #{systemTagsField}, #{noteData}, #{noteUserLogin}, #{noteCreatedAt}, #{noteUpdatedAt,jdbcType=TIMESTAMP}, - #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{createdAtInMs,jdbcType=BIGINT}, #{updatedAtInMs,jdbcType=BIGINT} ) </insert> |