コード例 #1
0
  /**
   * @see
   *     org.telscenter.sail.webapp.service.offering.RunService#updateRunStatistics(org.telscenter.sail.webapp.domain.Run)
   */
  @Transactional()
  public void updateRunStatistics(Long runId) {

    try {
      Run run = retrieveById(runId);

      /* set the current time as the last time this run was run */
      run.setLastRun(Calendar.getInstance().getTime());

      /* increment the number of times this run has been run, if
       * the run has not yet been run, the times run will be null */
      if (run.getTimesRun() == null) {
        run.setTimesRun(1);
      } else {
        run.setTimesRun(run.getTimesRun() + 1);
      }

      /* save changes */
      this.runDao.save(run);
    } catch (ObjectNotFoundException e) {
      e.printStackTrace();
    }
  }