* This is the public method
* @param sessionData
* @throws Exception
*/
public void execute (CGroupsManagerSessionData sessionData) throws Exception{
ChannelStaticData staticData = sessionData.staticData;
//ChannelRuntimeData runtimeData= sessionData.runtimeData;
Utility.logMessage("DEBUG", "DoneWithSelection::execute(): Start");
String parentId = null;
boolean hasParentId = hasParentId(staticData);
Utility.logMessage("DEBUG", "DoneWithSelection::execute(): Parent ID is set: "
+ hasParentId);
IGroupMember[] princResults = null;
Document model = getXmlDoc(sessionData);
Element rootElem = model.getDocumentElement();
NodeList nGroupList = rootElem.getElementsByTagName(GROUP_TAGNAME);
NodeList nEntityList = rootElem.getElementsByTagName(ENTITY_TAGNAME);
Vector gmCollection = new Vector();
Element parentElem = null;
Utility.logMessage("DEBUG", "DoneWithSelection::execute(): Starting group process");
addGroupMemberToCollection(gmCollection, nGroupList);
Utility.logMessage("DEBUG", "DoneWithSelection::execute(): Starting entity process");
addGroupMemberToCollection(gmCollection, nEntityList);
// check if selections were made
if (gmCollection.size() <1) {
sessionData.feedback = sessionData.feedback + "\n No groups or people were selected! ";
return;
}
/** Presence of parentID means the process is not in servant mode. That is,
* the master channel is the Groups Manager channel and AddMembers had
* been selected
*/
if (hasParentId) {
parentId = getParentId(staticData);
Utility.logMessage("DEBUG", "DoneWithSelection::execute(): Parent ID is set to: "
+ parentId);
parentElem = GroupsManagerXML.getElementByTagNameAndId(model, GROUP_TAGNAME, parentId);
if (parentElem == null) {
Utility.logMessage("ERROR", "DoneWithSelection::execute: Error parent element not found");
return;
}
addChildrenToGroup(gmCollection, sessionData, parentElem, model);
clearSelected(sessionData);
sessionData.mode = sessionData.returnToMode;;
sessionData.highlightedGroupID = parentId;
sessionData.rootViewGroupID=null;
// Parent was locked so no other thread or process could have changed it, but
// child members could have changed.
GroupsManagerXML.refreshAllNodesRecursivelyIfRequired(sessionData.getUnrestrictedData(), parentElem);
sessionData.staticData.remove("groupParentId");
}
else {
princResults = (IGroupMember[])gmCollection.toArray(new IGroupMember[0]);
if (princResults.length > 0) {
staticData.put("princResults", princResults);
staticData.setParameter("groupManagerFinished", "true");
}
}
}