コード例 #1
0
 /** stop the session of the booking now. update session after starting. */
 public void stopSession() {
   long start = this.realSessionTimeFrame.getStart();
   long end = new Date().getTime();
   this.setRealSessionTimeFrame(start, end);
   this.update();
   this.getQueueBasedBookingRule().reduceQueue();
   OutgoingUserMailBox.insert_BookingProcessed(this);
 }
コード例 #2
0
  /**
   * process the session. means set and update real session time frame. if session has been started,
   * take this start point. otherwise take {@link QueueBasedBookingRule#getUnitsPerHourProcessed()}
   * for the duration and go back in time from now.
   */
  @Override
  public void processSession() {
    Long start = null;
    if (this.sessionAlreadyBegun()) {
      start = this.realSessionTimeFrame.getStart();
    } else {
      Integer uphp = this.getQueueBasedBookingRule().getUnitsPerHourProcessed();
      uphp = uphp == null ? 1 : uphp; // nothing set? take 1 hour
      Calendar startc = Calendar.getInstance();

      startc.add(Calendar.MINUTE, 60 / uphp * -1);
      start = startc.getTimeInMillis();
    }
    long end = new Date().getTime();
    this.setRealSessionTimeFrame(start.longValue(), end);
    this.setProcessed();
    this.update();
    this.getQueueBasedBookingRule().reduceQueue();
    OutgoingUserMailBox.insert_BookingProcessed(this);
  }