Package org.sonar.core.persistence

Examples of org.sonar.core.persistence.DbSession


    }
  }

  @CheckForNull
  public QualityProfileDto getByProjectAndLanguage(long projectId, String language, String key) {
    DbSession session = mybatis.openSession(false);
    try {
      return session.getMapper(QualityProfileMapper.class).selectByProjectIdAndLanguage(projectId, language, key);
    } finally {
      MyBatis.closeQuietly(session);
    }
  }
View Full Code Here


  public QualityProfileDto getByProjectAndLanguage(String projectKey, String language, String propertyKeyPrefix, DbSession session) {
    return session.getMapper(QualityProfileMapper.class).selectByProjectAndLanguage(projectKey, language, propertyKeyPrefix);
  }

  public List<QualityProfileDto> findByLanguage(String language) {
    DbSession session = mybatis.openSession(false);
    try {
      return session.getMapper(QualityProfileMapper.class).selectByLanguage(language);
    } finally {
      MyBatis.closeQuietly(session);
    }
  }
View Full Code Here

   *    {@link #getByKey(org.sonar.core.persistence.DbSession, String)}
   */
  @Deprecated
  @CheckForNull
  public QualityProfileDto getById(int id) {
    DbSession session = mybatis.openSession(false);
    try {
      return getById(id, session);
    } finally {
      MyBatis.closeQuietly(session);
    }
View Full Code Here

    return session.getMapper(QualityProfileMapper.class).selectParent(childKey);
  }

  @CheckForNull
  public QualityProfileDto getParent(String childKey) {
    DbSession session = mybatis.openSession(false);
    try {
      return getParent(childKey, session);
    } finally {
      MyBatis.closeQuietly(session);
    }
View Full Code Here

    return session.getMapper(QualityProfileMapper.class).selectParentById(childId);
  }

  @CheckForNull
  public QualityProfileDto getParentById(int childId) {
    DbSession session = mybatis.openSession(false);
    try {
      return getParentById(childId, session);
    } finally {
      MyBatis.closeQuietly(session);
    }
View Full Code Here

   * @deprecated Replaced by
   *    {@link #getByNameAndLanguage(String, String, org.sonar.core.persistence.DbSession)}
   */
  @Deprecated
  public QualityProfileDto getByNameAndLanguage(String name, String language) {
    DbSession session = mybatis.openSession(false);
    try {
      return getByNameAndLanguage(name, language, session);
    } finally {
      MyBatis.closeQuietly(session);
    }
View Full Code Here

      MyBatis.closeQuietly(session);
    }
  }

  public List<ComponentDto> selectProjects(String propertyKey, String propertyValue) {
    DbSession session = mybatis.openSession(false);
    try {
      return selectProjects(propertyKey, propertyValue, session);
    } finally {
      MyBatis.closeQuietly(session);
    }
View Full Code Here

  public List<ComponentDto> selectProjects(String propertyKey, String propertyValue, DbSession session) {
    return session.getMapper(QualityProfileMapper.class).selectProjects(propertyKey, propertyValue);
  }

  public int countProjects(String propertyKey, String propertyValue) {
    DbSession session = mybatis.openSession(false);
    try {
      return session.getMapper(QualityProfileMapper.class).countProjects(propertyKey, propertyValue);
    } finally {
      MyBatis.closeQuietly(session);
    }
  }
View Full Code Here

    this.dbClient = dbClient;
    this.ruleActivator = ruleActivator;
  }

  public void delete(RuleKey ruleKey) {
    DbSession dbSession = dbClient.openSession(false);
    try {
      RuleDto rule = dbClient.ruleDao().getByKey(dbSession, ruleKey);
      if (rule.getTemplateId() == null && !rule.getRepositoryKey().equals(RuleDoc.MANUAL_REPOSITORY)) {
        throw new IllegalStateException("Only custom rules and manual rules can be deleted");
      }

      // For custom rule, first deactivate the rule on all profiles
      if (rule.getTemplateId() != null) {
        ruleActivator.deactivate(dbSession, rule);
      }

      rule.setStatus(RuleStatus.REMOVED);
      dbClient.ruleDao().update(dbSession, rule);

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

    return toQProfiles(db.qualityProfileDao().findByLanguage(language));
  }

  @CheckForNull
  public QProfile profile(int id) {
    DbSession session = db.openSession(false);
    try {
      return profile(id, session);
    } finally {
      session.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.sonar.core.persistence.DbSession

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.