Examples of Migration44Mapper


Examples of org.sonar.core.persistence.migration.v44.Migration44Mapper

  @Override
  public void execute() {
    DbSession session = db.openSession(false);
    try {
      Migration44Mapper mapper = session.getMapper(Migration44Mapper.class);
      for (Long measureId : mapper.selectMeasuresOnDeletedQualityProfiles()) {
        mapper.deleteProfileMeasure(measureId);
      }
      session.commit();

    } finally {
      session.close();
View Full Code Here

Examples of org.sonar.core.persistence.migration.v44.Migration44Mapper

  }

  @Override
  public void execute() {
    DbSession session = db.openSession(false);
    Migration44Mapper migrationMapper = session.getMapper(Migration44Mapper.class);
    try {
      executeUpsert(session, ActiveRuleChange.Type.ACTIVATED, migrationMapper.selectActiveRuleChange(true));
      executeUpsert(session, ActiveRuleChange.Type.UPDATED, migrationMapper.selectActiveRuleChange(null));
      executeUpsert(session, ActiveRuleChange.Type.DEACTIVATED, migrationMapper.selectActiveRuleChange(false));
      session.commit();
    } finally {
      session.close();
    }
  }
View Full Code Here

Examples of org.sonar.core.persistence.migration.v44.Migration44Mapper

  public void execute() {
    DbSession session = db.openSession(false);
    try {
      int i = 0;
      Date now = new Date();
      Migration44Mapper mapper = session.getMapper(Migration44Mapper.class);
      for (ProfileMeasure profileMeasure : mapper.selectProfileMeasures()) {
        boolean updated = false;
        Integer version = mapper.selectProfileVersion(profileMeasure.getSnapshotId());
        QProfileDto44 profile = mapper.selectProfileById(profileMeasure.getProfileId());
        if (profile != null) {
          Date date = now;
          if (version != null) {
            date = (Date)ObjectUtils.defaultIfNull(
              mapper.selectProfileVersionDate(profileMeasure.getProfileId(), version), now);
          }
          // see format of JSON in org.sonar.batch.rule.UsedQProfiles
          StringWriter writer = new StringWriter();
          JsonWriter json = JsonWriter.of(writer);
          json
            .beginArray()
            .beginObject()
            .prop("key", profile.getKee())
            .prop("language", profile.getLanguage())
            .prop("name", profile.getName())
            .prop("rulesUpdatedAt", UtcDateUtils.formatDateTime(date))
            .endObject()
            .endArray()
            .close();
          mapper.updateProfileMeasure(profileMeasure.getId(), writer.toString());
          updated = true;
        }
        if (!updated) {
          mapper.deleteProfileMeasure(profileMeasure.getId());
        }
        if (i % 100 == 0) {
          session.commit();
          i++;
        }
View Full Code Here

Examples of org.sonar.core.persistence.migration.v44.Migration44Mapper

    DbSession session = db.openSession(false);
    try {
      Date now = new Date(system.now());
      int i = 0;
      QualityProfileMapper profileMapper = session.getMapper(QualityProfileMapper.class);
      Migration44Mapper migrationMapper = session.getMapper(Migration44Mapper.class);
      for (QualityProfileDto profile : profileMapper.selectAll()) {
        Date createdAt = (Date) ObjectUtils.defaultIfNull(migrationMapper.selectProfileCreatedAt(profile.getId()), now);
        Date updatedAt = (Date) ObjectUtils.defaultIfNull(migrationMapper.selectProfileUpdatedAt(profile.getId()), now);

        migrationMapper.updateProfileDates(profile.getId(), createdAt, updatedAt, UtcDateUtils.formatDateTime(updatedAt));
        if (i % 100 == 0) {
          session.commit();
          i++;
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.