Esempio 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());
  }
Esempio 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);
  }