pager.setTarget("/browseStems");
pager.setTarget("/browseStems" + getBrowseMode(session));
	public ActionForward grouperExecute(ActionMapping mapping, ActionForm form,			HttpServletRequest request, HttpServletResponse response,			HttpSession session, GrouperSession grouperSession)			throws Exception {				DynaActionForm browseForm = (DynaActionForm) form;		String browseMode = getBrowseMode(session);		RepositoryBrowser repositoryBrowser = RepositoryBrowserFactory.getInstance(browseMode,grouperSession,getMediaResources(request));		Group curNodeGroup = null;		Stem curNodeStem = null;		GroupOrStem curGroupOrStem =null;		Map curGroupOrStemMap = null;		boolean currentNodeIsGroup = false;		int resultSize = 0;		boolean isFlat = false;		String findForNode = (String) session.getAttribute("findForNode");				if(repositoryBrowser.isFlatCapable()) {			isFlat = processFlatForMode(browseMode, request, session);		}		String startStr = request.getParameter("start");		if (startStr == null || "".equals(startStr))			startStr = "0";		int start = Integer.parseInt(startStr);		int pageSize = getPageSize(session);				//Remember where we are		if (!isEmpty(browseForm.get("currentNode")))			setBrowseNode((String)browseForm.get("currentNode"),session);				//Determine the current node		String currentNodeId = (String)browseForm.get("currentNode");				//Resume normal browsing 		if ("Y".equals(browseForm.get("resetBrowse"))) {			session.removeAttribute("browseNodeId" + browseMode);			if (isFlat) {				session.removeAttribute("isFlat" + browseMode);				isFlat = false;			}		}				//We have a node so we souldn't be in flat mode		//TODO check this logic!		if (!isEmpty(currentNodeId)) {			isFlat = false;		}else{			currentNodeId = getBrowseNode(session);		}		//Can have different implementation for different modes		String pluginInitialStems = repositoryBrowser.getInitialStems();				//Should we be using initial stems/ If so do it and get out of here		if(!isFlat && isEmpty(currentNodeId) && pluginInitialStems != null) {			InitialStems initialStems = (InitialStems) Class.forName(					pluginInitialStems).newInstance();			List stems = initialStems.getInitialStems(grouperSession);			List stemMaps = GrouperHelper.stems2Maps(grouperSession, stems);			request.setAttribute("initialStems", stemMaps);			request.setAttribute("browsePath", stemMaps);			return null;		}				//Different modes can have different root nodes		String defaultStem = repositoryBrowser.getRootNode();		if(isEmpty(defaultStem)) defaultStem=getDefaultRootStemName(session);				Map parent = null;		if(isEmpty(currentNodeId)){ 			if(GrouperHelper.NS_ROOT.equals(defaultStem)) {				curNodeStem = StemFinder.findRootStem(grouperSession);			}else {				try{					curNodeStem = StemFinder.findByName(grouperSession, defaultStem);				}catch(StemNotFoundException e){}			}						if(curNodeStem!=null && !"ROOT".equals(currentNodeId)) {				currentNodeId = curNodeStem.getUuid();			}		}		if(isEmpty(currentNodeId)|| "ROOT".equals(currentNodeId)){				parent = new HashMap();				curGroupOrStemMap = new HashMap();				currentNodeId=GrouperHelper.NS_ROOT;				defaultStem=GrouperHelper.NS_ROOT;				curNodeStem=null;		}else{			//we have a node			curGroupOrStem = GroupOrStem.findByID(grouperSession,currentNodeId);			if(curGroupOrStem.isGroup() && findForNode ==null) {				curGroupOrStem = GroupOrStem.findByStem(grouperSession,curGroupOrStem.getGroup().getParentStem());			}else if(curGroupOrStem.isGroup()) {				curNodeGroup = curGroupOrStem.getGroup();				currentNodeIsGroup=true;				parent = GrouperHelper.group2Map(grouperSession, curNodeGroup);				curGroupOrStemMap = GrouperHelper.group2Map(grouperSession,curNodeGroup);			}			if(curGroupOrStem.isStem()) {				curNodeStem = curGroupOrStem.getStem();				parent = GrouperHelper.stem2Map(grouperSession, curNodeStem);				curGroupOrStemMap = GrouperHelper.stem2Map(grouperSession,curNodeStem);			}			}		List children = new ArrayList();		List allChildren = new ArrayList();		Map child;		String name;										//we have a stem so we will page the children (stems / groups)				StringBuffer totalCount = new StringBuffer();				String fromId = null;				if(curNodeStem!=null) {					fromId = curNodeStem.getUuid();				}else if(curNodeGroup!=null){					fromId=curNodeGroup.getUuid();					List listFields = GrouperHelper.getListFieldsForGroup(grouperSession,curNodeGroup);					request.setAttribute("listFields",listFields);					request.setAttribute("listFieldsSize",new Integer(listFields.size()));									}else{					fromId = defaultStem;				}				String listField = request.getParameter("expandListField"); 				children = new ArrayList(repositoryBrowser.getChildren(fromId,listField,start,pageSize,totalCount,isFlat,findForNode!=null));				//children = GrouperHelper.groups2Maps(grouperSession, allChildren);				request.setAttribute("stemHasChildren",new Boolean(allChildren.size()>0));								//Skip empty stems		//should only skip where no stem / create privilege		if(children.size()==1) {			Map m = (Map)children.get(0);			String stemId = (String)m.get("stemId");			if(!isEmpty(stemId)) {				Stem wStem = (Stem)m.get("wrappedObject");								if(!wStem.hasStem(grouperSession.getSubject())						&&!wStem.hasCreate(grouperSession.getSubject())) {					((DynaActionForm)form).set("currentNode",stemId);					return grouperExecute(mapping,form,request,response,session,grouperSession);				}			}		}				//Determine hierarchy to current node		List path =  repositoryBrowser.getParentStems(curGroupOrStem);		Map privs = null;		//Determine privileges 		if ("All".equals(browseMode)) {			privs = GrouperHelper.hasAsMap(grouperSession, curGroupOrStem, false);		} else {			privs = GrouperHelper.hasAsMap(grouperSession, curGroupOrStem, true);		}		request.setAttribute("browsePrivs", privs);		request.setAttribute("browseParent", parent);		if(isEmpty(getBrowseNode(session))) setBrowseNode(curNodeStem.getUuid(),session);			browseForm.set("pageSize", "" + pageSize);		//Set up CollectionPager for view		if(resultSize<children.size()) resultSize=children.size();		CollectionPager pager = new CollectionPager(children, resultSize, null,				start, null, pageSize);		if (!isFlat)			pager.setParam("currentNode", currentNodeId);		if (session.getAttribute("findForNode") != null) {			pager.setTarget("/browseStemsFind");		} else {			pager.setTarget("/browseStems");		}		request.setAttribute("pager", pager);		request.setAttribute("allStemPrivs", GrouperHelper				.getStemPrivs(grouperSession));		request.setAttribute("currentLocation", curGroupOrStemMap);		request.setAttribute("repositoryBrowser",repositoryBrowser);		return null;	}