Exemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
  public List<Job> getUsersJobsForStatistics(final String username) {

    final User user = userDao.getUser(username);

    if (user == null) {
      throw new IllegalArgumentException("No user found for username " + username);
    }

    if (AcegiUtil.hasRole(Roles.ADMIN.name())) {
      return jobDao.getAll();
    }

    return jobDao.getAllUserJobsForStatistics(user.getId());
  }
Exemplo n.º 2
0
  /** {@inheritDoc} */
  @Override
  @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
  public List<Job> getUsersJobsForStatistics(String username, Integer maxResult) {

    final User user = userDao.getUser(username);

    if (user == null) {
      throw new IllegalArgumentException("No user found for username " + username);
    }

    boolean administrator = false;

    if (AcegiUtil.hasRole(Roles.ADMIN.name())) {
      administrator = true;
    }

    return jobDao.getUsersJobsForStatistics(user.getId(), maxResult, administrator);
  }
Exemplo n.º 3
0
  /** {@inheritDoc} */
  @Override
  @Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
  public List<Job> getUsersJobs(final String username) {

    List<Job> jobs = null;
    User user = userDao.getUser(username);

    boolean administrator = false;

    if (AcegiUtil.containsRole(user.getAuthorities(), Roles.ADMIN.name())) {
      administrator = true;
    }

    if (administrator) {
      jobs = jobDao.getAllJobs();
    } else {
      jobs = jobDao.getAllUserJobs(username);
    }

    return jobs;
  }