2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.persistence
.hibernate
.permission
;
11 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
17 public enum CdmPermissionClass
{
18 USER
, DESCRIPTIONBASE
, DESCRIPTIONELEMENTBASE
, TAXONBASE
, ALL
, TAXONNODE
, CLASSIFICATION
;
22 * return the appropriate CdmPermissionClass for the given Object. May return null if no matching CdmPermissionClass was found.
24 * @return the CdmPermissionClass or null
26 public static CdmPermissionClass
getValueOf(Object s
){
28 String permissionClassString
;
29 if (s
instanceof String
){
30 permissionClassString
= (String
)s
;
31 }else if (s
instanceof CdmBase
){
32 permissionClassString
= s
.getClass().getSimpleName().toUpperCase();
33 } else if(s
instanceof Class
){
34 permissionClassString
= ((Class
) s
).getSimpleName().toUpperCase();
41 return CdmPermissionClass
.valueOf(permissionClassString
);
42 }catch(IllegalArgumentException e
){
43 if (s
instanceof CdmBase
){
44 s
= s
.getClass().getSuperclass();