Source Code Cross Referenced for UnqualifiedRoleAttribute.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » routetemplate » 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 » ERP CRM Financial » Kuali Financial System » edu.iu.uis.eden.routetemplate 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2006 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package edu.iu.uis.eden.routetemplate;
018:
019:        import java.util.ArrayList;
020:        import java.util.Collections;
021:        import java.util.List;
022:
023:        import edu.iu.uis.eden.engine.RouteContext;
024:        import edu.iu.uis.eden.exception.EdenUserNotFoundException;
025:        import edu.iu.uis.eden.routeheader.DocumentContent;
026:
027:        /**
028:         * A simple base RoleAttribute implementation for roles that do not need to be qualified
029:         * prior to resolution.
030:         * 
031:         * @author Aaron Hamid (arh14 at cornell dot edu)
032:         */
033:        public abstract class UnqualifiedRoleAttribute extends
034:                AbstractRoleAttribute {
035:
036:            protected List<Role> roles;
037:
038:            /**
039:             * No-arg constructor for subclasses that will override {@link #getRoleNames()} to provide their own roles list
040:             */
041:            public UnqualifiedRoleAttribute() {
042:                roles = Collections.emptyList();
043:            }
044:
045:            /**
046:             * Constructor for subclasses that can provide a role list at construction time
047:             */
048:            public UnqualifiedRoleAttribute(List<Role> roles) {
049:                this .roles = roles;
050:            }
051:
052:            public List<Role> getRoleNames() {
053:                return roles;
054:            }
055:
056:            /**
057:             * Returns a List<String> containing only the roleName parameter; i.e. no qualification occurs
058:             */
059:            public List<String> getQualifiedRoleNames(String roleName,
060:                    DocumentContent documentContent)
061:                    throws EdenUserNotFoundException {
062:                List<String> qualifiedRoleName = new ArrayList<String>(1);
063:                qualifiedRoleName.add(roleName);
064:                return qualifiedRoleName;
065:            }
066:
067:            /**
068:             * Helper method for parsing the actual role name out from the class/rolename combination
069:             * as Role class combines the two and does expose the original role name
070:             * @param classAndRole the class and role string (e.g. org.blah.MyRoleAttribute!SOME_ROLE_NAME)
071:             * @return the role name portion of the class and role string (e.g. SOME_ROLE_NAME);
072:             */
073:            protected String parseRoleNameFromClassAndRole(String classAndRole) {
074:                return classAndRole.substring(classAndRole.indexOf("!") + 1);
075:            }
076:
077:            public ResolvedQualifiedRole resolveQualifiedRole(
078:                    RouteContext routeContext, String roleName,
079:                    String qualifiedRole) throws EdenUserNotFoundException {
080:                // some sanity checking
081:                if (!roleName.equals(qualifiedRole)) {
082:                    throw new IllegalArgumentException(
083:                            "UnqualifiedRoleAttribute resolveQualifiedRole invoked with differing role and qualified role (they should be the same)");
084:                }
085:                // this attribute should never be called to resolve any roles other than those it advertised as supporting!
086:                boolean valid = false;
087:                for (Role role : getRoleNames()) {
088:                    if (parseRoleNameFromClassAndRole(role.getName()).equals(
089:                            roleName)) {
090:                        valid = true;
091:                        break;
092:                    }
093:                }
094:                if (!valid) {
095:                    throw new IllegalArgumentException(
096:                            "This attribute does not support the role: '"
097:                                    + roleName + "'");
098:                }
099:                return resolveRole(routeContext, roleName);
100:            }
101:
102:            /**
103:             * Template method for subclasses to implement
104:             * @param routeContext the RouteContext
105:             * @param roleName the role name
106:             * @return a ResolvedQualifiedRole
107:             */
108:            protected abstract ResolvedQualifiedRole resolveRole(
109:                    RouteContext routeContext, String roleName)
110:                    throws EdenUserNotFoundException;
111:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.