Source Code Cross Referenced for GroupsManagerCommand.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » channels » groupsmanager » commands » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.channels.groupsmanager.commands 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2001 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.channels.groupsmanager.commands;
007:
008:        import org.jasig.portal.ChannelStaticData;
009:        import org.jasig.portal.channels.groupsmanager.CGroupsManagerSessionData;
010:        import org.jasig.portal.channels.groupsmanager.GroupsManagerConstants;
011:        import org.jasig.portal.channels.groupsmanager.IGroupsManagerCommand;
012:        import org.jasig.portal.channels.groupsmanager.Utility;
013:        import org.jasig.portal.groups.IGroupMember;
014:        import org.jasig.portal.security.IAuthorizationPrincipal;
015:        import org.jasig.portal.security.IPermission;
016:        import org.jasig.portal.security.IUpdatingPermissionManager;
017:        import org.jasig.portal.services.AuthorizationService;
018:        import org.w3c.dom.Document;
019:        import org.w3c.dom.Element;
020:        import org.w3c.dom.NodeList;
021:
022:        /**
023:         * This class is the parent class of all other command classes.
024:         * @author Don Fracapane
025:         * @version $Revision: 35497 $
026:         */
027:        public abstract class GroupsManagerCommand implements 
028:                IGroupsManagerCommand, GroupsManagerConstants {
029:
030:            /**
031:             * GroupsManagerCommand is the parent of all Groups Manager commands. It
032:             * hold the commone functionality of all commands.
033:             */
034:            public GroupsManagerCommand() {
035:            }
036:
037:            /**
038:             * This is the public method
039:             * @param sessionData
040:             * @throws Exception
041:             */
042:            public void execute(CGroupsManagerSessionData sessionData)
043:                    throws Exception {
044:            }
045:
046:            /**
047:             * clear out the selection list
048:             * @param sessionData
049:             */
050:            protected void clearSelected(CGroupsManagerSessionData sessionData) {
051:                Element rootElem = getXmlDoc(sessionData).getDocumentElement();
052:                NodeList nGroupList = rootElem
053:                        .getElementsByTagName(GROUP_TAGNAME);
054:                NodeList nPersonList = rootElem
055:                        .getElementsByTagName(ENTITY_TAGNAME);
056:                NodeList nList = nGroupList;
057:                for (int i = 0; i < nList.getLength(); i++) {
058:                    Element elem = (org.w3c.dom.Element) nList.item(i);
059:                    elem.setAttribute("selected", "false");
060:                }
061:                nList = nPersonList;
062:                for (int i = 0; i < nList.getLength(); i++) {
063:                    Element elem = (org.w3c.dom.Element) nList.item(i);
064:                    elem.setAttribute("selected", "false");
065:                }
066:                return;
067:            }
068:
069:            /**
070:             * Removes all of the permissions for a GroupMember. We need to get permissions
071:             * for the group as a principal and as a target. I am merging the 2 arrays into a
072:             * single array in order to use the transaction management in the RDBMPermissionsImpl.
073:             * If an exception is generated, I do not delete the group or anything else.
074:             * Possible Exceptions: AuthorizationException and GroupsException
075:             * @param grpMbr
076:             * @throws Exception
077:             */
078:            protected void deletePermissions(IGroupMember grpMbr)
079:                    throws Exception {
080:                try {
081:                    String grpKey = grpMbr.getKey();
082:                    // first we retrieve all permissions for which the group is the principal
083:                    IAuthorizationPrincipal iap = AuthorizationService
084:                            .instance().newPrincipal(grpMbr);
085:                    IPermission[] perms1 = iap.getPermissions();
086:
087:                    // next we retrieve all permissions for which the group is the target
088:                    IUpdatingPermissionManager upm = AuthorizationService
089:                            .instance().newUpdatingPermissionManager(OWNER);
090:                    IPermission[] perms2 = upm.getPermissions(null, grpKey);
091:
092:                    // merge the permissions
093:                    IPermission[] allPerms = new IPermission[perms1.length
094:                            + perms2.length];
095:                    System.arraycopy(perms1, 0, allPerms, 0, perms1.length);
096:                    System.arraycopy(perms2, 0, allPerms, perms1.length,
097:                            perms2.length);
098:
099:                    upm.removePermissions(allPerms);
100:                } catch (Exception e) {
101:                    String errMsg = "DeleteGroup::deletePermissions(): Error removing permissions for "
102:                            + grpMbr;
103:                    Utility.logMessage("ERROR", errMsg, e);
104:                    throw new Exception(errMsg);
105:                }
106:            }
107:
108:            /**
109:             * Answers if the parentGroupId has been set. If it has not been set, this
110:             * would indicate that Groups Manager is in Servant mode.
111:             * @param staticData
112:             * @return boolean
113:             */
114:            protected boolean hasParentId(ChannelStaticData staticData) {
115:                String pk = getParentId(staticData);
116:                if (pk == null) {
117:                    return false;
118:                }
119:                if (pk.equals("")) {
120:                    return false;
121:                }
122:                Utility.logMessage("Debug",
123:                        "GroupsManagerCommand::hasParentId: Value is set to default: "
124:                                + pk);
125:                return true;
126:            }
127:
128:            /**
129:             * Returns the grpCommand parameter from runtimeData
130:             * @param runtimeData
131:             * @return String
132:             */
133:            protected String getCommand(
134:                    org.jasig.portal.ChannelRuntimeData runtimeData) {
135:                return (String) runtimeData.getParameter("grpCommand");
136:            }
137:
138:            /**
139:             * Returns the grpCommandIds parameter from runtimeData. The string usually
140:             * hold one element ID but could contain a string of delimited ids. (See
141:             * RemoveMember command).
142:             * @param runtimeData
143:             * @return String
144:             */
145:            protected String getCommandArg(
146:                    org.jasig.portal.ChannelRuntimeData runtimeData) {
147:                return (String) runtimeData.getParameter("grpCommandArg");
148:            }
149:
150:            /**
151:             * Returns the groupParentId parameter from staticData
152:             * @param staticData
153:             * @return String
154:             */
155:            protected String getParentId(ChannelStaticData staticData) {
156:                return staticData.getParameter("groupParentId");
157:            }
158:
159:            /**
160:             * Returns the userID from the user object
161:             * @param sessionData
162:             * @return String
163:             */
164:            protected String getUserID(CGroupsManagerSessionData sessionData) {
165:                return String.valueOf(sessionData.user.getID());
166:            }
167:
168:            /**
169:             * Returns the cached xml document from staticData
170:             * @param sessionData
171:             * @return Document
172:             */
173:            protected Document getXmlDoc(CGroupsManagerSessionData sessionData) {
174:                //return  (Document)staticData.get("xmlDoc");sessionData.model
175:                return sessionData.model;
176:            }
177:
178:            /**
179:             * Set the CommandArg value, useful for commands which would like to chain
180:             * other commands
181:             * @param runtimeData
182:             * @param arg String
183:             */
184:            protected void setCommandArg(
185:                    org.jasig.portal.ChannelRuntimeData runtimeData, String arg) {
186:                runtimeData.setParameter("grpCommandArg", arg);
187:            }
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.