@Test public final void testPreProcessNextTab() { try { HttpServletRequest aReq = new MockHttpServletRequest(); TargetManager targetManager = new MockTargetManager(testFile); testInstance.setTargetManager(targetManager); Target target = targetManager.load(4000L); List<Annotation> list = createAnnotationList(); assertFalse(checkSortedList(list)); target.setAnnotations(list); TargetEditorContext ctx = new TargetEditorContext(targetManager, target, true); aReq.getSession().setAttribute(TabbedTargetController.EDITOR_CONTEXT, ctx); HttpServletResponse aResp = new MockHttpServletResponse(); TargetAnnotationCommand aCmd = new TargetAnnotationCommand(); TabbedController tc = new TabbedTargetController(); TabConfig tabConfig = new TabConfig(); tabConfig.setViewName("target"); List<Tab> tabs = getTabList(targetManager); tabConfig.setTabs(tabs); tc.setTabConfig(tabConfig); tc.setDefaultCommandClass(org.webcurator.ui.target.command.TargetDefaultCommand.class); Tab currentTab = tabs.get(1); BindException aErrors = new BindException(aCmd, aCmd.getActionCmd()); ModelAndView mav = testInstance.preProcessNextTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertNotNull(mav); assertTrue(checkSortedList((List<Annotation>)mav.getModel().get("annotations"))); } catch(Exception e) { fail(e.getMessage()); } }
@SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); TargetEditorContext ctx = getEditorContext(req); Target target = ctx.getTarget(); if (!target.isAnnotationsSet()) { target.setAnnotations(targetManager.getAnnotations(target)); } TargetAnnotationCommand populatedCommand = buildFromModel(target); tmav.addObject(Constants.GBL_CMD_DATA, populatedCommand); tmav.addObject("annotations", target.getSortedAnnotations()); tmav.addObject("selectionTypesList", selectionTypesList); tmav.addObject("harvestTypesList", harvestTypesList); return tmav; }
TargetAnnotationHandler extends AbstractTargetTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); TargetEditorContext ctx = getEditorContext(req); Target target = ctx.getTarget(); if (!target.isAnnotationsSet()) { target.setAnnotations(targetManager.getAnnotations(target)); } TargetAnnotationCommand populatedCommand = buildFromModel(target); tmav.addObject(Constants.GBL_CMD_DATA, populatedCommand); tmav.addObject("annotations", target.getSortedAnnotations()); tmav.addObject("selectionTypesList", selectionTypesList); tmav.addObject("harvestTypesList", harvestTypesList); return tmav; } }
TargetAnnotationHandler extends AbstractTargetTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); TargetEditorContext ctx = getEditorContext(req); Target target = ctx.getTarget(); if (!target.isAnnotationsSet()) { target.setAnnotations(targetManager.getAnnotations(target)); } TargetAnnotationCommand populatedCommand = buildFromModel(target); tmav.addObject(Constants.GBL_CMD_DATA, populatedCommand); tmav.addObject("annotations", target.getSortedAnnotations()); tmav.addObject("selectionTypesList", selectionTypesList); tmav.addObject("harvestTypesList", harvestTypesList); return tmav; }  }
TargetAnnotationHandler extends AbstractTargetTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); TargetEditorContext ctx = getEditorContext(req); Target target = ctx.getTarget(); if (!target.isAnnotationsSet()) { target.setAnnotations(targetManager.getAnnotations(target)); } TargetAnnotationCommand populatedCommand = buildFromModel(target); tmav.addObject(Constants.GBL_CMD_DATA, populatedCommand); tmav.addObject("annotations", target.getSortedAnnotations()); tmav.addObject("selectionTypesList", selectionTypesList); tmav.addObject("harvestTypesList", harvestTypesList); return tmav; }  void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void processTab(TabbedController tc, Tab currentTab,
            HttpServletRequest req, HttpServletResponse res, Object comm,
            BindException errors); @SuppressWarnings("unchecked") 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 setTargetManager(TargetManager targetManager); void setSelectionTypesList(WCTTreeSet selectionTypesList); void setHarvestTypesList(WCTTreeSet harvestTypesList); }
TargetAnnotationHandler extends AbstractTargetTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); TargetEditorContext ctx = getEditorContext(req); Target target = ctx.getTarget(); if (!target.isAnnotationsSet()) { target.setAnnotations(targetManager.getAnnotations(target)); } TargetAnnotationCommand populatedCommand = buildFromModel(target); tmav.addObject(Constants.GBL_CMD_DATA, populatedCommand); tmav.addObject("annotations", target.getSortedAnnotations()); tmav.addObject("selectionTypesList", selectionTypesList); tmav.addObject("harvestTypesList", harvestTypesList); return tmav; }  void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void processTab(TabbedController tc, Tab currentTab,
            HttpServletRequest req, HttpServletResponse res, Object comm,
            BindException errors); @SuppressWarnings("unchecked") 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 setTargetManager(TargetManager targetManager); void setSelectionTypesList(WCTTreeSet selectionTypesList); void setHarvestTypesList(WCTTreeSet harvestTypesList);  }