@Test public final void testPreProcessNextTab() { HttpServletRequest aReq = new MockHttpServletRequest(); TargetManager targetManager = new MockTargetManager(testFile); testInstance.setAuthorityManager(new AuthorityManagerImpl()); TargetGroup targetGroup = targetManager.loadGroup(15000L); GroupsEditorContext groupsEditorContext = new GroupsEditorContext(targetGroup,true); aReq.getSession().setAttribute(TabbedGroupController.EDITOR_CONTEXT, groupsEditorContext); HttpServletResponse aResp = new MockHttpServletResponse(); TargetAccessCommand aCmd = new TargetAccessCommand(); TabbedController tc = new TabbedGroupController(); TabConfig tabConfig = new TabConfig(); tabConfig.setViewName("group"); List<Tab> tabs = getTabList(targetManager); tabConfig.setTabs(tabs); tc.setTabConfig(tabConfig); tc.setDefaultCommandClass(org.webcurator.ui.groups.command.DefaultCommand.class); Tab currentTab = tabs.get(1); aCmd.setAccessZone(0); aCmd.setDisplayNote("Some notes"); aCmd.setDisplayChangeReason("Some reason"); aCmd.setDisplayTarget(true); BindException aErrors = new BindException(aCmd, "TargetAccessCommand"); ModelAndView mav = testInstance.preProcessNextTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).getAccessZone() == targetGroup.getAccessZone()); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).getDisplayNote().equals(targetGroup.getDisplayNote())); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).getDisplayChangeReason().equals(targetGroup.getDisplayChangeReason())); assertTrue(((TargetAccessCommand)mav.getModel().get("command")).isDisplayTarget() == targetGroup.isDisplayTarget()); }
public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetGroup aTargetGroup = getEditorContext(req).getTargetGroup(); TargetAccessCommand command = new TargetAccessCommand(); command.setTabType(TargetAccessCommand.GROUP_TYPE); command.setDisplayTarget(aTargetGroup.isDisplayTarget()); command.setDisplayNote(aTargetGroup.getDisplayNote()); command.setDisplayChangeReason(aTargetGroup.getDisplayChangeReason()); command.setAccessZone(aTargetGroup.getAccessZone()); TabbedModelAndView tmav = tc.new TabbedModelAndView(); tmav.addObject(Constants.GBL_CMD_DATA, command); tmav.addObject("ownable", aTargetGroup); tmav.addObject("privleges", Privilege.MANAGE_GROUP + ";" + Privilege.CREATE_GROUP); tmav.addObject("editMode", getEditorContext(req).isEditMode()); tmav.addObject("displayTarget", aTargetGroup.isDisplayTarget()); tmav.addObject("accessZone", aTargetGroup.getAccessZone()); tmav.addObject("displayNote", aTargetGroup.getDisplayNote()); tmav.addObject("displayChangeReason", aTargetGroup.getDisplayChangeReason()); return tmav; }
AccessHandler extends AbstractGroupTabHandler { public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetGroup aTargetGroup = getEditorContext(req).getTargetGroup(); TargetAccessCommand command = new TargetAccessCommand(); command.setTabType(TargetAccessCommand.GROUP_TYPE); command.setDisplayTarget(aTargetGroup.isDisplayTarget()); command.setDisplayNote(aTargetGroup.getDisplayNote()); command.setDisplayChangeReason(aTargetGroup.getDisplayChangeReason()); command.setAccessZone(aTargetGroup.getAccessZone()); TabbedModelAndView tmav = tc.new TabbedModelAndView(); tmav.addObject(Constants.GBL_CMD_DATA, command); tmav.addObject("ownable", aTargetGroup); tmav.addObject("privleges", Privilege.MANAGE_GROUP + ";" + Privilege.CREATE_GROUP); tmav.addObject("editMode", getEditorContext(req).isEditMode()); tmav.addObject("displayTarget", aTargetGroup.isDisplayTarget()); tmav.addObject("accessZone", aTargetGroup.getAccessZone()); tmav.addObject("displayNote", aTargetGroup.getDisplayNote()); tmav.addObject("displayChangeReason", aTargetGroup.getDisplayChangeReason()); return tmav; } }
AccessHandler extends AbstractGroupTabHandler { public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetGroup aTargetGroup = getEditorContext(req).getTargetGroup(); TargetAccessCommand command = new TargetAccessCommand(); command.setTabType(TargetAccessCommand.GROUP_TYPE); command.setDisplayTarget(aTargetGroup.isDisplayTarget()); command.setDisplayNote(aTargetGroup.getDisplayNote()); command.setDisplayChangeReason(aTargetGroup.getDisplayChangeReason()); command.setAccessZone(aTargetGroup.getAccessZone()); TabbedModelAndView tmav = tc.new TabbedModelAndView(); tmav.addObject(Constants.GBL_CMD_DATA, command); tmav.addObject("ownable", aTargetGroup); tmav.addObject("privleges", Privilege.MANAGE_GROUP + ";" + Privilege.CREATE_GROUP); tmav.addObject("editMode", getEditorContext(req).isEditMode()); tmav.addObject("displayTarget", aTargetGroup.isDisplayTarget()); tmav.addObject("accessZone", aTargetGroup.getAccessZone()); tmav.addObject("displayNote", aTargetGroup.getDisplayNote()); tmav.addObject("displayChangeReason", aTargetGroup.getDisplayChangeReason()); return tmav; }  }
AccessHandler extends AbstractGroupTabHandler { public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetGroup aTargetGroup = getEditorContext(req).getTargetGroup(); TargetAccessCommand command = new TargetAccessCommand(); command.setTabType(TargetAccessCommand.GROUP_TYPE); command.setDisplayTarget(aTargetGroup.isDisplayTarget()); command.setDisplayNote(aTargetGroup.getDisplayNote()); command.setDisplayChangeReason(aTargetGroup.getDisplayChangeReason()); command.setAccessZone(aTargetGroup.getAccessZone()); TabbedModelAndView tmav = tc.new TabbedModelAndView(); tmav.addObject(Constants.GBL_CMD_DATA, command); tmav.addObject("ownable", aTargetGroup); tmav.addObject("privleges", Privilege.MANAGE_GROUP + ";" + Privilege.CREATE_GROUP); tmav.addObject("editMode", getEditorContext(req).isEditMode()); tmav.addObject("displayTarget", aTargetGroup.isDisplayTarget()); tmav.addObject("accessZone", aTargetGroup.getAccessZone()); tmav.addObject("displayNote", aTargetGroup.getDisplayNote()); tmav.addObject("displayChangeReason", aTargetGroup.getDisplayChangeReason()); return tmav; }  void processTab(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); TabbedModelAndView preProcessNextTab(TabbedController tc,
			Tab nextTabID, HttpServletRequest req, HttpServletResponse res,
			Object comm, BindException errors); ModelAndView processOther(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); void setAuthorityManager(AuthorityManager authorityManager); }
AccessHandler extends AbstractGroupTabHandler { public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetGroup aTargetGroup = getEditorContext(req).getTargetGroup(); TargetAccessCommand command = new TargetAccessCommand(); command.setTabType(TargetAccessCommand.GROUP_TYPE); command.setDisplayTarget(aTargetGroup.isDisplayTarget()); command.setDisplayNote(aTargetGroup.getDisplayNote()); command.setDisplayChangeReason(aTargetGroup.getDisplayChangeReason()); command.setAccessZone(aTargetGroup.getAccessZone()); TabbedModelAndView tmav = tc.new TabbedModelAndView(); tmav.addObject(Constants.GBL_CMD_DATA, command); tmav.addObject("ownable", aTargetGroup); tmav.addObject("privleges", Privilege.MANAGE_GROUP + ";" + Privilege.CREATE_GROUP); tmav.addObject("editMode", getEditorContext(req).isEditMode()); tmav.addObject("displayTarget", aTargetGroup.isDisplayTarget()); tmav.addObject("accessZone", aTargetGroup.getAccessZone()); tmav.addObject("displayNote", aTargetGroup.getDisplayNote()); tmav.addObject("displayChangeReason", aTargetGroup.getDisplayChangeReason()); return tmav; }  void processTab(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); TabbedModelAndView preProcessNextTab(TabbedController tc,
			Tab nextTabID, HttpServletRequest req, HttpServletResponse res,
			Object comm, BindException errors); ModelAndView processOther(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); void setAuthorityManager(AuthorityManager authorityManager);  }