01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.search.rdm;
07:
08: import com.sun.portal.search.util.*;
09:
10: import java.util.*;
11:
12: /**
13: * RDM View Attributes
14: *
15: * The View Attributes is a simple list of SOIF Attributes (all lowercase)
16: * separated by commas. Use _Parse() to load a new object.
17: *
18: * Example:
19: * RDMViewAttr *vap = RDMViewAttr_Parse("scope,title,description,url");
20: */
21: public class RDMViewAttributes extends HashSet {
22:
23: public RDMViewAttributes(String str) {
24: if (str != null) {
25: StringTokenizer st = new StringTokenizer(str, ", ");
26: while (st.hasMoreTokens())
27: add(st.nextToken().toLowerCase()); // XXX i18n (locale...)
28: }
29: }
30:
31: public RDMViewAttributes() {
32: }
33:
34: public String[] toStringArray() {
35: Object[] o = toArray();
36: String[] res = new String[o.length];
37: for (int i = 0; i < o.length; ++i)
38: res[i] = (String) o[i];
39: return res;
40: }
41:
42: public String toString() {
43: StringBuffer sb = new StringBuffer();
44: for (Iterator i = iterator(); i.hasNext();) {
45: sb.append((String) i.next());
46: if (i.hasNext())
47: sb.append(",");
48: }
49: return sb.toString();
50: }
51:
52: }
|