Package org.jivesoftware.xmpp.workgroup

Examples of org.jivesoftware.xmpp.workgroup.Workgroup


     * @param startDate the time to begin the search from.
     * @param endDate the time to end the search.
     * @return the total number of requests
     */
    public static int getNumberOfRequestsCancelledByUser(String workgroupName, Date startDate, Date endDate) {
        Workgroup workgroup = null;
        try {
            workgroup = WorkgroupManager.getInstance().getWorkgroup(new JID(workgroupName));
        }
        catch (Exception ex) {
            Log.error(ex.getMessage(), ex);
        }
        if (workgroup == null) {
            return 0;
        }

        int count = 0;
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(WORKGROUP_STATE_REQUEST_COUNT);
            pstmt.setLong(1, workgroup.getID());
            // Set the state the cancelled requests.
            pstmt.setInt(2, 0);
            pstmt.setString(3, StringUtils.dateToMillis(startDate));
            pstmt.setString(4, StringUtils.dateToMillis(endDate));

View Full Code Here


     * @param startDate the time to begin the search from.
     * @param endDate the time to end the search.
     * @return the total number of requests
     */
    public static int getNumberOfRequestsNeverPickedUp(String workgroupName, Date startDate, Date endDate) {
        Workgroup workgroup = null;
        try {
            workgroup = WorkgroupManager.getInstance().getWorkgroup(new JID(workgroupName));
        }
        catch (Exception ex) {
            Log.error(ex.getMessage(), ex);
        }
        if (workgroup == null) {
            return 0;
        }

        int count = 0;
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(WORKGROUP_STATE_REQUEST_COUNT);
            pstmt.setLong(1, workgroup.getID());
            // Set the state the ignored requests.
            pstmt.setInt(2, 1);
            pstmt.setString(3, StringUtils.dateToMillis(startDate));
            pstmt.setString(4, StringUtils.dateToMillis(endDate));

View Full Code Here

     *
     * @param workgroupName the jid of the workgroup.
     * @return the total number of chats that have occured within a workgroup.
     */
    public static int getNumberOfChatsForWorkgroup(String workgroupName) {
        Workgroup workgroup = null;

        try {
            workgroup = WorkgroupManager.getInstance().getWorkgroup(new JID(workgroupName));
        }
        catch (Exception ex) {
            Log.error(ex.getMessage(), ex);
        }

        int count = 0;
        for (RequestQueue requestQueue : workgroup.getRequestQueues()){
            count += requestQueue.getTotalChatCount();
        }

        return count;
    }
View Full Code Here

     * @param startDate the time to begin the search from.
     * @param endDate the time to end the search.
     * @return the total number of requests
     */
    public static long getTotalWaitTimeForWorkgroup(String workgroupName, Date startDate, Date endDate) {
        Workgroup workgroup = null;
        try {
            workgroup = WorkgroupManager.getInstance().getWorkgroup(new JID(workgroupName));
        }
        catch (Exception ex) {
            Log.error(ex.getMessage(), ex);
        }
        if (workgroup == null) {
            return 0;
        }

        int waitTime = 0;
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(WORKGROUP_WAIT_TIME);
            pstmt.setLong(1, workgroup.getID());
            // Set the state the ignored requests.
            pstmt.setInt(2, 1);
            pstmt.setString(2, StringUtils.dateToMillis(startDate));
            pstmt.setString(3, StringUtils.dateToMillis(endDate));

View Full Code Here

     * Returns a <code>Workgroup</code> based on it's full jid.
     * @param workgroupJID the full jid of the workgroup (ex. demo@workgroup.jivesoftware.com)
     * @return the Workgroup
     */
    public static  Workgroup getWorkgroup(String workgroupJID) {
        Workgroup workgroup = null;
        try {
            workgroup = WorkgroupManager.getInstance().getWorkgroup(new JID(workgroupJID));
        }
        catch (UserNotFoundException e) {
            Log.error("Error retrieving Workgroup", e);
View Full Code Here

        }
        else {
            // Check if the disco#info was sent to a given workgroup
            try {
                Workgroup workgroup = workgroupManager.getWorkgroup(packet.getTo());
                Element iq = packet.getChildElement();
                reply.setChildElement(iq.createCopy());
                Element queryElement = reply.getChildElement();

                // Create and add a the identity of the workgroup service
                Element identity = queryElement.addElement("identity");
                identity.addAttribute("category", "collaboration");
                identity.addAttribute("name", workgroup.getJID().getNode());
                identity.addAttribute("type", "workgroup");

                // Create and add a the disco#info feature
                Element feature = queryElement.addElement("feature");
                feature.addAttribute("var", "http://jabber.org/protocol/disco#info");

                Element form = queryElement.addElement("x", "jabber:x:data");
                form.addAttribute("type", "result");
                // Add static field
                Element field = form.addElement("field");
                field.addAttribute("var", "FORM_TYPE");
                field.addAttribute("type", "hidden");
                field.addElement("value").setText("http://jabber.org/protocol/workgroup#workgroupinfo");
                // Add workgroup description
                field = form.addElement("field");
                field.addAttribute("var", "workgroup#description");
                field.addAttribute("label", "Description");
                field.addElement("value").setText(workgroup.getDescription() == null ?
                        "" : workgroup.getDescription());
                // Add workgroup online status
                field = form.addElement("field");
                field.addAttribute("var", "workgroup#online");
                field.addAttribute("label", "Status");
                field.addElement("value").setText(workgroup.getStatus().name());
            }
            catch (UserNotFoundException e) {
                // If we didn't find a workgroup then answer a not found error
                reply.setChildElement(packet.getChildElement().createCopy());
                reply.setError(PacketError.Condition.item_not_found);
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.