01: /*
02: * Copyright 2008 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.repository.acl;
17:
18: /**
19: * Enumeration of the permissions that can be set
20: * in {@link AccessDetails}.
21: */
22: public enum AclDetailPermission {
23: /** Can data from versions other than the live one be read? */
24: NON_LIVE("non_live"), ALL_FIELDS("all_fields"), ALL_PARTS(
25: "all_parts"),
26: /** Can the fulltext index be read? */
27: FULLTEXT_INDEX("fulltext"),
28: /** If fulltext index can be read, may fulltext context fragments be retrieved? */
29: FULLTEXT_FRAGMENTS("ft_fragments"),
30: /** Can the document summary be read? */
31: SUMMARY("summary");
32:
33: private String name;
34:
35: private AclDetailPermission(String name) {
36: this .name = name;
37: }
38:
39: public String toString() {
40: return name;
41: }
42:
43: public static AclDetailPermission fromString(String name) {
44: if (name.equals(NON_LIVE.name))
45: return NON_LIVE;
46: else if (name.equals(ALL_FIELDS.name))
47: return ALL_FIELDS;
48: else if (name.equals(ALL_PARTS.name))
49: return ALL_PARTS;
50: else if (name.equals(FULLTEXT_INDEX.name))
51: return FULLTEXT_INDEX;
52: else if (name.equals(FULLTEXT_FRAGMENTS.name))
53: return FULLTEXT_FRAGMENTS;
54: else if (name.equals(SUMMARY.name))
55: return SUMMARY;
56: else
57: throw new RuntimeException(
58: "Unrecognized ACL read details permission: " + name);
59: }
60: }
|