Package org.sonar.server.exceptions

Examples of org.sonar.server.exceptions.NotFoundException


  }

  public Rule getNonNullByKey(RuleKey key) {
    Rule rule = index.getNullableByKey(key);
    if (rule == null) {
      throw new NotFoundException("Rule not found: " + key);
    }
    return rule;
  }
View Full Code Here


  }

  private CharacteristicDto findCharacteristic(Integer id, SqlSession session) {
    CharacteristicDto dto = dbClient.debtCharacteristicDao().selectById(id, session);
    if (dto == null) {
      throw new NotFoundException(String.format("Characteristic with id %s does not exists.", id));
    }
    return dto;
  }
View Full Code Here

  public void export(String profileKey, String exporterKey, Writer writer) {
    ProfileExporter exporter = findExporter(exporterKey);
    QualityProfileDto profile = loader.getByKey(profileKey);
    if (profile == null) {
      throw new NotFoundException("Unknown Quality profile: " + profileKey);
    }
    exporter.exportProfile(wrap(profile), writer);
  }
View Full Code Here

    for (ProfileExporter e : exporters) {
      if (exporterKey.equals(e.getKey())) {
        return e;
      }
    }
    throw new NotFoundException("Unknown quality profile exporter: " + exporterKey);
  }
View Full Code Here

    if (componentKey == null) {
      return null;
    } else {
      ResourceDto resourceDto = resourceDao.getResource(ResourceQuery.create().setKey(componentKey));
      if (resourceDto == null) {
        throw new NotFoundException(String.format("Component '%s' does not exist", componentKey));
      }
      return resourceDto.getId();
    }
  }
View Full Code Here

  }

  private Long templateId(String templateKey) {
    PermissionTemplateDto dto = permissionTemplateDao.selectTemplateByKey(templateKey);
    if (dto == null) {
      throw new NotFoundException(String.format("Template '%s' does not exist", templateKey));
    }
    return dto.getId();
  }
View Full Code Here

    UserSession.get().checkGlobalPermission(GlobalPermissions.SYSTEM_ADMIN);
    DbSession session = myBatis.openSession(false);
    try {
      GroupDto group = userDao.selectGroupByName(groupName, session);
      if (group == null) {
        throw new NotFoundException("Group does not exists : " + groupName);
      }
      permissionTemplateDao.removeByGroup(group.getId(), session);
      session.commit();
    } finally {
      MyBatis.closeQuietly(session);
View Full Code Here

    DbSession session = dbClient.openSession(false);
    try {
      ComponentDto component = dbClient.componentDao().getNullableByKey(session, fileKey);
      if (component == null) {
        throw new NotFoundException(String.format("Component '%s' does not exist", fileKey));
      }
      userSession.checkComponentPermission(UserRole.USER, fileKey);

      List<Period> periodList = periods(component.projectUuid(), session);
      Integer periodIndex = request.paramAsInt(PARAM_PERIOD);
View Full Code Here

    // Only static methods
  }

  public static QualityProfileDto checkProfileIsNotNull(@Nullable QualityProfileDto profile) {
    if (profile == null) {
      throw new NotFoundException("This quality profile does not exists.");
    }
    return profile;
  }
View Full Code Here

      DefaultIssue issue = getByKeyForUpdate(session, issueKey).toDefaultIssue();
      User user = null;
      if (!Strings.isNullOrEmpty(assignee)) {
        user = userFinder.findByLogin(assignee);
        if (user == null) {
          throw new NotFoundException("Unknown user: " + assignee);
        }
      }
      IssueChangeContext context = IssueChangeContext.createUser(new Date(), UserSession.get().login());
      if (issueUpdater.assign(issue, user, context)) {
        saveIssue(session, issue, context, null);
View Full Code Here

TOP

Related Classes of org.sonar.server.exceptions.NotFoundException

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.