Package tigase.workgroupqueues.scheduler

## Class DefaultController

- java.lang.Object
- - tigase.workgroupqueues.scheduler.DefaultController

- All Implemented Interfaces:
    `Initializable`, `Controller`

      @Bean(name="Controller",
            active=true)
      public class DefaultController
      extends java.lang.Object
      implements Controller, Initializable

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultController()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addAgent​(Agent agent)` | Add new agent.
    `void` | `addUser​(User user)` | Add user to waiting queue.
    `Room` | `createRoomInstance​(Queue queue, User user)` | Creates instance of `Room` instance.
    `void` | `doSomething​(Queue queue)` |
    `java.util.Collection<ISequenceAction>` | `getAddAgentToRoomActions​(Queue queue, User user, Agent agent, Room room)` | Returns collection of `Actions` to add `Agent` to room in MUC Component.
    `PresenceModule` | `getAgentPresenceModule()` |
    `EventBus` | `getEventBus()` |
    `JoinQueueModule` | `getJoinQueueModule()` |
    `MucControllerModule` | `getMucController()` |
    `OfferModule` | `getOfferModule()` |
    `Queue` | `getQueue​(BareJID jid)` | Return `Queue` by JabberID.
    `int` | `getQueueUserPosition​(User user)` | Returns position of user in his queue.
    `int` | `getQueueUserWaitingTime​(User user)` | Estimated waiting time to handle user.
    `java.util.Collection<ISequenceAction>` | `getRoomCreateActions​(Queue queue, User user, Room room)` | Returns collection of `Actions` to create room in MUC Component.
    `Scheduler` | `getScheduler()` |
    `Store` | `getStore()` |
    `QueueStatusModule` | `getUserQueueStatusModule()` |
    `void` | `initialize()` | Method will be called, when bean will be created, configured and ready to use.
    `void` | `offerAccepted​(Offer offer)` | Offer is accepted.
    `void` | `offerRejected​(Offer offer)` | Offer is rejected and it will return to waiting queue.
    `void` | `removeAgent​(Agent agent)` | Remove agent (because agent is no longe available for Workgroup Queues Component).
    `void` | `removeUser​(User user)` | Remove user/
    `void` | `sendNotifications()` | Sends all notifications to all users and all agents.
    `void` | `setAgentPresenceModule​(PresenceModule agentPresenceModule)` |
    `void` | `setEventBus​(EventBus eventBus)` |
    `void` | `setJoinQueueModule​(JoinQueueModule joinQueueModule)` |
    `void` | `setMucController​(MucControllerModule mucController)` |
    `void` | `setOfferModule​(OfferModule offerModule)` |
    `void` | `setScheduler​(Scheduler scheduler)` |
    `void` | `setStore​(Store store)` |
    `void` | `setUserQueueStatusModule​(QueueStatusModule userQueueStatusModule)` |
    `void` | `updateAgent​(Agent agent)` | Update status of agent.
    `void` | `updateUser​(User user)` | Update status of user.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultController

          public DefaultController()

  - ### Method Detail

    - #### addAgent

          public void addAgent​(Agent agent)

      Description copied from interface: `Controller`
      Add new agent.
      Specified by:
        `addAgent` in interface `Controller`
      Parameters:
        `agent` - agent to add.

    - #### addUser

          public void addUser​(User user)

      Description copied from interface: `Controller`
      Add user to waiting queue.
      Specified by:
        `addUser` in interface `Controller`
      Parameters:
        `user` - user to add.

    - #### createRoomInstance

          public Room createRoomInstance​(Queue queue,
                                         User user)
                                  throws TigaseStringprepException

      Description copied from interface: `Controller`
      Creates instance of `Room` instance. Do not creates Room on MUC Component!
      Specified by:
        `createRoomInstance` in interface `Controller`
      Parameters:
        `queue` - queue.
        `user` - user.
      Returns:
        instance of `Room` class.
      Throws:
        `TigaseStringprepException` - when invalid JID is processed somewhere.

    - #### doSomething

          public void doSomething​(Queue queue)

    - #### getAddAgentToRoomActions

          public java.util.Collection<ISequenceAction> getAddAgentToRoomActions​(Queue queue,
                                                                                User user,
                                                                                Agent agent,
                                                                                Room room)

      Description copied from interface: `Controller`
      Returns collection of `Actions` to add `Agent` to room in MUC Component. Actions must be exevuted in `Sequencer`.
      Specified by:
        `getAddAgentToRoomActions` in interface `Controller`
      Parameters:
        `queue` - queue.
        `user` - user.
        `agent` - agent.
        `room` - room.
      Returns:
        collections of `Actions`.

    - #### getAgentPresenceModule

          public PresenceModule getAgentPresenceModule()

    - #### setAgentPresenceModule

          public void setAgentPresenceModule​(PresenceModule agentPresenceModule)

    - #### getEventBus

          public EventBus getEventBus()

    - #### setEventBus

          public void setEventBus​(EventBus eventBus)

    - #### getJoinQueueModule

          public JoinQueueModule getJoinQueueModule()

    - #### setJoinQueueModule

          public void setJoinQueueModule​(JoinQueueModule joinQueueModule)

    - #### getMucController

          public MucControllerModule getMucController()

    - #### setMucController

          public void setMucController​(MucControllerModule mucController)

    - #### getOfferModule

          public OfferModule getOfferModule()

    - #### setOfferModule

          public void setOfferModule​(OfferModule offerModule)

    - #### getQueue

          public Queue getQueue​(BareJID jid)

      Description copied from interface: `Controller`
      Return `Queue` by JabberID.
      Specified by:
        `getQueue` in interface `Controller`
      Parameters:
        `jid` - JID of workgroup queue.
      Returns:
        queue or `null` if queue doesn't exists.

    - #### getQueueUserPosition

          public int getQueueUserPosition​(User user)

      Description copied from interface: `Controller`
      Returns position of user in his queue.
      Specified by:
        `getQueueUserPosition` in interface `Controller`
      Parameters:
        `user` - user
      Returns:
        position in queue.

    - #### getQueueUserWaitingTime

          public int getQueueUserWaitingTime​(User user)

      Description copied from interface: `Controller`
      Estimated waiting time to handle user.
      Specified by:
        `getQueueUserWaitingTime` in interface `Controller`
      Parameters:
        `user` - user.
      Returns:
        time in seconds.

    - #### getRoomCreateActions

          public java.util.Collection<ISequenceAction> getRoomCreateActions​(Queue queue,
                                                                            User user,
                                                                            Room room)

      Description copied from interface: `Controller`
      Returns collection of `Actions` to create room in MUC Component. Actions must be executed in `Sequencer`.
      Specified by:
        `getRoomCreateActions` in interface `Controller`
      Parameters:
        `queue` - queue
        `user` - user
        `room` - room
      Returns:
        collections of `Actions`.

    - #### getScheduler

          public Scheduler getScheduler()

    - #### setScheduler

          public void setScheduler​(Scheduler scheduler)

    - #### getStore

          public Store getStore()

    - #### setStore

          public void setStore​(Store store)

    - #### getUserQueueStatusModule

          public QueueStatusModule getUserQueueStatusModule()

    - #### setUserQueueStatusModule

          public void setUserQueueStatusModule​(QueueStatusModule userQueueStatusModule)

    - #### initialize

          public void initialize()

      Description copied from interface: `Initializable`
      Method will be called, when bean will be created, configured and ready to use.
      Specified by:
        `initialize` in interface `Initializable`

    - #### offerAccepted

          public void offerAccepted​(Offer offer)

      Description copied from interface: `Controller`
      Offer is accepted. Agent should be invited, room created, etc.
      Specified by:
        `offerAccepted` in interface `Controller`
      Parameters:
        `offer` - offer to be accepted.

    - #### offerRejected

          public void offerRejected​(Offer offer)

      Description copied from interface: `Controller`
      Offer is rejected and it will return to waiting queue.
      Specified by:
        `offerRejected` in interface `Controller`
      Parameters:
        `offer` - offer to be rejected.

    - #### removeAgent

          public void removeAgent​(Agent agent)

      Description copied from interface: `Controller`
      Remove agent (because agent is no longe available for Workgroup Queues Component).
      Specified by:
        `removeAgent` in interface `Controller`
      Parameters:
        `agent` - agent to be removed.

    - #### removeUser

          public void removeUser​(User user)

      Description copied from interface: `Controller`
      Remove user/
      Specified by:
        `removeUser` in interface `Controller`
      Parameters:
        `user` - user to be removed.

    - #### sendNotifications

          public void sendNotifications()

      Description copied from interface: `Controller`
      Sends all notifications to all users and all agents.
      Specified by:
        `sendNotifications` in interface `Controller`

    - #### updateAgent

          public void updateAgent​(Agent agent)

      Description copied from interface: `Controller`
      Update status of agent.
      Specified by:
        `updateAgent` in interface `Controller`
      Parameters:
        `agent` - agent.

    - #### updateUser

          public void updateUser​(User user)

      Description copied from interface: `Controller`
      Update status of user.
      Specified by:
        `updateUser` in interface `Controller`
      Parameters:
        `user` - user.