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 org
.apache
.log4j
.Logger
;
13 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
16 * see also {@link CdmBaseType}
19 * @author a.kohlbecker
22 public enum CdmPermissionClass
{
25 DESCRIPTIONELEMENTBASE
,
34 SPECIMENOROBSERVATIONBASE
,
35 SPECIMENTYPEDESIGNATION
,
40 * return the appropriate CdmPermissionClass for the given Object
43 * @return the CdmPermissionClass or null
45 public static CdmPermissionClass
getValueOf(CdmBase o
){
46 return CdmPermissionClass
.getValueOf(o
.getClass());
50 * return the appropriate CdmPermissionClass for the given Object
53 * @return the CdmPermissionClass or null
55 public static CdmPermissionClass
getValueOf(Class o
){
57 CdmPermissionClass permissionClass
= _valueOf(o
);
58 if(permissionClass
== null) {
59 Logger
.getLogger(CdmPermissionClass
.class).error("Permission class support for " + o
+ " not implemented");
61 return permissionClass
;
71 protected static CdmPermissionClass
_valueOf(Class o
) {
73 String normalizedName
= o
.getSimpleName().toUpperCase();
74 return CdmPermissionClass
.valueOf(normalizedName
);
75 } catch(IllegalArgumentException e
){
76 if (CdmBase
.class.isAssignableFrom(o
)){
77 return _valueOf(o
.getSuperclass());