Source Code Cross Referenced for CreateGroup.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 java.util.Iterator;
009:
010:        import org.jasig.portal.ChannelRuntimeData;
011:        import org.jasig.portal.channels.groupsmanager.CGroupsManagerSessionData;
012:        import org.jasig.portal.channels.groupsmanager.GroupsManagerXML;
013:        import org.jasig.portal.channels.groupsmanager.Utility;
014:        import org.jasig.portal.groups.IEntityGroup;
015:        import org.jasig.portal.groups.IGroupMember;
016:        import org.jasig.portal.groups.ILockableEntityGroup;
017:        import org.jasig.portal.services.GroupService;
018:        import org.w3c.dom.Document;
019:        import org.w3c.dom.Element;
020:
021:        /**
022:         * We will only be creating groups. We do not create entities. Once we create
023:         * the new group, it will be added to a parent and default permissions will
024:         * be assigned if the user is not in the portal adminstrators groups that automatically
025:         * has full access.
026:         * All of the xml  nodes for the parent group will be found and if the node is
027:         * expanded, the new child node will be added.
028:         * @author Don Fracapane
029:         * @version $Revision: 35496 $
030:         */
031:        public class CreateGroup extends GroupsManagerCommand {
032:
033:            /** Creates new CreateGroup */
034:            public CreateGroup() {
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:                ChannelRuntimeData runtimeData = sessionData.runtimeData;
045:
046:                Utility.logMessage("DEBUG", "CreateGroup::execute(): Start");
047:                Document model = getXmlDoc(sessionData);
048:                String parentID = getCommandArg(runtimeData);
049:                String newGrpName = runtimeData.getParameter("grpNewName");
050:                Utility.logMessage("DEBUG", "CreateGroup::execute(): New grp: "
051:                        + newGrpName + " will be added to parent element = "
052:                        + parentID);
053:                ILockableEntityGroup parentGroup = null;
054:                Class parentEntityType;
055:                Element parentElem = GroupsManagerXML.getElementByTagNameAndId(
056:                        model, GROUP_TAGNAME, parentID);
057:                String parentKey = parentElem.getAttribute("key");
058:                String retMsg;
059:                Iterator parentNodes;
060:                if (parentElem == null) {
061:                    retMsg = "Unable to find Parent element!";
062:                    sessionData.feedback = retMsg;
063:                    Utility.logMessage("ERROR", "CreateGroup::execute(): "
064:                            + retMsg);
065:                    return;
066:                }
067:                Utility.logMessage("DEBUG",
068:                        "CreateGroup::execute(): Parent element was found!");
069:
070:                //parentGroup = GroupsManagerXML.retrieveGroup(parentKey);
071:                parentGroup = sessionData.lockedGroup;
072:                if (parentGroup == null) {
073:                    retMsg = "Unable to retrieve Parent Entity Group!";
074:                    sessionData.feedback = retMsg;
075:                    return;
076:                }
077:                parentEntityType = parentGroup.getLeafType();
078:                //parentEntityType = (Class) GroupsManagerXML.getEntityTypes().get("Person");
079:                Utility.logMessage("DEBUG",
080:                        "CreateGroup::execute(): About to create new group: "
081:                                + newGrpName + " Type: "
082:                                + parentEntityType.getName());
083:                String userID = sessionData.user.getEntityIdentifier().getKey();
084:                Utility.logMessage("DEBUG", "CreateGroup::execute(): userID = "
085:                        + userID);
086:                IEntityGroup childEntGrp = GroupService
087:                        .newGroup(parentEntityType);
088:                childEntGrp.setName(newGrpName);
089:                childEntGrp.setCreatorID(userID);
090:                childEntGrp.update();
091:                Utility.logMessage("DEBUG",
092:                        "CreateGroup::execute(): About to add new group: "
093:                                + newGrpName);
094:                parentGroup.addMember((IGroupMember) childEntGrp);
095:                parentGroup.updateMembersAndRenewLock();
096:                parentNodes = GroupsManagerXML.getNodesByTagNameAndKey(model,
097:                        GROUP_TAGNAME, parentKey);
098:                // add new group to all parent group xml nodes
099:                while (parentNodes.hasNext()) {
100:                    Element parentNode = (Element) parentNodes.next();
101:                    GroupsManagerXML.getGroupMemberXml(
102:                            (IGroupMember) parentGroup, true, parentNode,
103:                            sessionData.getUnrestrictedData());
104:                    ((Element) parentNode).setAttribute("hasMembers", "true");
105:                }
106:
107:                /** Grant all permissions for the new group to the creator only if the user is
108:                 *  not in the portal administrators group
109:                 */
110:                if (!sessionData.isAdminUser) {
111:                    GroupsManagerXML
112:                            .createPermissions(sessionData, childEntGrp);
113:                }
114:                // Parent was locked so no other thread or process could have changed it, but
115:                // child members could have changed.
116:                GroupsManagerXML.refreshAllNodesRecursivelyIfRequired(
117:                        sessionData.getUnrestrictedData(), parentElem);
118:
119:                Utility.logMessage("DEBUG", "CreateGroup::execute(): Finished");
120:            }
121:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.