]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3437 Cleaner code and fix Oracle mapping
authorDavid Gageot <david@gageot.net>
Tue, 10 Jul 2012 08:03:38 +0000 (10:03 +0200)
committerDavid Gageot <david@gageot.net>
Tue, 10 Jul 2012 09:34:40 +0000 (11:34 +0200)
sonar-batch/src/main/java/org/sonar/batch/index/MeasurePersister.java
sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureDto.java [deleted file]
sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureMapper.java [new file with mode: 0644]
sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModelMapper.java [deleted file]
sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper-oracle.xml [new file with mode: 0644]
sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml [new file with mode: 0644]
sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureModelMapper-oracle.xml [deleted file]
sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureModelMapper.xml [deleted file]

index 38b8e7ff3a395df67921789f02b706ba77a53eef..e8ed644c2c8cfad9c621eea0e1cf7a822da6ca5e 100644 (file)
  */
 package org.sonar.batch.index;
 
-import javax.annotation.Nullable;
-
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
 import com.google.common.collect.LinkedHashMultimap;
 import com.google.common.collect.Lists;
 import com.google.common.collect.SetMultimap;
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.ibatis.session.SqlSession;
 import org.slf4j.LoggerFactory;
-import org.sonar.api.database.model.MeasureDataDto;
-import org.sonar.api.database.model.MeasureDto;
+import org.sonar.api.database.model.MeasureMapper;
 import org.sonar.api.database.model.MeasureModel;
-import org.sonar.api.database.model.MeasureModelMapper;
 import org.sonar.api.database.model.Snapshot;
 import org.sonar.api.measures.Measure;
 import org.sonar.api.measures.Metric;
@@ -46,13 +40,14 @@ import org.sonar.api.rules.RuleFinder;
 import org.sonar.api.utils.SonarException;
 import org.sonar.core.persistence.MyBatis;
 
+import javax.annotation.Nullable;
+
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import static com.google.common.collect.Iterables.filter;
-
 import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.Iterables.filter;
 
 public final class MeasurePersister {
   private final MyBatis mybatis;
@@ -80,9 +75,9 @@ public final class MeasurePersister {
   public void dump() {
     LoggerFactory.getLogger(getClass()).debug("{} measures to dump", unsavedMeasuresByResource.size());
 
-    List<MeasureDto> measuresToSave = getMeasuresToSave();
-    insert(filter(measuresToSave, HAS_LARGE_DATA));
-    batchInsert(filter(measuresToSave, not(HAS_LARGE_DATA)));
+    List<MeasureModel> measures = getMeasuresToSave();
+    insert(filter(measures, HAS_MEASURE_DATA));
+    batchInsert(filter(measures, not(HAS_MEASURE_DATA)));
   }
 
   public void saveMeasure(Resource resource, Measure measure) {
@@ -135,8 +130,8 @@ public final class MeasurePersister {
       && (measure.getVariation5() == null || NumberUtils.compare(measure.getVariation5().doubleValue(), 0.0) == 0);
   }
 
-  private List<MeasureDto> getMeasuresToSave() {
-    List<MeasureDto> batch = Lists.newArrayList();
+  private List<MeasureModel> getMeasuresToSave() {
+    List<MeasureModel> measures = Lists.newArrayList();
 
     Map<Resource, Collection<Measure>> map = unsavedMeasuresByResource.asMap();
     for (Map.Entry<Resource, Collection<Measure>> entry : map.entrySet()) {
@@ -144,13 +139,13 @@ public final class MeasurePersister {
       Snapshot snapshot = resourcePersister.getSnapshot(entry.getKey());
       for (Measure measure : entry.getValue()) {
         if (shouldPersistMeasure(resource, measure)) {
-          batch.add(new MeasureDto(model(measure).setSnapshotId(snapshot.getId())));
+          measures.add(model(measure).setSnapshotId(snapshot.getId()));
         }
       }
     }
 
     unsavedMeasuresByResource.clear();
-    return batch;
+    return measures;
   }
 
   private MeasureModel model(Measure measure) {
@@ -188,27 +183,31 @@ public final class MeasurePersister {
     return model;
   }
 
-  private void batchInsert(Iterable<MeasureDto> values) {
+  private void batchInsert(Iterable<MeasureModel> values) {
     SqlSession session = mybatis.openBatchSession();
     try {
-      MeasureModelMapper mapper = session.getMapper(MeasureModelMapper.class);
-      for (MeasureDto value : values) {
+      MeasureMapper mapper = session.getMapper(MeasureMapper.class);
+
+      for (MeasureModel value : values) {
         mapper.insert(value);
       }
+
       session.commit();
     } finally {
       MyBatis.closeQuietly(session);
     }
   }
 
-  private void insert(Iterable<MeasureDto> values) {
+  private void insert(Iterable<MeasureModel> values) {
     SqlSession session = mybatis.openSession();
     try {
-      MeasureModelMapper mapper = session.getMapper(MeasureModelMapper.class);
-      for (MeasureDto value : values) {
+      MeasureMapper mapper = session.getMapper(MeasureMapper.class);
+
+      for (MeasureModel value : values) {
         mapper.insert(value);
-        mapper.insertData(new MeasureDataDto(value.getId(), value.getSnapshotId(), value.getMeasureData().getData()));
+        mapper.insertData(value);
       }
+
       session.commit();
     } finally {
       MyBatis.closeQuietly(session);
@@ -216,42 +215,46 @@ public final class MeasurePersister {
   }
 
   private MeasureModel insert(Measure measure, Snapshot snapshot) {
-    MeasureModel model = model(measure).setSnapshotId(snapshot.getId());
+    MeasureModel value = model(measure);
+    value.setSnapshotId(snapshot.getId());
 
     SqlSession session = mybatis.openSession();
     try {
-      MeasureModelMapper mapper = session.getMapper(MeasureModelMapper.class);
-      MeasureDto value = new MeasureDto(model);
+      MeasureMapper mapper = session.getMapper(MeasureMapper.class);
+
       mapper.insert(value);
       if (value.getMeasureData() != null) {
-        mapper.insertData(new MeasureDataDto(value.getId(), value.getSnapshotId(), value.getMeasureData().getData()));
+        mapper.insertData(value);
       }
+
       session.commit();
     } finally {
       MyBatis.closeQuietly(session);
     }
 
-    return model;
+    return value;
   }
 
   private MeasureModel update(Measure measure) {
-    MeasureModel model = model(measure);
-    model.setId(measure.getId());
+    MeasureModel value = model(measure);
+    value.setId(measure.getId());
 
     SqlSession session = mybatis.openSession();
     try {
-      MeasureModelMapper mapper = session.getMapper(MeasureModelMapper.class);
-      mapper.update(new MeasureDto(model));
+      MeasureMapper mapper = session.getMapper(MeasureMapper.class);
+
+      mapper.update(value);
+
       session.commit();
     } finally {
       MyBatis.closeQuietly(session);
     }
 
-    return model;
+    return value;
   }
 
-  private static final Predicate<MeasureDto> HAS_LARGE_DATA = new Predicate<MeasureDto>() {
-    public boolean apply(@Nullable MeasureDto measure) {
+  private static final Predicate<MeasureModel> HAS_MEASURE_DATA = new Predicate<MeasureModel>() {
+    public boolean apply(@Nullable MeasureModel measure) {
       return (null != measure) && (measure.getMeasureData() != null);
     }
   };
index 73825c29e26a79cc6461ac639e1f6be6a4cd150d..9fd5e305e66bfcfe7edbd8c93a439b26bf40a4ac 100644 (file)
@@ -33,9 +33,8 @@ import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
 import org.slf4j.LoggerFactory;
 import org.sonar.api.BatchComponent;
 import org.sonar.api.ServerComponent;
-import org.sonar.api.database.model.MeasureDataDto;
-import org.sonar.api.database.model.MeasureDto;
-import org.sonar.api.database.model.MeasureModelMapper;
+import org.sonar.api.database.model.MeasureMapper;
+import org.sonar.api.database.model.MeasureModel;
 import org.sonar.core.dashboard.ActiveDashboardDto;
 import org.sonar.core.dashboard.ActiveDashboardMapper;
 import org.sonar.core.dashboard.DashboardDto;
@@ -129,8 +128,7 @@ public class MyBatis implements BatchComponent, ServerComponent {
     loadAlias(conf, "UserRole", UserRoleDto.class);
     loadAlias(conf, "Widget", WidgetDto.class);
     loadAlias(conf, "WidgetProperty", WidgetPropertyDto.class);
-    loadAlias(conf, "MeasureDto", MeasureDto.class);
-    loadAlias(conf, "MeasureDataDto", MeasureDataDto.class);
+    loadAlias(conf, "MeasureModel", MeasureModel.class);
 
     loadMapper(conf, ActiveDashboardMapper.class);
     loadMapper(conf, AuthorMapper.class);
@@ -156,7 +154,7 @@ public class MyBatis implements BatchComponent, ServerComponent {
     loadMapper(conf, UserMapper.class);
     loadMapper(conf, WidgetMapper.class);
     loadMapper(conf, WidgetPropertyMapper.class);
-    loadMapper(conf, MeasureModelMapper.class);
+    loadMapper(conf, MeasureMapper.class);
 
     sessionFactory = new SqlSessionFactoryBuilder().build(conf);
     return this;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureDto.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureDto.java
deleted file mode 100644 (file)
index 67e015f..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
- */
-package org.sonar.api.database.model;
-
-import java.util.Date;
-
-public class MeasureDto {
-  private final Long id;
-  private final Double value;
-  private final String textValue;
-  private final Integer tendency;
-  private final Integer metricId;
-  private final Integer snapshotId;
-  private final Integer projectId;
-  private final String description;
-  private final Date measureDate;
-  private final Integer ruleId;
-  private final Integer rulePriority;
-  private final String alertStatus;
-  private final String alertText;
-  private final Double variationValue1;
-  private final Double variationValue2;
-  private final Double variationValue3;
-  private final Double variationValue4;
-  private final Double variationValue5;
-  private final String url;
-  private final Integer characteristicId;
-  private final Integer personId;
-  private final MeasureData measureData;
-
-  public MeasureDto(MeasureModel model) {
-    id = model.getId();
-    value = model.getValue();
-    textValue = model.getTextValue();
-    tendency = model.getTendency();
-    metricId = model.getMetricId();
-    snapshotId = model.getSnapshotId();
-    projectId = model.getProjectId();
-    description = model.getDescription();
-    measureDate = model.getMeasureDate();
-    ruleId = model.getRuleId();
-    rulePriority = (null == model.getRulePriority()) ? null : model.getRulePriority().ordinal();
-    alertStatus = (null == model.getAlertStatus()) ? null : model.getAlertStatus().name();
-    alertText = model.getAlertText();
-    variationValue1 = model.getVariationValue1();
-    variationValue2 = model.getVariationValue2();
-    variationValue3 = model.getVariationValue3();
-    variationValue4 = model.getVariationValue4();
-    variationValue5 = model.getVariationValue5();
-    url = model.getUrl();
-    characteristicId = (null == model.getCharacteristic()) ? null : model.getCharacteristic().getId();
-    personId = model.getPersonId();
-    measureData = model.getMeasureData();
-  }
-
-  public Long getId() {
-    return id;
-  }
-
-  public Double getValue() {
-    return value;
-  }
-
-  public String getTextValue() {
-    return textValue;
-  }
-
-  public Integer getTendency() {
-    return tendency;
-  }
-
-  public Integer getMetricId() {
-    return metricId;
-  }
-
-  public Integer getSnapshotId() {
-    return snapshotId;
-  }
-
-  public Integer getProjectId() {
-    return projectId;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public Date getMeasureDate() {
-    return measureDate;
-  }
-
-  public Integer getRuleId() {
-    return ruleId;
-  }
-
-  public Integer getRulePriority() {
-    return rulePriority;
-  }
-
-  public String getAlertStatus() {
-    return alertStatus;
-  }
-
-  public String getAlertText() {
-    return alertText;
-  }
-
-  public Double getVariationValue1() {
-    return variationValue1;
-  }
-
-  public Double getVariationValue2() {
-    return variationValue2;
-  }
-
-  public Double getVariationValue3() {
-    return variationValue3;
-  }
-
-  public Double getVariationValue4() {
-    return variationValue4;
-  }
-
-  public Double getVariationValue5() {
-    return variationValue5;
-  }
-
-  public String getUrl() {
-    return url;
-  }
-
-  public Integer getCharacteristicId() {
-    return characteristicId;
-  }
-
-  public Integer getPersonId() {
-    return personId;
-  }
-
-  public MeasureData getMeasureData() {
-    return measureData;
-  }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureMapper.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureMapper.java
new file mode 100644 (file)
index 0000000..5995096
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
+ */
+package org.sonar.api.database.model;
+
+public interface MeasureMapper {
+  void insert(MeasureModel measure);
+
+  void insertData(MeasureModel data);
+
+  void update(MeasureModel measure);
+}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModelMapper.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModelMapper.java
deleted file mode 100644 (file)
index 7795880..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
- */
-package org.sonar.api.database.model;
-
-public interface MeasureModelMapper {
-  void insert(MeasureDto measure);
-
-  void insertData(MeasureDataDto data);
-
-  void update(MeasureDto measure);
-}
diff --git a/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper-oracle.xml b/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper-oracle.xml
new file mode 100644 (file)
index 0000000..4213e3c
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="org.sonar.api.database.model.MeasureMapper">
+
+  <insert id="insert" parameterType="MeasureModel" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+    <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+      select project_measures_seq.NEXTVAL from DUAL
+    </selectKey>
+    INSERT INTO project_measures (id,
+      value, metric_id, snapshot_id, rule_id, text_value, tendency, measure_date,
+      project_id, alert_status, alert_text, url, description, rule_priority, characteristic_id, variation_value_1,
+      variation_value_2, variation_value_3, variation_value_4, variation_value_5, person_id)
+    VALUES (#{id},
+      #{value}, #{metricId}, #{snapshotId}, #{ruleId}, #{textValue, jdbcType=VARCHAR}, #{tendency},
+      #{measureDate, jdbcType=TIMESTAMP}, #{projectId}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
+      #{url, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{rulePriority.ordinal}, #{characteristic.id}, #{variationValue1},
+      #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
+    )
+  </insert>
+
+  <insert id="insertData" parameterType="MeasureModel" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+    <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+      select measure_data_seq.NEXTVAL from DUAL
+    </selectKey>
+    INSERT INTO measure_data (id, measure_id, snapshot_id, data)
+    VALUES (#{id}, #{measureData.measure.id}, #{snapshotId}, #{measureData.data}) 
+  </insert>
+  
+  <update id="update" parameterType="MeasureModel">
+    UPDATE project_measures
+    SET
+      value = #{value},
+      metric_id = #{metricId},
+      rule_id = #{ruleId},
+      text_value = #{textValue, jdbcType=VARCHAR},
+      tendency = #{tendency},
+      alert_status = #{alertStatus, jdbcType=VARCHAR},
+      alert_text = #{alertText, jdbcType=VARCHAR},
+      url = #{url, jdbcType=VARCHAR},
+      description = #{description, jdbcType=VARCHAR},
+      rule_priority = #{rulePriority.ordinal},
+      characteristic_id = #{characteristic.id},
+      variation_value_1 = #{variationValue1},
+      variation_value_2 = #{variationValue2},
+      variation_value_3 = #{variationValue3},
+      variation_value_4 = #{variationValue4},
+      variation_value_5 = #{variationValue5},
+      person_id = #{personId}
+    WHERE id = #{id}
+  </update>
+
+</mapper>
diff --git a/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml b/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureMapper.xml
new file mode 100644 (file)
index 0000000..b24af94
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="org.sonar.api.database.model.MeasureMapper">
+
+  <insert id="insert" parameterType="MeasureModel" useGeneratedKeys="true" keyProperty="id">
+    INSERT INTO project_measures (
+      value, metric_id, snapshot_id, rule_id, text_value, tendency, measure_date,
+      project_id, alert_status, alert_text, url, description, rule_priority, characteristic_id, variation_value_1,
+      variation_value_2, variation_value_3, variation_value_4, variation_value_5, person_id)
+    VALUES (
+      #{value}, #{metricId}, #{snapshotId}, #{ruleId}, #{textValue, jdbcType=VARCHAR}, #{tendency},
+      #{measureDate, jdbcType=TIMESTAMP}, #{projectId}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
+      #{url, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{rulePriority.ordinal}, #{characteristic.id}, #{variationValue1},
+      #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
+    )
+  </insert>
+  
+  <insert id="insertData" parameterType="MeasureModel" useGeneratedKeys="true" keyProperty="id">
+    INSERT INTO measure_data (measure_id, snapshot_id, data)
+    VALUES (#{measureData.measure.id}, #{snapshotId}, #{measureData.data}) 
+  </insert>
+  
+  <update id="update" parameterType="MeasureModel">
+    UPDATE project_measures
+    SET
+      value = #{value},
+      metric_id = #{metricId},
+      rule_id = #{ruleId},
+      text_value = #{textValue, jdbcType=VARCHAR},
+      tendency = #{tendency},
+      alert_status = #{alertStatus, jdbcType=VARCHAR},
+      alert_text = #{alertText, jdbcType=VARCHAR},
+      url = #{url, jdbcType=VARCHAR},
+      description = #{description, jdbcType=VARCHAR},
+      rule_priority = #{rulePriority.ordinal},
+      characteristic_id = #{characteristic.id},
+      variation_value_1 = #{variationValue1},
+      variation_value_2 = #{variationValue2},
+      variation_value_3 = #{variationValue3},
+      variation_value_4 = #{variationValue4},
+      variation_value_5 = #{variationValue5},
+      person_id = #{personId}
+    WHERE id = #{id}
+  </update>
+
+</mapper>
diff --git a/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureModelMapper-oracle.xml b/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureModelMapper-oracle.xml
deleted file mode 100644 (file)
index 655f4ce..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="org.sonar.api.database.model.MeasureModelMapper">
-
-  <insert id="insert" parameterType="MeasureDto" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
-    <selectKey order="BEFORE" resultType="Long" keyProperty="id">
-      select project_measures_seq.NEXTVAL from DUAL
-    </selectKey>
-    INSERT INTO project_measures (id,
-      value, metric_id, snapshot_id, rule_id, text_value, tendency, measure_date,
-      project_id, alert_status, alert_text, url, description, rule_priority, characteristic_id, variation_value_1,
-      variation_value_2, variation_value_3, variation_value_4, variation_value_5, person_id)
-    VALUES (#{id},
-      #{value}, #{metricId}, #{snapshotId}, #{ruleId}, #{textValue, jdbcType=VARCHAR}, #{tendency},
-      #{measureDate, jdbcType=TIMESTAMP}, #{projectId}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
-      #{url, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{rulePriority}, #{characteristicId}, #{variationValue1},
-      #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
-    )
-  </insert>
-  
-
-  <update id="update" parameterType="MeasureDto">
-    UPDATE project_measures
-    SET
-      value = #{value},
-      metric_id = #{metricId},
-      rule_id = #{ruleId},
-      text_value = #{textValue, jdbcType=VARCHAR},
-      tendency = #{tendency},
-      alert_status = #{alertStatus, jdbcType=VARCHAR},
-      alert_text = #{alertText, jdbcType=VARCHAR},
-      url = #{url, jdbcType=VARCHAR},
-      description = #{description, jdbcType=VARCHAR},
-      rule_priority = #{rulePriority},
-      characteristic_id = #{characteristicId},
-      variation_value_1 = #{variationValue1},
-      variation_value_2 = #{variationValue2},
-      variation_value_3 = #{variationValue3},
-      variation_value_4 = #{variationValue4},
-      variation_value_5 = #{variationValue5},
-      person_id = #{personId}
-    WHERE id = #{id}
-  </update>
-
-</mapper>
diff --git a/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureModelMapper.xml b/sonar-plugin-api/src/main/resources/org/sonar/api/database/model/MeasureModelMapper.xml
deleted file mode 100644 (file)
index b396b9c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="org.sonar.api.database.model.MeasureModelMapper">
-
-  <insert id="insert" parameterType="MeasureDto" useGeneratedKeys="true" keyProperty="id">
-    INSERT INTO project_measures (
-      value, metric_id, snapshot_id, rule_id, text_value, tendency, measure_date,
-      project_id, alert_status, alert_text, url, description, rule_priority, characteristic_id, variation_value_1,
-      variation_value_2, variation_value_3, variation_value_4, variation_value_5, person_id)
-    VALUES (
-      #{value}, #{metricId}, #{snapshotId}, #{ruleId}, #{textValue, jdbcType=VARCHAR}, #{tendency},
-      #{measureDate, jdbcType=TIMESTAMP}, #{projectId}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR},
-      #{url, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{rulePriority}, #{characteristicId}, #{variationValue1},
-      #{variationValue2}, #{variationValue3}, #{variationValue4}, #{variationValue5}, #{personId}
-    )
-  </insert>
-  
-  <insert id="insertData" parameterType="MeasureDataDto" useGeneratedKeys="true" keyProperty="id">
-    INSERT INTO measure_data (measure_id, snapshot_id, data)
-    VALUES (#{measureId}, #{snapshotId}, #{data}) 
-  </insert>
-  
-  <update id="update" parameterType="MeasureDto">
-    UPDATE project_measures
-    SET
-      value = #{value},
-      metric_id = #{metricId},
-      rule_id = #{ruleId},
-      text_value = #{textValue, jdbcType=VARCHAR},
-      tendency = #{tendency},
-      alert_status = #{alertStatus, jdbcType=VARCHAR},
-      alert_text = #{alertText, jdbcType=VARCHAR},
-      url = #{url, jdbcType=VARCHAR},
-      description = #{description, jdbcType=VARCHAR},
-      rule_priority = #{rulePriority},
-      characteristic_id = #{characteristicId},
-      variation_value_1 = #{variationValue1},
-      variation_value_2 = #{variationValue2},
-      variation_value_3 = #{variationValue3},
-      variation_value_4 = #{variationValue4},
-      variation_value_5 = #{variationValue5},
-      person_id = #{personId}
-    WHERE id = #{id}
-  </update>
-
-</mapper>