@Test public final void testProcessTab2() { HttpServletRequest aReq = new MockHttpServletRequest(); TargetInstance targetInstance = getTargetInstanceManager().getTargetInstance(5001L); ProfileOverrides po = getProfileOverrides(20000L); targetInstance.setOverrides(po); targetInstance.setState(TargetInstance.STATE_HARVESTED); aReq.getSession().setAttribute(TargetInstanceCommand.SESSION_TI, targetInstance); aReq.getSession().setAttribute(TargetInstanceCommand.SESSION_MODE, true); HttpServletResponse aResp = new MockHttpServletResponse(); TargetInstanceProfileCommand aCmd = new TargetInstanceProfileCommand(); TabbedController tc = new TabbedTargetInstanceController(); TabConfig tabConfig = new TabConfig(); tabConfig.setViewName("targetInstance"); List<Tab> tabs = getTabList(); tabConfig.setTabs(tabs); tc.setTabConfig(tabConfig); tc.setDefaultCommandClass(org.webcurator.ui.target.command.TargetInstanceCommand.class); Tab currentTab = tabs.get(1); aCmd.setFromOverrides(targetInstance.getProfileOverrides()); aCmd.setExcludedMimeTypes("OverrideTest2"); aCmd.setOverrideTarget(true); BindException aErrors = new BindException(aCmd, aCmd.getActionCmd()); testInstance.processTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertFalse(targetInstance.getOverrides().getExcludedMimeTypes().equals("OverrideTest2")); }
@Override public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetInstance ti = (TargetInstance) req.getSession().getAttribute(TargetInstanceCommand.SESSION_TI); Boolean editMode = getEditMode(req); TargetInstanceProfileCommand command = (TargetInstanceProfileCommand) comm; if(!command.isOverrideTarget()) { ti.setOverrides(null); } else { ProfileOverrides overrides = null; if(ti.getOverrides() == null) { overrides = ti.getTarget().getOverrides().copy(); ti.setOverrides(overrides); } else { overrides = ti.getOverrides(); } if(editMode) { command.updateOverrides(overrides); } } }
TargetInstanceProfileHandler extends AbstractOverrideTabHandler { @Override public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetInstance ti = (TargetInstance) req.getSession().getAttribute(TargetInstanceCommand.SESSION_TI); Boolean editMode = getEditMode(req); TargetInstanceProfileCommand command = (TargetInstanceProfileCommand) comm; if(!command.isOverrideTarget()) { ti.setOverrides(null); } else { ProfileOverrides overrides = null; if(ti.getOverrides() == null) { overrides = ti.getTarget().getOverrides().copy(); ti.setOverrides(overrides); } else { overrides = ti.getOverrides(); } if(editMode) { command.updateOverrides(overrides); } } } }
TargetInstanceProfileHandler extends AbstractOverrideTabHandler { @Override public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetInstance ti = (TargetInstance) req.getSession().getAttribute(TargetInstanceCommand.SESSION_TI); Boolean editMode = getEditMode(req); TargetInstanceProfileCommand command = (TargetInstanceProfileCommand) comm; if(!command.isOverrideTarget()) { ti.setOverrides(null); } else { ProfileOverrides overrides = null; if(ti.getOverrides() == null) { overrides = ti.getTarget().getOverrides().copy(); ti.setOverrides(overrides); } else { overrides = ti.getOverrides(); } if(editMode) { command.updateOverrides(overrides); } } }  }
TargetInstanceProfileHandler extends AbstractOverrideTabHandler { @Override public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetInstance ti = (TargetInstance) req.getSession().getAttribute(TargetInstanceCommand.SESSION_TI); Boolean editMode = getEditMode(req); TargetInstanceProfileCommand command = (TargetInstanceProfileCommand) comm; if(!command.isOverrideTarget()) { ti.setOverrides(null); } else { ProfileOverrides overrides = null; if(ti.getOverrides() == null) { overrides = ti.getTarget().getOverrides().copy(); ti.setOverrides(overrides); } else { overrides = ti.getOverrides(); } if(editMode) { command.updateOverrides(overrides); } } }  @Override TabbedModelAndView preProcessNextTab(TabbedController tc,
			Tab nextTabID, HttpServletRequest req, HttpServletResponse res,
			Object comm, BindException errors); @Override void processTab(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); @Override ModelAndView processOther(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); }
TargetInstanceProfileHandler extends AbstractOverrideTabHandler { @Override public void processTab(TabbedController tc, Tab currentTab, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TargetInstance ti = (TargetInstance) req.getSession().getAttribute(TargetInstanceCommand.SESSION_TI); Boolean editMode = getEditMode(req); TargetInstanceProfileCommand command = (TargetInstanceProfileCommand) comm; if(!command.isOverrideTarget()) { ti.setOverrides(null); } else { ProfileOverrides overrides = null; if(ti.getOverrides() == null) { overrides = ti.getTarget().getOverrides().copy(); ti.setOverrides(overrides); } else { overrides = ti.getOverrides(); } if(editMode) { command.updateOverrides(overrides); } } }  @Override TabbedModelAndView preProcessNextTab(TabbedController tc,
			Tab nextTabID, HttpServletRequest req, HttpServletResponse res,
			Object comm, BindException errors); @Override void processTab(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors); @Override ModelAndView processOther(TabbedController tc, Tab currentTab,
			HttpServletRequest req, HttpServletResponse res, Object comm,
			BindException errors);  }