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.derived;
06:
07: import com.sun.portal.ubt.report.data.DataMiner;
08: import com.sun.portal.ubt.report.data.file.raw.UserIdentityMiner;
09: import com.sun.portal.ubt.report.data.file.aggregate.UserIdentityMinerAggregator;
10: import com.sun.portal.ubt.report.view.IllegalMinerException;
11:
12: import java.util.Iterator;
13: import java.util.TreeMap;
14:
15: public class UserIdentityDataSource extends UBTTableDataSource {
16:
17: public UserIdentityDataSource(DataMiner miner)
18: throws IllegalMinerException {
19: super (miner);
20: columnNames = new String[] { "Server", "Domain", "RDN", "UID",
21: "LastAccess" };
22: if (!(miner instanceof UserIdentityMiner || miner instanceof UserIdentityMinerAggregator))
23: throw new IllegalMinerException();
24: Object data = miner.getData();
25: if (data instanceof TreeMap) {
26: this .data = toDoubleArray((TreeMap) data);
27: }
28: }
29:
30: private Object[][] toDoubleArray(TreeMap treeMap) {
31: Object[][] data = null;
32: if (treeMap != null) {
33: //data = new Object[treeMap.size()][((Object[])treeMap.get(treeMap.firstKey())).length+1] ;
34: data = new Object[treeMap.keySet().size()][5];
35: Iterator it = treeMap.keySet().iterator();
36: int i = 0;
37: /*while(it.hasNext()){
38: Object obj = it.next();
39: Object[] objArray = (Object[])treeMap.get(obj);
40: System.out.println(objArray.length);
41: data[i][0]= objArray[0];
42: data[i][1]= objArray[1];
43: data[i][2]= objArray[2];
44: data[i][4]=obj;
45: data[i][3]= objArray[3];
46: i++;
47: }*/
48: while (it.hasNext()) {
49: Object[] obj = (Object[]) it.next();
50: data[i][0] = obj[0];
51: data[i][1] = obj[1];
52: data[i][2] = obj[2];
53: data[i][3] = obj[3];
54: data[i][4] = treeMap.get(obj);
55: i++;
56: }
57: }
58: return data;
59: }
60:
61: }
|