01: /* Copyright 2001 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.channels.groupsmanager.commands;
07:
08: import org.jasig.portal.ChannelRuntimeData;
09: import org.jasig.portal.channels.groupsmanager.CGroupsManagerSessionData;
10: import org.jasig.portal.channels.groupsmanager.GroupsManagerXML;
11: import org.jasig.portal.channels.groupsmanager.Utility;
12: import org.w3c.dom.Document;
13: import org.w3c.dom.Element;
14:
15: /**
16: * If the children xml elements have not already been created, this command will
17: * retrieve the group members and created the elements. This command then sets
18: * the expanded attribute for an element to "true" and lets the transformation
19: * handle the tree expansion display.
20: * @author Don Fracapane
21: * @version $Revision: 35498 $
22: */
23:
24: public class ExpandGroup
25: extends
26: org.jasig.portal.channels.groupsmanager.commands.GroupsManagerCommand {
27:
28: /** Creates new ExpandGroup */
29: public ExpandGroup() {
30: }
31:
32: /**
33: * This is the public method
34: * @param sessionData
35: * @throws Exception
36: */
37: public void execute(CGroupsManagerSessionData sessionData)
38: throws Exception {
39: ChannelRuntimeData runtimeData = sessionData.runtimeData;
40:
41: Utility.logMessage("DEBUG", "ExpandGroup::execute(): Start");
42: Document model = getXmlDoc(sessionData);
43: // Due to the networked relationship of groups, the next method has to return a list of elements.
44: String elemUid = getCommandArg(runtimeData);
45: Utility.logMessage("DEBUG",
46: "ExpandGroup::execute(): Uid of expanded element = "
47: + elemUid);
48: Element expandedElem = GroupsManagerXML
49: .getElementByTagNameAndId(model, GROUP_TAGNAME, elemUid);
50: if (expandedElem != null) {
51: GroupsManagerXML.refreshAllNodesRecursivelyIfRequired(
52: sessionData.getUnrestrictedData(), expandedElem);
53:
54: if (expandedElem.getAttribute("searchResults").equals(
55: "true")) {
56: expandedElem.setAttribute("expanded", "true");
57: } else {
58: GroupsManagerXML.expandGroupElementXML(expandedElem,
59: sessionData.getUnrestrictedData());
60: }
61: }
62: }
63: }
|