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 subject types.
20: */
21: public enum AclSubjectType {
22: USER("user"), EVERYONE("everyone"), ROLE("role");
23:
24: private final String name;
25:
26: private AclSubjectType(String name) {
27: this .name = name;
28: }
29:
30: public String toString() {
31: return name;
32: }
33:
34: public static AclSubjectType fromString(String value) {
35: if (value.equals("user"))
36: return USER;
37: else if (value.equals("role"))
38: return ROLE;
39: else if (value.equals("everyone"))
40: return EVERYONE;
41: else
42: throw new RuntimeException("Unrecognized subject type: "
43: + value);
44: }
45: }
|