예제 #1
0
파일: Offer.java 프로젝트: Redor/Openfire
 @Override
 public boolean equals(Object obj) {
   boolean eq = false;
   if (obj instanceof Offer) {
     Offer otherOffer = (Offer) obj;
     eq = request.equals(otherOffer.getRequest());
   }
   return eq;
 }
예제 #2
0
파일: Offer.java 프로젝트: Redor/Openfire
 /**
  * Create an offer based on the request.
  *
  * @param request The request this offer is for
  * @param queue The request queue that is sending this offer to the agents.
  * @param rejectionTimeout the number of milliseconds to wait until expiring an agent rejection.
  */
 public Offer(Request request, RequestQueue queue, long rejectionTimeout) {
   this.request = request;
   this.queue = queue;
   this.rejectionTimeout = rejectionTimeout;
   offerTime = new Date();
   cancelled = false;
   invitationSent = false;
   request.setOffer(this);
 }
예제 #3
0
파일: Offer.java 프로젝트: Redor/Openfire
  public void cancel() {
    cancelled = true;

    // Handle when customer cancels.
    if (!pendingSessions.isEmpty() || !acceptedSessions.isEmpty()) {
      for (AgentSession session : pendingSessions) {
        request.sendRevoke(session, queue);
      }
      for (AgentSession session : acceptedSessions) {
        request.sendRevoke(session, queue);
      }
      pendingSessions.clear();
      acceptedSessions.clear();
      updateUserSession(USER_CANCELLED);
    } else {
      updateUserSession(ROUTE_EXPIRED);
    }
  }
예제 #4
0
파일: Offer.java 프로젝트: Redor/Openfire
 public void invite(AgentSession agentSession) {
   if (acceptedSessions.contains(agentSession) && request != null) {
     // Ask the workgroup to send invitations to the agent and to the user that made the
     // request. The Workgroup will create a MUC room and send invitations to the agent and
     // the user.
     request.offerAccepted(agentSession);
     updateUserSession(ROUTED);
     invitationSent = true;
   }
 }
예제 #5
0
파일: Offer.java 프로젝트: Redor/Openfire
 public void waitForResolution() {
   long timeoutTime = offerTime.getTime() + timeout;
   while (timeoutTime > System.currentTimeMillis()
       && !isAccepted()
       && !pendingSessions.isEmpty()) {
     try {
       Thread.sleep(500); // half second polling
     } catch (InterruptedException e) {
       // do nothing
     }
   }
   if (!isAccepted()) {
     try {
       for (AgentSession session : pendingSessions) {
         request.sendRevoke(session, queue);
         reject(session);
       }
     } catch (Exception e) {
       // Ignore
     }
   }
 }
예제 #6
0
파일: Offer.java 프로젝트: Redor/Openfire
 /**
  * Updates the database tables with new session state, waitTime and metadata.
  *
  * @param state the state of this session.
  */
 private void updateUserSession(int state) {
   // Update the current session.
   request.updateSession(state, offerTime.getTime());
 }
예제 #7
0
파일: Offer.java 프로젝트: Redor/Openfire
 @Override
 public int hashCode() {
   return request.hashCode();
 }