This project has retired. For details please refer to its
Attic page.
Permission xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.inmemory.storedobj.impl;
2021import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumBasicPermissions;
222324public enum Permission {
25 NONE("none"),
26 READ("read"),
27 WRITE("write"),
28 ALL("all");
2930privatefinal String value;
3132Permission(String v) {
33 value = v;
34 }
3536public String value() {
37return value;
38 }
3940publicstaticPermission fromValue(String v) {
41for (Permission c : Permission.values()) {
42if (c.value.equals(v)) {
43return c;
44 }
45 }
46thrownew IllegalArgumentException(v);
47 }
4849publicstaticPermission fromCmisString(String strPerm) {
50Permission permission;
51if (strPerm.equals(EnumBasicPermissions.CMIS_READ.value()))
52 permission = Permission.READ;
53elseif (strPerm.equals(EnumBasicPermissions.CMIS_WRITE.value()))
54 permission = Permission.WRITE;
55elseif (strPerm.equals(EnumBasicPermissions.CMIS_ALL.value()))
56 permission = Permission.ALL;
57else58thrownew IllegalArgumentException("InMemory only supports CMIS basic permissions read, write, all.");
59return permission;
60 }
6162public String toCmisString() {
63if (this.equals(READ))
64return EnumBasicPermissions.CMIS_READ.value();
65elseif (this.equals(WRITE))
66return EnumBasicPermissions.CMIS_WRITE.value();
67elseif (this.equals(ALL))
68return EnumBasicPermissions.CMIS_ALL.value();
69else70return"";
71 }
72 }