01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.datatypes;
11:
12: import java.util.*;
13: import org.mmbase.bridge.*;
14: import org.mmbase.util.*;
15:
16: /**
17: * A StringDataType with all security contexts strings as possible value.
18: *
19: * @author Michiel Meeuwissen
20: * @version $Id: SecurityContextDataType.java,v 1.6 2006/10/14 14:35:39 nklasens Exp $
21: * @since MMBase-1.8
22: */
23: public class SecurityContextDataType extends StringDataType {
24:
25: private static final long serialVersionUID = 1L; // increase this if object serialization changes (which we shouldn't do!)
26:
27: /**
28: * Constructor for string data type.
29: * @param name the name of the data type
30: */
31: public SecurityContextDataType(String name) {
32: super (name);
33: }
34:
35: public Iterator getEnumerationValues(final Locale locale,
36: final Cloud cloud, final Node node, final Field field) {
37: if (node == null && cloud == null)
38: return null; // we don't know..
39: return new Iterator() {
40: StringList list = node == null ? cloud
41: .getPossibleContexts() : node.getPossibleContexts();
42: StringIterator iterator = list.stringIterator();
43:
44: public boolean hasNext() {
45: return iterator.hasNext();
46: }
47:
48: public Object next() {
49: String val = iterator.nextString();
50: return new Entry(val, val);
51: }
52:
53: public void remove() {
54: throw new UnsupportedOperationException();
55: }
56: };
57: }
58: /*
59: public LocalizedEntryListFactory getEnumerationFactory() {
60: throw new UnsupportedOperationException();
61: }
62: */
63:
64: }
|