KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > editors > directedit > CmsDirectEditPermissions


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/editors/directedit/CmsDirectEditPermissions.java,v $
3  * Date : $Date: 2006/10/26 12:25:34 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2002 - 2005 Alkacon Software (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.editors.directedit;
33
34 /**
35  * Constants to indicate the direct edit permissions of a user for a VFS resource,
36  * used to describe if and how to show the direct edit buttons for the resource.<p>
37  *
38  * @author Alexander Kandzior
39  *
40  * @version $Revision: 1.2 $
41  *
42  * @since 6.2.3
43  */

44 public final class CmsDirectEditPermissions {
45
46     /**
47      * Describes the "disabled" permission.<p>
48      *
49      * User has general permissions to direct edit a resource, but this is currently not possible
50      * because for example another user has locked the resource.<p>
51      *
52      * Direct edit buttons are displayed, but "grayed out".
53      */

54     public static final CmsDirectEditPermissions DISABLED = new CmsDirectEditPermissions(1);
55
56     /**
57      * Describes the "enabled" permission.<p>
58      *
59      * User has permissions to direct edit a resource, the resource is also available for direct edit.<p>
60      *
61      * Direct edit buttons are displayed and active.
62      */

63     public static final CmsDirectEditPermissions ENABLED = new CmsDirectEditPermissions(2);
64
65     /**
66      * Describes the "inactive" permission.<p>
67      *
68      * User has no permissions to direct edit a resource.
69      * This may be because of write permissions, or because the resource is not part of the current
70      * project, or for other reasons.<p>
71      *
72      * Direct edit buttons are not displayed at all.
73      */

74     public static final CmsDirectEditPermissions INACTIVE = new CmsDirectEditPermissions(0);
75
76     /** String constant for {@link #DISABLED}. */
77     public static final String JavaDoc VALUE_DISABLED = "disabled";
78
79     /** String constant for {@link #ENABLED}. */
80     public static final String JavaDoc VALUE_ENABLED = "enabled";
81
82     /** String constant for {@link #INACTIVE}. */
83     public static final String JavaDoc VALUE_INACTIVE = "inactive";
84
85     /** The direct edit permission value. */
86     int m_permission;
87
88     /**
89      * Hides the public constructor.<p>
90      *
91      * @param value the direct edit mode
92      */

93     private CmsDirectEditPermissions(int value) {
94
95         m_permission = value;
96     }
97
98     /**
99      * Returns the direct edit permission int value.<p>
100      *
101      * The possible value are:
102      * <ul>
103      * <li>0: Permission is {@link #INACTIVE}.
104      * <li>1: Permission is {@link #DISABLED}.
105      * <li>2: Permission is {@link #ENABLED}.
106      * </ul>
107      *
108      * @return the direct edit permission int value
109      */

110     public int getPermission() {
111
112         return m_permission;
113     }
114
115     /**
116      * @see java.lang.Object#toString()
117      */

118     public String JavaDoc toString() {
119
120         String JavaDoc result;
121         switch (m_permission) {
122             case 1:
123                 result = VALUE_DISABLED;
124                 break;
125             case 2:
126                 result = VALUE_ENABLED;
127                 break;
128             default:
129                 result = VALUE_INACTIVE;
130         }
131         return result;
132     }
133 }
Popular Tags