@Test public void performActionMoveTabFromLastToEarlier() throws Exception { final Long tabId = TAB4_ID; final Integer newIndex = 2; setupExpectations(); SetTabOrderRequest currentRequest = new SetTabOrderRequest(TabGroupType.START, tabId, newIndex); ServiceActionContext currentContext = new ServiceActionContext(currentRequest, principalMock); sut.execute(currentContext); assertPositions(TAB0_ID, TAB1_ID, TAB4_ID, TAB2_ID, TAB3_ID); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabOrderRequest currentRequest = (SetTabOrderRequest) inActionContext.getParams(); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); List<Tab> tabs = person.getTabs(currentRequest.getTabType()); int oldIndex = findTabIndex(tabs, currentRequest.getTabId()); Tab movingTab = tabs.get(oldIndex); tabs.remove(oldIndex); tabs.add(currentRequest.getNewIndex(), movingTab); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); personMapper.flush(); return Boolean.TRUE; }
SetTabOrderExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabOrderRequest currentRequest = (SetTabOrderRequest) inActionContext.getParams(); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); List<Tab> tabs = person.getTabs(currentRequest.getTabType()); int oldIndex = findTabIndex(tabs, currentRequest.getTabId()); Tab movingTab = tabs.get(oldIndex); tabs.remove(oldIndex); tabs.add(currentRequest.getNewIndex(), movingTab); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); personMapper.flush(); return Boolean.TRUE; } }
SetTabOrderExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabOrderRequest currentRequest = (SetTabOrderRequest) inActionContext.getParams(); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); List<Tab> tabs = person.getTabs(currentRequest.getTabType()); int oldIndex = findTabIndex(tabs, currentRequest.getTabId()); Tab movingTab = tabs.get(oldIndex); tabs.remove(oldIndex); tabs.add(currentRequest.getNewIndex(), movingTab); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); personMapper.flush(); return Boolean.TRUE; } SetTabOrderExecution(final PersonMapper inPersonMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); }
SetTabOrderExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabOrderRequest currentRequest = (SetTabOrderRequest) inActionContext.getParams(); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); List<Tab> tabs = person.getTabs(currentRequest.getTabType()); int oldIndex = findTabIndex(tabs, currentRequest.getTabId()); Tab movingTab = tabs.get(oldIndex); tabs.remove(oldIndex); tabs.add(currentRequest.getNewIndex(), movingTab); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); personMapper.flush(); return Boolean.TRUE; } SetTabOrderExecution(final PersonMapper inPersonMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); @Override Serializable execute(final PrincipalActionContext inActionContext); }
SetTabOrderExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabOrderRequest currentRequest = (SetTabOrderRequest) inActionContext.getParams(); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); List<Tab> tabs = person.getTabs(currentRequest.getTabType()); int oldIndex = findTabIndex(tabs, currentRequest.getTabId()); Tab movingTab = tabs.get(oldIndex); tabs.remove(oldIndex); tabs.add(currentRequest.getNewIndex(), movingTab); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); personMapper.flush(); return Boolean.TRUE; } SetTabOrderExecution(final PersonMapper inPersonMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); @Override Serializable execute(final PrincipalActionContext inActionContext);  }