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.ChannelStaticData;
10: import org.jasig.portal.channels.groupsmanager.CGroupsManagerSessionData;
11: import org.jasig.portal.channels.groupsmanager.GroupsManagerXML;
12: import org.jasig.portal.channels.groupsmanager.Utility;
13: import org.jasig.portal.groups.ILockableEntityGroup;
14: import org.jasig.portal.services.GroupService;
15: import org.w3c.dom.Document;
16: import org.w3c.dom.Element;
17:
18: /** This command delegates to the GroupsService to find entities requested
19: * by the user.
20: * @author Don Fracapane
21: * @version $Revision: 34756 $
22: */
23: public class EditGroup extends GroupsManagerCommand {
24:
25: /**
26: * put your documentation comment here
27: */
28: public EditGroup() {
29: }
30:
31: /**
32: * This is the public method
33: * @param sessionData
34: * @throws Exception
35: */
36: public void execute(CGroupsManagerSessionData sessionData)
37: throws Exception {
38: ChannelStaticData staticData = sessionData.staticData;
39: ChannelRuntimeData runtimeData = sessionData.runtimeData;
40:
41: Document model = getXmlDoc(sessionData);
42: Utility.logMessage("DEBUG", "EditGroup::execute(): Start");
43: String parentElemId = getCommandArg(runtimeData);
44: // if not IPerson group, then set view root to root for requested type
45:
46: String userID = getUserID(sessionData);
47: //String userName = GroupsManagerXML.getEntityName(ENTITY_CLASSNAME, userID);
48: String userKey = sessionData.user.getEntityIdentifier()
49: .getKey();
50: String lockKey = userID + "::" + userKey;
51: Utility.logMessage("DEBUG", "EditGroup::execute(): lockKey = "
52: + lockKey);
53: Element parentElem = GroupsManagerXML.getElementById(model,
54: parentElemId);
55: String parentKey = parentElem.getAttribute("key");
56: ILockableEntityGroup lockedGroup = GroupService
57: .findLockableGroup(parentKey, lockKey);
58: // if lockedGroup is null, an exception has probably already been thrown
59: if (lockedGroup != null) {
60: GroupsManagerXML.refreshAllNodesRecursivelyIfRequired(
61: sessionData.getUnrestrictedData(), parentElem);
62: // store in sessionData
63: sessionData.lockedGroup = lockedGroup;
64: sessionData.mode = EDIT_MODE;
65: staticData.setParameter("groupParentId", parentElemId);
66: }
67:
68: Utility.logMessage("DEBUG",
69: "EditGroup::execute(): Uid of parent element = "
70: + parentElemId);
71: }
72: }
|