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:
13: /**
14: * Content/layout/theme
15: */
16: public class ContainerWiseActionsMiner extends DataMinerAdapter {
17: public static String INTENTIONS = "Intentions";
18: public static String SUCCESSFUL = "Successful";
19: private TreeMap portalCustomization = new TreeMap();
20: private TreeMap portalCustomizationIntentions = new TreeMap(); //Map(container, count)
21: private TreeMap portalCustomizationSuccessful = new TreeMap(); //Map(container, count)
22:
23: public void setMinerCollection(MinerCollection collection) {
24: }
25:
26: public void mine(UBTLogLine logLine) throws Exception {
27: if (!UBTLogConstants.MODE_EDIT.equals(logLine.getMode())
28: || logLine.getChannelName() != null
29: || logLine.getEventID() == null
30: || !(logLine.getEventID().equals(
31: UBTLogConstants.EVENT_USER_CLICK_CHN) || logLine
32: .getEventID().equals(
33: UBTLogConstants.EVENT_PROCESS_EDIT)))
34: return;
35: String container = logLine.getTargetProvider(); //targetProvider
36: if (container == null)
37: return;
38: String action = logLine.getAction();
39: if (UBTLogConstants.ACTION_EDIT.equals(action)) {
40: //Intentions
41: if (portalCustomizationIntentions.containsKey(container)) {
42: int count = ((Integer) portalCustomizationIntentions
43: .get(container)).intValue();
44: portalCustomizationIntentions.put(container,
45: new Integer(count + 1));
46: } else {
47: portalCustomizationIntentions.put(container,
48: new Integer(1));
49: }
50: } else if (UBTLogConstants.ACTION_PROCESS.equals(action)) {
51: //successful
52: if (portalCustomizationSuccessful.containsKey(container)) {
53: int count = ((Integer) portalCustomizationSuccessful
54: .get(container)).intValue();
55: portalCustomizationSuccessful.put(container,
56: new Integer(count + 1));
57: } else {
58: portalCustomizationSuccessful.put(container,
59: new Integer(1));
60: }
61: }
62: }
63:
64: public Object getData() {
65: portalCustomization.put(INTENTIONS,
66: portalCustomizationIntentions);
67: portalCustomization.put(SUCCESSFUL,
68: portalCustomizationSuccessful);
69: return portalCustomization;
70: }
71:
72: public void setData(Object data) {
73: portalCustomization = (TreeMap) data;
74: this .portalCustomizationIntentions = (TreeMap) this .portalCustomization
75: .get(INTENTIONS);
76: this .portalCustomizationSuccessful = (TreeMap) this.portalCustomization
77: .get(SUCCESSFUL);
78: }
79: }
|