001: /*
002: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005: package com.sun.portal.ubt.report.data.file.raw;
006:
007: import com.sun.portal.ubt.report.data.MinerCollection;
008: import com.sun.portal.ubt.report.data.UBTLogConstants;
009: import com.sun.portal.ubt.report.data.UBTLogLine;
010:
011: import java.util.TreeMap;
012: import java.util.TreeSet;
013:
014: /**
015: * Content/layout/theme
016: */
017: public class ContainerWiseUserActionsMiner extends DataMinerAdapter {
018: public static String INTENTIONS = "Intentions";
019: public static String SUCCESSFUL = "Successful";
020: private TreeMap portalCustomization = new TreeMap();
021: private TreeMap portalCustomizationIntentions = new TreeMap(); //Map(container, map(user, TreeSet(timestamp)))
022: private TreeMap portalCustomizationSuccessful = new TreeMap(); //Map(container, map(user, TreeSet(timestamp)))
023:
024: public void setMinerCollection(MinerCollection collection) {
025: }
026:
027: public void mine(UBTLogLine logLine) throws Exception {
028: if (!UBTLogConstants.MODE_EDIT.equals(logLine.getMode())
029: || logLine.getChannelName() != null
030: || logLine.getEventID() == null
031: || !(UBTLogConstants.EVENT_USER_CLICK_CHN
032: .equals(logLine.getEventID()) || UBTLogConstants.EVENT_PROCESS_EDIT
033: .equals(logLine.getEventID())))
034: return;
035: String container = logLine.getTargetProvider();
036: if (container == null)
037: return;
038: String action = logLine.getAction();
039: String user = logLine.getUserID();
040: String timestamp = logLine.getTimestamp();
041: if (UBTLogConstants.ACTION_EDIT.equals(action)) {
042: //Intentions
043: if (portalCustomizationIntentions.containsKey(container)) {
044: TreeMap containerMap = (TreeMap) portalCustomizationIntentions
045: .get(container);
046: if (containerMap.containsKey(user)) {
047: TreeSet userTimestamps = (TreeSet) containerMap
048: .get(user);
049: userTimestamps.add(timestamp);
050: } else {
051: TreeSet useTimestamps = new TreeSet();
052: useTimestamps.add(timestamp);
053: containerMap.put(user, useTimestamps);
054: }
055: } else {
056: TreeMap containerMap = new TreeMap();
057: TreeSet useTimestamps = new TreeSet();
058: useTimestamps.add(timestamp);
059: containerMap.put(user, useTimestamps);
060: portalCustomizationIntentions.put(container,
061: containerMap);
062: }
063: } else if (UBTLogConstants.ACTION_PROCESS.equals(action)) {
064: //successful
065: if (portalCustomizationSuccessful.containsKey(container)) {
066: TreeMap containerMap = (TreeMap) portalCustomizationSuccessful
067: .get(container);
068: if (containerMap.containsKey(user)) {
069: TreeSet userTimestamps = (TreeSet) containerMap
070: .get(user);
071: userTimestamps.add(timestamp);
072: } else {
073: TreeSet useTimestamps = new TreeSet();
074: useTimestamps.add(timestamp);
075: containerMap.put(user, useTimestamps);
076: }
077: } else {
078: TreeMap containerMap = new TreeMap();
079: TreeSet useTimestamps = new TreeSet();
080: useTimestamps.add(timestamp);
081: containerMap.put(user, useTimestamps);
082: portalCustomizationSuccessful.put(container,
083: containerMap);
084: }
085: }
086: }
087:
088: public Object getData() {
089: portalCustomization.put(INTENTIONS,
090: portalCustomizationIntentions);
091: portalCustomization.put(SUCCESSFUL,
092: portalCustomizationSuccessful);
093: return portalCustomization;
094: }
095:
096: public void setData(Object data) {
097: portalCustomization = (TreeMap) data;
098: this .portalCustomizationIntentions = (TreeMap) portalCustomization
099: .get(INTENTIONS);
100: this .portalCustomizationSuccessful = (TreeMap) portalCustomization
101: .get(SUCCESSFUL);
102: }
103: }
|