01: package com.sun.portal.ubt.report.data.file.aggregate;
02:
03: import com.sun.portal.ubt.report.data.file.raw.PortletActionsMiner;
04:
05: import java.util.TreeMap;
06: import java.util.Iterator;
07: import java.util.TreeSet;
08:
09: /**
10: *
11: */
12: public class PortletActionsMinerAggregator extends
13: DataMinerAggregatorAdapter {
14: protected TreeMap portletactionsAggregate = new TreeMap(); //Map(portlet, map(user, TreeSet(timestamp)))[portlet -> entityID]
15:
16: public PortletActionsMinerAggregator() {
17: this .minerClassName = PortletActionsMiner.class.getName();
18: }
19:
20: protected void add(Object o) {
21: TreeMap minerData = (TreeMap) o;
22: Iterator portletIt = minerData.keySet().iterator();
23: while (portletIt.hasNext()) {
24: Object portlet = portletIt.next();
25: if (portletactionsAggregate.containsKey(portlet)) {
26: //elaborate
27: TreeMap portletMap = (TreeMap) minerData.get(portlet);
28: TreeMap aggregatePortletMap = (TreeMap) portletactionsAggregate
29: .get(portlet);
30: Iterator userIt = portletMap.keySet().iterator();
31: while (userIt.hasNext()) {
32: Object user = userIt.next();
33: if (aggregatePortletMap.containsKey(user)) {
34: //elaborate
35: ((TreeSet) aggregatePortletMap.get(user))
36: .addAll((TreeSet) portletMap.get(user));
37: } else {
38: aggregatePortletMap.put(user, portletMap
39: .get(user));
40: }
41: }
42: } else {
43: portletactionsAggregate.put(portlet, minerData
44: .get(portlet));
45: }
46: }
47:
48: }
49:
50: public Object getData() {
51: return portletactionsAggregate;
52: }
53:
54: public void setData(Object data) {
55: portletactionsAggregate = (TreeMap) data;
56: }
57: }
|