Package org.jivesoftware.xmpp.workgroup

Examples of org.jivesoftware.xmpp.workgroup.Workgroup


        // Get requested group
        WorkgroupManager workgroupManager = WorkgroupManager.getInstance();

        // Load the workgroup
        try {
            Workgroup workgroup = workgroupManager.getWorkgroup(new JID(data.getData().get("workgroup").get(0)));
            workgroupManager.deleteWorkgroup(workgroup);
        } catch (UserNotFoundException e) {
            // Group not found
            note.addAttribute("type", "error");
            note.setText("Workgroup not found");
View Full Code Here


     * @param to the email address to send the transcript to.
     */
    public static void sendTranscriptByMail(String sessionID, String to) {
        final ChatSession chatSession = getChatSession(sessionID);
        final WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
        Workgroup workgroup = null;
        for (Workgroup wgroup : workgroupManager.getWorkgroups()) {
            if (wgroup.getID() == chatSession.getWorkgroupID()) {
                workgroup = wgroup;
                break;
            }
        }

        // If for some reason, the workgroup could not be found.
        if (workgroup == null) {
            return;
        }


        DbProperties props = workgroup.getProperties();
        String context = "jive.transcript";
        String from = props.getProperty(context + ".from");
        if (from == null) {
            from = workgroup.getJID().toBareJID();
        }

        String fromEmail = props.getProperty(context + ".fromEmail");
        if (fromEmail == null) {
            fromEmail = workgroup.getJID().toBareJID();
        }

        String subject = props.getProperty(context + ".subject");
        if (subject == null) {
            subject = "Chat transcript";
View Full Code Here

 
    public static String updateWorkgroup(String workgroupName, String displayName,
            String description, int maxSize, int minSize, long requestTimeout, long offerTimeout)
    {
        final WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
        Workgroup workgroup;
        try {
            workgroup = workgroupManager.getWorkgroup(new JID(workgroupName));
        }
        catch (UserNotFoundException e) {
            return getUpdateMessage(false, "The JID specified is invalid.");
        }
        workgroup.setDisplayName(displayName);
        workgroup.setDescription(description);
        if (maxSize < minSize) {
            return getUpdateMessage(false, "Max size must be greater or equal to min size.");
        }

        workgroup.setMaxChats(maxSize);
        workgroup.setMinChats(minSize);
        workgroup.setRequestTimeout(requestTimeout);
        workgroup.setOfferTimeout(offerTimeout);


        return getUpdateMessage(true, "Workgroup has been updated");
    }
View Full Code Here

        return getUpdateMessage(true, "Workgroup has been updated");
    }

    public static void toggleStatus(String workgroupName) {
        final WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
        Workgroup workgroup;
        try {
            workgroup = workgroupManager.getWorkgroup(new JID(workgroupName));
        }
        catch (UserNotFoundException e) {
            return;
        }

        Workgroup.Status status = workgroup.getStatus();
        if (status == Workgroup.Status.READY) {
            workgroup.setStatus(Workgroup.Status.CLOSED);
        }
        else {
            workgroup.setStatus(Workgroup.Status.READY);
        }
    }
View Full Code Here

        // do a create if there were no errors
        RequestQueue queue = null;
        if (errors.size() == 0) {
            try {
                // Create new workgroup
                Workgroup workgroup = wgManager.createWorkgroup(workgroupName);
                workgroup.setDescription(description);
                // Create a default workgroup queue
                queue = workgroup.createRequestQueue(defaultQueueName);
                //workgroup.setMaxChats(maxChats);
                //workgroup.setMinChats(minChats);
                // Make the workgroup ready by default:
                workgroup.setStatus(Workgroup.Status.READY);
                // Create default messages and images for the new workgroup
                ChatSettingsCreator.getInstance().createDefaultSettings(workgroup.getJID());

                // Add generic web form
                FormManager formManager = FormManager.getInstance();
                formManager.createGenericForm(workgroup);
            }
View Full Code Here

     */
    public byte[] getImage(String imageName, String workgroupName) {
        WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
        JID workgroupJID = new JID(workgroupName);

        Workgroup workgroup;
        try {
            workgroup = workgroupManager.getWorkgroup(workgroupJID);
        }
        catch (UserNotFoundException e) {
            Log.error(e.getMessage(), e);
View Full Code Here

            throws ServletException, IOException
    {
        String workgroupName = request.getParameter("workgroup");
        String action = request.getParameter("action");

        Workgroup workgroup = null;
        try {
            workgroup = WorkgroupManager.getInstance().getWorkgroup(new JID(workgroupName));
        }
        catch (UserNotFoundException e) {
           Log.error(e.getMessage(), e);
        }

        try {
            response.setContentType("audio/wav");
            if (action != null) {
                if ("incoming".equals(action.trim())) {
                    String incomingMessage = workgroup.getProperties().getProperty("incomingSound");
                    byte[] incomingBytes = StringUtils.decodeBase64(incomingMessage);
                    response.getOutputStream().write(incomingBytes);
                }
                else if ("outgoing".equals(action.trim())) {
                    String outgoingMessage = workgroup.getProperties().getProperty("outgoingSound");
                    String outgoingBytes = StringUtils.encodeBase64(outgoingMessage);
                    response.getOutputStream().write(outgoingBytes.getBytes("UTF-8"));
                }
            }
        }
View Full Code Here

        // Register the provider of workgroup names
        UserNameManager.addUserNameProvider(workgroupManager.getAddress().toString(),
            new UserNameProvider() {
                public String getUserName(JID entity) {
                    try {
                        Workgroup workgroup = workgroupManager.getWorkgroup(entity);
                        return workgroup.getDisplayName();
                    }
                    catch (UserNotFoundException e) {
                        return entity.toString();
                    }
                }
View Full Code Here

     * @param workgroupJID - the JID of the workgroup to setup.
     */
    private void createBotSettings(JID workgroupJID) {
        try {
            // Enable the workgroup chatbot by default
            Workgroup workgroup = WorkgroupManager.getInstance().getWorkgroup(workgroupJID);
            workgroup.chatbotEnabled(true);
            for (KeyEnum key : botMap.keySet()) {
                String value = botMap.get(key);
                createChatSetting(workgroupJID, key, ChatSettings.SettingType.bot_settings, value);
            }
        }
View Full Code Here

     * 2) the maximum of chats has not been reached for the agent
     * 3) the agent has not rejected the offer before
     * 4) the agent does not have to answer a previuos offer
     */
    public boolean validateAgent(AgentSession session, Offer offer) {
        Workgroup workgroup = offer.getRequest().getWorkgroup();
        return session != null && session.isAvailableToChat() &&
                session.getCurrentChats(workgroup) < session.getMaxChats(workgroup) && !offer.isRejector(session) &&
                !session.isWaitingOfferAnswer();
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.xmpp.workgroup.Workgroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.