Source Code Cross Referenced for AdminGroup.java in  » Authentication-Authorization » ejbca » org » ejbca » core » model » authorization » 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 » Authentication Authorization » ejbca » org.ejbca.core.model.authorization 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*************************************************************************
002:         *                                                                       *
003:         *  EJBCA: The OpenSource Certificate Authority                          *
004:         *                                                                       *
005:         *  This software is free software; you can redistribute it and/or       *
006:         *  modify it under the terms of the GNU Lesser General Public           *
007:         *  License as published by the Free Software Foundation; either         *
008:         *  version 2.1 of the License, or any later version.                    *
009:         *                                                                       *
010:         *  See terms of license at gnu.org.                                     *
011:         *                                                                       *
012:         *************************************************************************/package org.ejbca.core.model.authorization;
013:
014:        import java.util.ArrayList;
015:        import java.util.Collections;
016:        import java.util.Collection;
017:        import java.util.Iterator;
018:        import java.io.Serializable;
019:
020:        /**
021:         * A class that represents a group of users and their access rules.
022:         *
023:         * @version $Id: AdminGroup.java,v 1.1 2006/01/17 20:30:56 anatom Exp $
024:         */
025:        public class AdminGroup implements  Serializable, Comparable {
026:
027:            /** Creates a new instance of AdminGroup */
028:            public AdminGroup(String admingroupname, int caid) {
029:                this .admingroupname = admingroupname;
030:                this .caid = caid;
031:                accessrules = new ArrayList();
032:                adminentities = new ArrayList();
033:            }
034:
035:            public AdminGroup(int admingroupid, String admingroupname,
036:                    int caid, ArrayList accessrules, ArrayList adminentities) {
037:                this .admingroupid = admingroupid;
038:                this .admingroupname = admingroupname;
039:                this .caid = caid;
040:                this .accessrules = accessrules;
041:                this .adminentities = adminentities;
042:            }
043:
044:            // Public methods
045:            /** Returns the number of accessrules applied to this admingroup */
046:            public int getNumberOfAccessRules() {
047:                return accessrules.size();
048:            }
049:
050:            /** Returns a ArrayList of AccessRule containing all the admingroup's accessrules.*/
051:            public Collection getAccessRules() {
052:                return accessrules;
053:            }
054:
055:            /** Returns the number of admin entities in this admingroup */
056:            public int getNumberAdminEntities() {
057:                return adminentities.size();
058:            }
059:
060:            /** Returns an ArrayList of AdminEntity containing all the admingroup's admin entities.*/
061:            public Collection getAdminEntities() {
062:                return adminentities;
063:            }
064:
065:            public int getCAId() {
066:                return this .caid;
067:            }
068:
069:            public int getAdminGroupId() {
070:                return this .admingroupid;
071:            }
072:
073:            public String getAdminGroupName() {
074:                return this .admingroupname;
075:            }
076:
077:            /** Method that given an array of available access rules returns which isn't already
078:             * in use by the rule set. */
079:            public Collection nonUsedAccessRules(Collection availableaccessrules) {
080:                ArrayList nonusedaccessrules = new ArrayList();
081:                int result;
082:                Collections.sort(accessrules);
083:                if (availableaccessrules != null) {
084:                    Iterator iter = availableaccessrules.iterator();
085:                    while (iter.hasNext()) {
086:                        String availableaccessrule = (String) iter.next();
087:                        result = java.util.Collections.binarySearch(
088:                                accessrules, new AccessRule(
089:                                        availableaccessrule, 0, false));
090:                        if (result < 0) {
091:                            // Access rule isn't in use.
092:                            nonusedaccessrules.add(availableaccessrule);
093:                        }
094:                    }
095:                }
096:                return nonusedaccessrules;
097:            }
098:
099:            public int compareTo(Object o) {
100:                if (caid != ((AdminGroup) o).getCAId())
101:                    return caid - ((AdminGroup) o).getCAId();
102:                return admingroupname.compareTo(((AdminGroup) o)
103:                        .getAdminGroupName());
104:            }
105:
106:            // Private methods
107:
108:            // Private fields
109:            private int admingroupid;
110:            private String admingroupname;
111:            private int caid;
112:            private ArrayList accessrules;
113:            private ArrayList adminentities;
114:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.