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
.CdmBaseType
;
14 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
17 * see also {@link CdmBaseType}
20 * @author a.kohlbecker
23 public enum CdmPermissionClass
{
30 DESCRIPTIONELEMENTBASE
,
31 DESCRIPTIONELEMENTSOURCE
,
48 MEDIAREPRESENTATIONPART
,
53 NOMENCLATURALSTATUSTYPE
,
54 SPECIMENOROBSERVATIONBASE
,
55 SPECIMENTYPEDESIGNATION
,
71 * return the appropriate CdmPermissionClass for the given Object
74 * @return the CdmPermissionClass or null
76 public static CdmPermissionClass
getValueOf(CdmBase o
){
77 return CdmPermissionClass
.getValueOf(o
.getClass());
81 * return the appropriate CdmPermissionClass for the given Object
84 * @return the CdmPermissionClass or null
86 public static CdmPermissionClass
getValueOf(Class o
){
88 CdmPermissionClass permissionClass
= _valueOf(o
);
89 if(permissionClass
== null) {
90 Logger
.getLogger(CdmPermissionClass
.class).error("Permission class support for " + o
+ " not implemented");
92 return permissionClass
;
102 protected static CdmPermissionClass
_valueOf(Class o
) {
104 String normalizedName
= o
.getSimpleName().toUpperCase();
105 return CdmPermissionClass
.valueOf(normalizedName
);
106 } catch(IllegalArgumentException e
){
107 if (CdmBase
.class.isAssignableFrom(o
)){
108 return _valueOf(o
.getSuperclass());