KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > datatypes > SecurityContextDataType


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.datatypes;
11
12 import java.util.*;
13 import org.mmbase.bridge.*;
14 import org.mmbase.util.*;
15 import org.mmbase.util.logging.*;
16
17 /**
18  * A StringDataType with all security contexts strings as possible value.
19  *
20  * @author Michiel Meeuwissen
21  * @version $Id: SecurityContextDataType.java,v 1.4.2.1 2006/09/07 12:46:22 pierre Exp $
22  * @since MMBase-1.8
23  */

24 public class SecurityContextDataType extends StringDataType {
25
26     private static final long serialVersionUID = 1L; // increase this if object serialization changes (which we shouldn't do!)
27

28     /**
29      * Constructor for string data type.
30      * @param name the name of the data type
31      */

32     public SecurityContextDataType(String JavaDoc name) {
33         super(name);
34     }
35
36     public Iterator getEnumerationValues(final Locale locale, final Cloud cloud, final Node node, final Field field) {
37         if (node == null && cloud == null) return null; // we don't know..
38
return new Iterator() {
39             StringList list = node == null ? cloud.getPossibleContexts() : node.getPossibleContexts();
40             StringIterator iterator = list.stringIterator();
41             public boolean hasNext() {
42                 return iterator.hasNext();
43             }
44             public Object JavaDoc next() {
45                 String JavaDoc val = iterator.nextString();
46                 return new Entry(val, val);
47             }
48             public void remove() {
49                 throw new UnsupportedOperationException JavaDoc();
50             }
51         };
52     }
53     /*
54     public LocalizedEntryListFactory getEnumerationFactory() {
55         throw new UnsupportedOperationException();
56     }
57     */

58
59 }
60
Popular Tags