aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-07-03 15:05:05 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-07-03 16:22:48 +0200
commitcbf482f5add9956ca1803fedd759460c3e45b7fa (patch)
tree64fbaea7d90d63f3a9e28f0397f5a767eda8101d /sonar-core
parentdd5fd97c77396e9d08a7ad4d0186e80ebd67f714 (diff)
downloadsonarqube-cbf482f5add9956ca1803fedd759460c3e45b7fa.tar.gz
sonarqube-cbf482f5add9956ca1803fedd759460c3e45b7fa.zip
SONAR-5007 - added createdAt and updatedAt fields for ActiveRuleDto
Conflicts: sonar-server/src/test/java/org/sonar/server/qualityprofile/RuleActivatorMediumTest.java
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/Dto.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDto.java17
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml30
3 files changed, 23 insertions, 32 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java b/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java
index d604962cbf9..891ebcd595c 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/Dto.java
@@ -29,19 +29,19 @@ public abstract class Dto<K extends Serializable> {
public abstract K getKey();
- public void setCreatedAt(Date datetime){
+ public final void setCreatedAt(Date datetime) {
this.createdAt = datetime;
}
- public void setUpdatedAt(Date datetime){
+ public final void setUpdatedAt(Date datetime) {
this.updatedAt = datetime;
}
- public Date getCreatedAt(){
+ public final Date getCreatedAt() {
return this.createdAt;
}
- public Date getUpdatedAt(){
+ public final Date getUpdatedAt() {
return this.updatedAt;
}
}
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDto.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDto.java
index ae9eab457df..b11695a519a 100644
--- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDto.java
+++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDto.java
@@ -34,7 +34,6 @@ public class QualityProfileDto extends Dto<String> {
private String name;
private String language;
private String parentKee;
- private Date createdAt, updatedAt;
private String rulesUpdatedAt;
/**
@@ -100,22 +99,6 @@ public class QualityProfileDto extends Dto<String> {
return this;
}
- public Date getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- }
-
- public Date getUpdatedAt() {
- return updatedAt;
- }
-
- public void setUpdatedAt(Date updatedAt) {
- this.updatedAt = updatedAt;
- }
-
public String getRulesUpdatedAt() {
return rulesUpdatedAt;
}
diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml
index 5ff6c7c59fb..fd3c1a00fe2 100644
--- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/ActiveRuleMapper.xml
@@ -11,7 +11,9 @@
a.inheritance as "inheritance",
r.plugin_rule_key as "rulefield",
r.plugin_name as "repository",
- qp.kee as "profileKey"
+ qp.kee as "profileKey",
+ a.created_at as "createdAt",
+ a.updated_at as "updatedAt"
</sql>
<sql id="activeRuleKeyJoin">
@@ -26,7 +28,9 @@
a.rule_id as ruleId,
a.failure_level as severity,
a.inheritance as inheritance,
- active_rule_parent.id as parentId
+ active_rule_parent.id as parentId,
+ a.created_at as "createdAt",
+ a.updated_at as "updatedAt"
</sql>
<sql id="activeRuleJoin">
@@ -48,8 +52,8 @@
</select>
<insert id="insert" parameterType="ActiveRule" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO active_rules (profile_id, rule_id, failure_level, inheritance)
- VALUES (#{profileId}, #{ruleId}, #{severity}, #{inheritance})
+ INSERT INTO active_rules (profile_id, rule_id, failure_level, inheritance, created_at, updated_at)
+ VALUES (#{profileId}, #{ruleId}, #{severity}, #{inheritance}, #{createdAt}, #{updatedAt})
</insert>
<update id="update" parameterType="ActiveRule">
@@ -57,7 +61,8 @@
profile_id=#{profileId},
rule_id=#{ruleId},
failure_level=#{severity},
- inheritance=#{inheritance}
+ inheritance=#{inheritance},
+ updated_at=#{updatedAt}
WHERE id=#{id}
</update>
@@ -78,7 +83,8 @@
</select>
<select id="selectById" parameterType="int" resultType="ActiveRule">
- SELECT <include refid="activeRuleColumns"/>
+ SELECT
+ <include refid="activeRuleColumns"/>
FROM active_rules a
<include refid="activeRuleJoin"/>
WHERE a.id=#{id}
@@ -91,13 +97,14 @@
FROM active_rules a
<include refid="activeRuleKeyJoin"/>
WHERE
- qp.kee = #{profileKey}
- AND r.plugin_rule_key = #{rule}
- AND r.plugin_name = #{repository}
+ qp.kee = #{profileKey}
+ AND r.plugin_rule_key = #{rule}
+ AND r.plugin_name = #{repository}
</select>
<select id="selectByProfileKey" parameterType="string" resultType="ActiveRule">
- SELECT <include refid="activeRuleKeyColumns"/>
+ SELECT
+ <include refid="activeRuleKeyColumns"/>
FROM active_rules a
<include refid="activeRuleKeyJoin"/>
where qp.kee=#{id}
@@ -171,7 +178,8 @@
</select>
<select id="selectParamByActiveRuleAndKey" parameterType="map" resultType="ActiveRuleParam">
- SELECT <include refid="activeRuleParamColumns"/>
+ SELECT
+ <include refid="activeRuleParamColumns"/>
FROM active_rule_parameters p
<where>
AND p.active_rule_id=#{activeRuleId}