@Transactional(readOnly=true) @Cacheable(value="network_download_count",key="#user.id") public int countDownloadsByUserSince(final User user,final Long period){
  Objects.requireNonNull(user,"'user' parameter is null");
  Objects.requireNonNull(period,"'period' parameter is null");
  long current_timestamp=System.currentTimeMillis();
  if (period < 0 || period > current_timestamp) {
    throw new IllegalArgumentException("period time too high");
  }
  Date date=new Date(current_timestamp - period);
  return networkUsageDao.countDownloadByUserSince(user,date);
}

@ Transactional ( readOnly = true ) @ Cacheable ( value = "network_download_count" , key = "#user.id" ) public int countDownloadsByUserSince ( final User user , final Long period ) { Objects . requireNonNull ( user , "'user' parameter is null" ) ; Objects . requireNonNull ( period , "'period' parameter is null" ) ; long current_timestamp = System . currentTimeMillis ( ) ; if ( period < 0 || period > current_timestamp ) { throw new IllegalArgumentException ( "period time too high" ) ; } Date date = new Date ( current_timestamp - period ) ; return networkUsageDao . countDownloadByUserSince ( user , date ) ; }
returns number of downloads by a user on a given period .
