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;
06:
07: import java.util.StringTokenizer;
08: import java.io.Serializable;
09:
10: public class UserID implements Comparable, Serializable {
11: String uid;
12: //String[] ou;
13: //int oucount;
14: //String[] o;
15: //int ocount;
16: String dc = "";
17: String user;
18: private String rdn = "";
19:
20: public UserID(String user) {
21: this .user = user;
22: StringTokenizer st = new StringTokenizer(user, ",");
23: String temp = st.nextToken();
24: uid = temp.substring(temp.indexOf("=") + 1);
25:
26: try {
27: dc = user.substring(user.indexOf("dc="));
28: rdn = user.substring(user.indexOf(",") + 1, user
29: .indexOf(",dc"));
30: } catch (Exception e) {
31: //there is no DC & RDN
32: }
33: /*
34: StringTokenizer st = new StringTokenizer(user, ",");
35: Vector vou = new Vector();
36: Vector vo = new Vector();
37: while (st.hasMoreTokens()) {
38: String temp = st.nextToken();
39: if (temp.startsWith("uid")) {
40: uid = temp.substring(temp.indexOf("=") + 1);
41: } else if (temp.startsWith("ou")) {
42: vou.add(oucount,temp.substring(temp.indexOf("=") + 1));
43: oucount++;
44: } else if (temp.startsWith("o")) {
45: vo.add(ocount,temp.substring(temp.indexOf("=") + 1));
46: ocount++;
47: } else if (temp.startsWith("dc")) {
48: if (dc != "")
49: dc = dc + "," + temp;
50: else
51: dc = dc + temp;
52: }
53: }
54:
55: ou=DataConversion.toArray(vou);
56: o=DataConversion.toArray(vo);
57: */
58: }
59:
60: public String getUid() {
61: return uid;
62: }
63:
64: /*
65: public String[] getOu() {
66: return ou;
67: }
68:
69: public String[] getO() {
70: return o;
71: }
72: */
73: public String getRdn() {
74: return rdn;
75: }
76:
77: public String getDc() {
78: return dc;
79: }
80:
81: public int compareTo(Object o) {
82: if (o instanceof UserID && this .user.equals(((UserID) o).user)) {
83: return 0;
84: }
85: return -1;
86: }
87: }
|