Package org.sonar.server.db.migrations

Examples of org.sonar.server.db.migrations.MassUpdate$Handler


  @Override
  public void execute(Context context) throws SQLException {
    workDurationConvertor.init();
    final Date now = new Date(system2.now());
    MassUpdate massUpdate = context.prepareMassUpdate();
    massUpdate.select("SELECT ic.id, ic.change_data  FROM issue_changes ic " +
      "WHERE ic.change_type = 'diff' AND ic.change_data LIKE '%technicalDebt%'");
    massUpdate.update("UPDATE issue_changes SET change_data=?,updated_at=? WHERE id=?");
    massUpdate.execute(new MassUpdate.Handler() {
      @Override
      public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
        Long id = row.getLong(1);
        String changeData = row.getString(2);
View Full Code Here


    updateKeys(context);
    updateParentKeys(context);
  }

  private void updateKeys(Context context) throws SQLException {
    MassUpdate massUpdate = context.prepareMassUpdate();
    massUpdate.select("SELECT id,language,name FROM rules_profiles");
    massUpdate.update("UPDATE rules_profiles SET kee=? WHERE id=?");
    massUpdate.rowPluralName("profiles");
    massUpdate.execute(new MassUpdate.Handler() {
      @Override
      public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
        Long id = row.getLong(1);
        String lang = row.getString(2);
        String name = row.getString(3);
View Full Code Here

      }
    });
  }

  private void updateParentKeys(Context context) throws SQLException {
    MassUpdate massUpdate = context.prepareMassUpdate();
    massUpdate.select("SELECT child.id,parent.kee FROM rules_profiles child, rules_profiles parent WHERE child.parent_name=parent.name " +
      "and child.language=parent.language AND child.parent_name IS NOT NULL");
    massUpdate.update("UPDATE rules_profiles SET parent_kee=? WHERE id=?");
    massUpdate.execute(new MassUpdate.Handler() {
      @Override
      public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
        Long id = row.getLong(1);
        String parentKey = row.getString(2);
View Full Code Here

    super(database);
  }

  @Override
  public void execute(Context context) throws SQLException {
    MassUpdate massUpdate = context.prepareMassUpdate();
    massUpdate.rowPluralName("measures");
    massUpdate.select("select md.id, md.measure_id FROM measure_data md " +
      "inner join project_measures m on m.id=md.measure_id and m.measure_data is null");
    massUpdate.update("update project_measures SET measure_data = (SELECT md.data FROM measure_data md WHERE md.id = ?) WHERE id=?");
    massUpdate.execute(new MassUpdate.Handler() {
      @Override
      public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
        Long id = row.getLong(1);
        Long measureId = row.getLong(2);
View Full Code Here

  }

  @Override
  public void execute(Context context) throws SQLException {
    final Date now = new Date(system2.now());
    MassUpdate massUpdate = context.prepareMassUpdate();
    massUpdate.select("SELECT i.id FROM issues i " +
      "LEFT OUTER JOIN action_plans ap ON ap.kee=i.action_plan_key " +
      "WHERE i.action_plan_key IS NOT NULL " +
      "AND ap.kee is null");
    massUpdate.update("UPDATE issues SET action_plan_key=NULL,updated_at=? WHERE id=?");
    massUpdate.execute(new MassUpdate.Handler() {
      @Override
      public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
        Long id = row.getLong(1);

        update.setDate(1, now);
View Full Code Here

TOP

Related Classes of org.sonar.server.db.migrations.MassUpdate$Handler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.