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.GroupsManagerXML;
10: import org.jasig.portal.channels.groupsmanager.Utility;
11: import org.w3c.dom.Document;
12: import org.w3c.dom.Element;
13:
14: /**
15: * A Groups Manager command to release a lock on a group, return to browse mode
16: *
17: * @author Alex Vigdor
18: * @version $Revision: 34756 $
19: */
20:
21: public class UnlockGroup extends GroupsManagerCommand {
22:
23: public UnlockGroup() {
24: }
25:
26: public void execute(CGroupsManagerSessionData sessionData)
27: throws Exception {
28: Element parentElem = null;
29: sessionData.mode = BROWSE_MODE;
30: Document model = sessionData.model;
31: String key = sessionData.lockedGroup.getLock().getEntityKey();
32: Utility.logMessage("DEBUG",
33: "UnlockGroup::execute(): Locked group key = " + key);
34: sessionData.lockedGroup.getLock().release();
35: sessionData.lockedGroup = null;
36: String parentID = getParentId(sessionData.staticData);
37:
38: // Parent was locked so no other thread or process could have changed it, but
39: // child members could have changed.
40: // Parent element id is not always set.
41: if (!Utility.areEqual(parentID, "")) {
42: parentElem = GroupsManagerXML.getElementById(model,
43: parentID);
44: sessionData.staticData.remove("groupParentId");
45: }
46: Utility.logMessage("DEBUG",
47: "UnlockGroup::execute(): parentElem = " + parentElem);
48: if (parentElem != null) {
49: GroupsManagerXML.refreshAllNodesRecursivelyIfRequired(
50: sessionData.getUnrestrictedData(), parentElem);
51: }
52: }
53: }
|