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.channels.groupsmanager.CGroupsManagerSessionData;
09: import org.jasig.portal.channels.groupsmanager.GroupsManagerCommandFactory;
10: import org.jasig.portal.channels.groupsmanager.GroupsManagerXML;
11: import org.w3c.dom.Document;
12: import org.w3c.dom.Element;
13:
14: /**
15: * A Groups Manager command to highlight a particular element. Also
16: * releases any held locks on other groups, moves to BROWSE mode from EDIT
17: *
18: * @author Alex Vigdor
19: * @version $Revision: 34756 $
20: */
21: public class HighlightGroup
22: extends
23: org.jasig.portal.channels.groupsmanager.commands.GroupsManagerCommand {
24:
25: public HighlightGroup() {
26: }
27:
28: /**
29: * put your documentation comment here
30: * @param sessionData
31: * @throws Exception
32: */
33: public void execute(CGroupsManagerSessionData sessionData)
34: throws Exception {
35: Document model = getXmlDoc(sessionData);
36: sessionData.highlightedGroupID = getCommandArg(sessionData.runtimeData);
37: sessionData.currentPage = 1;
38: GroupsManagerCommandFactory.get("Expand").execute(sessionData);
39: // expand parent
40: Element expandedElem = GroupsManagerXML
41: .getElementByTagNameAndId(model, GROUP_TAGNAME,
42: getCommandArg(sessionData.runtimeData));
43: if (expandedElem != null) {
44: GroupsManagerXML.expandGroupElementXML(
45: (Element) expandedElem.getParentNode(), sessionData
46: .getUnrestrictedData());
47: }
48: // unlock and discard any other group that may be held in a locked state
49: if ((sessionData.lockedGroup != null)
50: && (!sessionData.lockedGroup.getEntityIdentifier()
51: .getKey()
52: .equals(sessionData.highlightedGroupID))
53: && (!sessionData.mode.equals("select"))) {
54: sessionData.lockedGroup.getLock().release();
55: sessionData.lockedGroup = null;
56: sessionData.mode = BROWSE_MODE;
57: }
58: }
59: }
|