01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.ubt.report.data.file.raw;
06:
07: import com.sun.portal.ubt.report.data.MinerCollection;
08: import com.sun.portal.ubt.report.data.UBTLogConstants;
09: import com.sun.portal.ubt.report.data.UBTLogLine;
10:
11: import java.util.TreeMap;
12: import java.util.TreeSet;
13:
14: /**
15: *
16: */
17: public class PortletActionsMiner extends DataMinerAdapter {
18: protected TreeMap portletactions = new TreeMap(); //Map(portlet, map(user, TreeSet(timestamp)))[portlet -> entityID]
19:
20: public void setMinerCollection(MinerCollection collection) {
21: }
22:
23: public void mine(UBTLogLine logLine) throws Exception {
24: String portlet = logLine.getEntityID();
25: if (portlet == null)
26: return;
27: String event = logLine.getEventID();
28: String user = logLine.getUserID();
29: String timestamp = logLine.getTimestamp();
30: if (UBTLogConstants.EVENT_PORTLET_ACTION.equals(event)) {
31: //Intentions
32: if (portletactions.containsKey(portlet)) {
33: TreeMap portletMap = (TreeMap) portletactions
34: .get(portlet);
35: if (portletMap.containsKey(user)) {
36: TreeSet userTimestamps = (TreeSet) portletMap
37: .get(user);
38: userTimestamps.add(timestamp);
39: } else {
40: TreeSet useTimestamps = new TreeSet();
41: useTimestamps.add(timestamp);
42: portletMap.put(user, useTimestamps);
43: }
44: } else {
45: TreeMap portletMap = new TreeMap();
46: TreeSet useTimestamps = new TreeSet();
47: useTimestamps.add(timestamp);
48: portletMap.put(user, useTimestamps);
49: portletactions.put(portlet, portletMap);
50: }
51: }
52: }
53:
54: public Object getData() {
55: return portletactions;
56: }
57:
58: public void setData(Object data) {
59: portletactions = (TreeMap) data;
60: }
61: }
|