Source Code Cross Referenced for RemoveMember.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.GroupsException;
015:        import org.jasig.portal.groups.IEntityGroup;
016:        import org.jasig.portal.groups.IGroupMember;
017:        import org.jasig.portal.groups.ILockableEntityGroup;
018:        import org.w3c.dom.Document;
019:        import org.w3c.dom.Element;
020:        import org.w3c.dom.Node;
021:        import org.w3c.dom.NodeList;
022:
023:        /**
024:         * This command removes the association of a member element to an IEntityGroup
025:         * It then gathers all of the xml nodes for the parent group and removes the child
026:         * node of the removed member.
027:         * @author Don Fracapane
028:         * @version $Revision: 34756 $
029:         */
030:        public class RemoveMember extends GroupsManagerCommand {
031:
032:            /** Creates new RemoveMember */
033:            public RemoveMember() {
034:            }
035:
036:            /**
037:             * This is the public method
038:             * @param sessionData
039:             * @throws Exception
040:             */
041:            public void execute(CGroupsManagerSessionData sessionData)
042:                    throws Exception {
043:                //ChannelStaticData staticData = sessionData.staticData;
044:                ChannelRuntimeData runtimeData = sessionData.runtimeData;
045:                Utility.logMessage("DEBUG", "RemoveMember::execute(): Start");
046:                Document model = getXmlDoc(sessionData);
047:                String cmdIds = getCommandArg(runtimeData);
048:                Object parentGroup = null;
049:                IGroupMember childGm = null;
050:                String hasMbrs = "duh";
051:                Utility
052:                        .logMessage("DEBUG",
053:                                "RemoveMember::execute(): About to get parent and child keys");
054:                String parentID = Utility.parseStringDelimitedBy("parent.",
055:                        cmdIds, "|");
056:                String childID = Utility.parseStringDelimitedBy("child.",
057:                        cmdIds, "|");
058:                Utility.logMessage("DEBUG",
059:                        "RemoveMember::execute(): Uid of parent element = "
060:                                + parentID + " child element = " + childID);
061:                Element parentElem = GroupsManagerXML.getElementByTagNameAndId(
062:                        model, GROUP_TAGNAME, parentID);
063:                if (parentElem == null) {
064:                    Utility
065:                            .logMessage("ERROR",
066:                                    "RemoveMember::execute(): Unable to retrieve parent element!");
067:                    return;
068:                }
069:                Utility.logMessage("DEBUG",
070:                        "RemoveMember::execute(): About to get child element = "
071:                                + childID);
072:                Element childElem = GroupsManagerXML.getElementById(model,
073:                        childID);
074:                if (childElem == null) {
075:                    Utility
076:                            .logMessage("ERROR",
077:                                    "RemoveMember::execute(): Unable to retrieve Child element!");
078:                    return;
079:                }
080:                // The child will always be an IGroupMember
081:                childGm = GroupsManagerXML.retrieveGroupMemberForElementId(
082:                        model, childID);
083:                parentGroup = sessionData.lockedGroup;
084:                removeChildFromGroup(parentGroup, childGm);
085:                hasMbrs = String.valueOf(((IEntityGroup) parentGroup)
086:                        .hasMembers());
087:                Utility.logMessage("DEBUG",
088:                        "RemoveMember::execute(): Got the parent group ");
089:                Utility
090:                        .logMessage("DEBUG",
091:                                "RemoveMember::execute(): about to remove child elements");
092:                // remove property elements for child gm and clear the Entity Properties cache.
093:                GroupsManagerXML.removePropertyElements(model, childGm, true);
094:
095:                // Removes EntityProperites for the child GroupMember from the Entity Property cache.
096:                GroupsManagerXML.clearPropertiesCache(childGm);
097:
098:                // remove this member from all parent group elements.
099:                Iterator parentNodes = GroupsManagerXML
100:                        .getNodesByTagNameAndKey(model, GROUP_TAGNAME,
101:                                parentElem.getAttribute("key"));
102:                Node parentNode;
103:                NodeList childNodes;
104:                Node childNode;
105:                while (parentNodes.hasNext()) {
106:                    parentNode = (Node) parentNodes.next();
107:                    childNodes = parentNode.getChildNodes();
108:                    for (int i = 0; i < childNodes.getLength(); i++) {
109:                        childNode = childNodes.item(i);
110:                        if (((Element) childNode).getAttribute("key").equals(
111:                                childElem.getAttribute("key"))) {
112:                            parentNode.removeChild(childNode);
113:                            ((Element) parentNode).setAttribute("hasMembers",
114:                                    hasMbrs);
115:                        }
116:                    }
117:                }
118:                Utility.logMessage("DEBUG",
119:                        "RemoveMember::execute(): Completed");
120:            }
121:
122:            /**
123:             * This section removes the selected member from an IEntityGroup.
124:             * @param parentGroup
125:             * @param childGm
126:             * @exception Exception
127:             */
128:            private void removeChildFromGroup(Object parentGroup,
129:                    IGroupMember childGm) throws Exception {
130:                Utility
131:                        .logMessage("DEBUG",
132:                                "RemoveMember::removeChildrenFromGroup(): about to remove child");
133:                if (parentGroup != null && childGm != null) {
134:                    try {
135:                        ((IEntityGroup) parentGroup).removeMember(childGm);
136:                        ((ILockableEntityGroup) parentGroup)
137:                                .updateMembersAndRenewLock();
138:                    } catch (GroupsException ge) {
139:                        String aMsg = "Unable to remove child from parent/n"
140:                                + ge;
141:                        Utility.logMessage("ERROR", aMsg, ge);
142:                    }
143:                } else {
144:                    String suspect = (parentGroup == null ? "Parent" : "Child");
145:                    throw new Exception(suspect + " group member was not found");
146:                }
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.