01: /*
02: * Copyright 2004 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 different actions an {@link AclEntry} can specify for a certain
20: * {@link AclPermission}.
21: *
22: */
23: public enum AclActionType {
24: GRANT("grant", true), DENY("deny", false), DO_NOTHING("nothing",
25: false);
26:
27: private final String name;
28: private final boolean supportsAccessDetails;
29:
30: private AclActionType(String name, boolean supportsAccessDetails) {
31: this .name = name;
32: this .supportsAccessDetails = supportsAccessDetails;
33: }
34:
35: /**
36: * Indicates whether this action type supports {@link AccessDetails}.
37: */
38: public boolean supportsAccessDetails() {
39: return supportsAccessDetails;
40: }
41:
42: public String toString() {
43: return name;
44: }
45:
46: public static AclActionType fromString(String value) {
47: if (value.equals("grant"))
48: return GRANT;
49: else if (value.equals("deny"))
50: return DENY;
51: else if (value.equals("nothing"))
52: return DO_NOTHING;
53: else
54: throw new RuntimeException("Unrecognized action type: "
55: + value);
56: }
57:
58: }
|