Source Code Cross Referenced for ACL.java in  » J2EE » fleXive » com » flexive » shared » security » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » fleXive » com.flexive.shared.security 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***************************************************************
002:         *  This file is part of the [fleXive](R) project.
003:         *
004:         *  Copyright (c) 1999-2008
005:         *  UCS - unique computing solutions gmbh (http://www.ucs.at)
006:         *  All rights reserved
007:         *
008:         *  The [fleXive](R) project is free software; you can redistribute
009:         *  it and/or modify it under the terms of the GNU General Public
010:         *  License as published by the Free Software Foundation;
011:         *  either version 2 of the License, or (at your option) any
012:         *  later version.
013:         *
014:         *  The GNU General Public License can be found at
015:         *  http://www.gnu.org/copyleft/gpl.html.
016:         *  A copy is found in the textfile GPL.txt and important notices to the
017:         *  license from the author are found in LICENSE.txt distributed with
018:         *  these libraries.
019:         *
020:         *  This library is distributed in the hope that it will be useful,
021:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
022:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023:         *  GNU General Public License for more details.
024:         *
025:         *  For further information about UCS - unique computing solutions gmbh,
026:         *  please see the company website: http://www.ucs.at
027:         *
028:         *  For further information about [fleXive](R), please see the
029:         *  project website: http://www.flexive.org
030:         *
031:         *
032:         *  This copyright notice MUST APPEAR in all copies of the file!
033:         ***************************************************************/package com.flexive.shared.security;
034:
035:        import com.flexive.shared.*;
036:        import com.flexive.shared.exceptions.FxNotFoundException;
037:        import com.flexive.shared.value.FxString;
038:
039:        import java.io.Serializable;
040:
041:        /**
042:         * Data class for the access control lists
043:         *
044:         * @author Gregor Schober (gregor.schober@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
045:         */
046:        public class ACL extends AbstractSelectableObjectWithName implements 
047:                Serializable, SelectableObjectWithLabel, ObjectWithColor {
048:            private static final long serialVersionUID = -8177665165523382984L;
049:
050:            /**
051:             * Max. id for internal ACL's (needed for internal checks)
052:             */
053:            public final static long MAX_INTERNAL_ID = 8;
054:
055:            /**
056:             * Contact Data ACL
057:             */
058:            public final static long ACL_CONTACTDATA = 8;
059:
060:            private String color;
061:            private long id;
062:            private long mandatorId;
063:            private Category category;
064:            private String description;
065:            private String name;
066:            private FxString label;
067:            private String mandator;
068:            private LifeCycleInfo lifeCycleInfo = null;
069:
070:            /**
071:             * ACL categories and their defaults
072:             */
073:            public enum Category implements  ObjectWithLabel {
074:                INSTANCE(1, 2), STRUCTURE(2, 7), WORKFLOW(3, 3), BRIEFCASE(4, 4), SELECTLIST(
075:                        5, 5), SELECTLISTITEM(6, 6);
076:
077:                private int id;
078:                private long defaultId;
079:
080:                Category(int id, long defaultId) {
081:                    this .id = id;
082:                    this .defaultId = defaultId;
083:                }
084:
085:                /**
086:                 * Getter for the internal id
087:                 *
088:                 * @return internal id
089:                 */
090:                public int getId() {
091:                    return id;
092:                }
093:
094:                /**
095:                 * Get the Id of the default ACL for given category
096:                 *
097:                 * @return Id of the default ACL for given category
098:                 */
099:                public long getDefaultId() {
100:                    return defaultId;
101:                }
102:
103:                /**
104:                 * Get a TypeMode by its id
105:                 *
106:                 * @param id the id
107:                 * @return TypeMode the type
108:                 */
109:                public static Category getById(int id) {
110:                    for (Category cat : Category.values())
111:                        if (cat.id == id)
112:                            return cat;
113:                    throw new FxNotFoundException(
114:                            "ex.acl.category.notFound.id", id)
115:                            .asRuntimeException();
116:                }
117:
118:                /**
119:                 * {@inheritDoc}
120:                 */
121:                public FxString getLabel() {
122:                    return FxSharedUtils.getEnumLabel(this );
123:                }
124:            }
125:
126:            /**
127:             * ACL permissions
128:             */
129:            public enum Permission implements  ObjectWithLabel {
130:                CREATE, READ, EDIT, DELETE, RELATE, EXPORT, NOT_CREATE, NOT_READ, NOT_EDIT, NOT_DELETE, NOT_RELATE, NOT_EXPORT;
131:
132:                /**
133:                 * Check if <code>check</code> is contained in perms
134:                 *
135:                 * @param check Perm to check
136:                 * @param perms array of Perm's
137:                 * @return if <code>check</code> is contained in perms
138:                 */
139:                public static boolean contains(Permission check,
140:                        Permission... perms) {
141:                    for (Permission perm : perms)
142:                        if (perm == check)
143:                            return true;
144:                    return false;
145:                }
146:
147:                /**
148:                 * {@inheritDoc}
149:                 */
150:                public FxString getLabel() {
151:                    return FxSharedUtils.getEnumLabel(this );
152:                }
153:            }
154:
155:            /**
156:             * Constructor
157:             */
158:            public ACL() {
159:                this .label = new FxString("");
160:            }
161:
162:            /**
163:             * Copy Constructor
164:             *
165:             * @param acl ACL to copy
166:             */
167:            public ACL(ACL acl) {
168:                this .color = acl.color;
169:                this .id = acl.id;
170:                this .mandatorId = acl.mandatorId;
171:                this .category = acl.category;
172:                this .description = acl.description;
173:                this .name = acl.name;
174:                this .label = acl.label.copy();
175:                this .mandator = acl.mandator;
176:                this .lifeCycleInfo = acl.lifeCycleInfo;
177:            }
178:
179:            /**
180:             * Constructor.
181:             *
182:             * @param id            the unique id
183:             * @param name          the name
184:             * @param label         display label
185:             * @param mandatorId    the id of the mandator the acl belongs to
186:             * @param mandator      the name of the mandator
187:             * @param description   the description
188:             * @param color         the color (RGB code or style class)
189:             * @param category      the category
190:             * @param lifeCycleInfo lifecycle information
191:             */
192:            public ACL(long id, String name, FxString label, long mandatorId,
193:                    String mandator, String description, String color,
194:                    Category category, LifeCycleInfo lifeCycleInfo) {
195:                this .color = color;
196:                this .id = id;
197:                this .mandatorId = mandatorId;
198:                this .category = category;
199:                this .description = description;
200:                this .name = name;
201:                this .label = label;
202:                this .mandator = mandator;
203:                this .lifeCycleInfo = lifeCycleInfo;
204:            }
205:
206:            /**
207:             * Returns the unique id of the ACL.
208:             *
209:             * @return the unique id of the ACL
210:             */
211:            public long getId() {
212:                return this .id;
213:            }
214:
215:            /**
216:             * Returns the unique name of the ACL.
217:             *
218:             * @return the unique name of the ACL.
219:             */
220:            public String getName() {
221:                return this .name;
222:            }
223:
224:            /**
225:             * Returns the description of the ACL.
226:             * The desciption is never null, but may be a empty String.
227:             *
228:             * @return the description of the ACL.
229:             */
230:            public String getDescription() {
231:                return this .description;
232:            }
233:
234:            /**
235:             * Returns the color of the ACL.
236:             * A empty String may be returned if the default color should be used.
237:             *
238:             * @return the color of the ACL
239:             */
240:            public String getColor() {
241:                return this .color;
242:            }
243:
244:            /**
245:             * Returns the category of the ACL.
246:             *
247:             * @return the category of the ACL
248:             */
249:            public Category getCategory() {
250:                return this .category;
251:            }
252:
253:            /**
254:             * Get lifecycle information
255:             *
256:             * @return lifecycle information
257:             */
258:            public LifeCycleInfo getLifeCycleInfo() {
259:                return lifeCycleInfo;
260:            }
261:
262:            /**
263:             * Returns the mandator the ACL belongs to.
264:             *
265:             * @return the mandator the ACL belongs to
266:             */
267:            public long getMandatorId() {
268:                return this .mandatorId;
269:            }
270:
271:            /**
272:             * Sets the unique name of the ACL.
273:             *
274:             * @param name the new name
275:             */
276:            public void setName(String name) {
277:                this .name = name;
278:            }
279:
280:            /**
281:             * Get the display label of this ACL
282:             *
283:             * @return display label
284:             */
285:            public FxString getLabel() {
286:                return label;
287:            }
288:
289:            /**
290:             * Set the display label of this ACL
291:             *
292:             * @param label display label
293:             */
294:            public void setLabel(FxString label) {
295:                this .label = label;
296:            }
297:
298:            /**
299:             * Sets the  the description of the ACL.
300:             *
301:             * @param desc the new description
302:             */
303:            public void setDescription(String desc) {
304:                this .description = desc;
305:            }
306:
307:            /**
308:             * Sets the color of the ACL.
309:             *
310:             * @param color the color of the ACL
311:             */
312:            public void setColor(String color) {
313:                this .color = color;
314:            }
315:
316:            /**
317:             * Returns the category of the ACL.
318:             *
319:             * @param cat the category of the ACL
320:             */
321:            public void setCategory(Category cat) {
322:                this .category = cat;
323:            }
324:
325:            /**
326:             * Returns the name of the mandator.
327:             *
328:             * @return the name of the mandator
329:             */
330:            public String getMandatorName() {
331:                return mandator;
332:            }
333:
334:            @Override
335:            public String toString() {
336:                return "ACL[id=" + id + ";name=" + name + ";mandator="
337:                        + mandator + ";label=" + label + ";category="
338:                        + category.name() + "]";
339:            }
340:
341:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.