Package metrics4Asterisk.display

Source Code of metrics4Asterisk.display.AgentSummary

package metrics4Asterisk.display;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import metrics4Asterisk.metrics.AgentMetric;
import metrics4Asterisk.metrics.CallMetric;

/**
*
* This class can be used to merge call data from the callMap field into the agentMap's objects.
* The result is AgentMetric objects that have call and queue login data. This is needed to compute
* things metrics like calls per hour.
* @author Lance Stine
*/
public class AgentSummary {
   
    /**
     * A map with an Asterisk extension as the key and an AgentMetric object as the data.
     */
    private Map<String, Object> agentMap;
   
    /**
     * This method will merge the call metrics from the callMap into the AgentMetric objects
     * in the agentMap field. The result will be the agentMap will contain complete information.
     * <br />
     * Note: if the callMap and agentMap are of in terms of date range or data then the agentMap will contain
     * new AgentMetric objects that will possibly have no login or call data.
     * @param callMap a map of parsed call data
     */
    public void makeSummary(final Map<String, Object> callMap) {
        //get rid of all of this
        //maybe put in something like average agents metircs
        Set<String> keys = callMap.keySet();
        Iterator<String> iter = keys.iterator();
        while(iter.hasNext()) {
            String key = iter.next();
            CallMetric callMetric = (CallMetric) callMap.get(key);
            AgentMetric agentMetric = (AgentMetric) getLoginMap().get(callMetric.getExtension());
            if (agentMetric != null) {           
                agentMetric.addToCallCount();
                agentMetric.addToWaitTime(callMetric.getWaitTime());
                agentMetric.addToTalkTime(callMetric.getTalkTime());               
            }
        }
    }

    public Map<String, Object> getLoginMap() {
        return agentMap;
    }

    public void setLoginMap(Map<String, Object> loginMap) {
        this.agentMap = loginMap;
    }
}
TOP

Related Classes of metrics4Asterisk.display.AgentSummary

TOP
Copyright © 2018 www.massapi.com. 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.