/** {@inheritDoc} */
 @Override
 public void cancel(Cancelation cancelation) {
   this.setCancelation(cancelation);
   this.update();
   OutgoingUserMailBox.insert_BookingCancelation(this);
   this.getQueueBasedBookingRule().reduceQueue();
 }
 /** 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);
 }
  /**
   * 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);
  }
 /**
  * insert into db
  *
  * @throws DataIntegrityViolationException if it violates db rules
  */
 @Override
 public boolean insert() throws DataIntegrityViolationException {
   FamDaoProxy.bookingDao().insert(this);
   this.getQueueBasedBookingRule().incrementQueue();
   return OutgoingUserMailBox.insert_BookingMade(this);
 }