@Test public final void testExecuteGrow() throws Exception { final Layout newLayout = Layout.THREECOLUMNLEFTWIDEHEADER; context.checking(new Expectations() { { oneOf(tabMapper).findById(with(TAB_ID)); will(returnValue(tab)); oneOf(tab).getTabLayout(); will(returnValue(Layout.THREECOLUMN)); oneOf(tab).setTabLayout(newLayout); allowing(principalMock).getId(); will(returnValue(1L)); allowing(deleteCacheKeysMapper).execute(with(any(Set.class))); oneOf(tabMapper).flush(); oneOf(tabMapper).findById(with(TAB_ID)); will(returnValue(tab)); } }); SetTabLayoutRequest currentRequest = new SetTabLayoutRequest(newLayout, TAB_ID); ServiceActionContext currentContext = new ServiceActionContext(currentRequest, principalMock); sut.execute(currentContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabLayoutRequest currentRequest = (SetTabLayoutRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(currentRequest.getTabId()); Layout oldTabLayout = tab.getTabLayout(); tab.setTabLayout(currentRequest.getLayout()); tabMapper.flush(); if (oldTabLayout.getNumberOfZones() > currentRequest.getLayout().getNumberOfZones()) { updateMapper.execute(new UpdateGadgetsWithNewTabLayoutRequest(tab.getTemplate().getId(), currentRequest .getLayout())); } Tab updatedTab = tabMapper.findById(currentRequest.getTabId()); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return updatedTab; }
SetTabLayoutExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabLayoutRequest currentRequest = (SetTabLayoutRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(currentRequest.getTabId()); Layout oldTabLayout = tab.getTabLayout(); tab.setTabLayout(currentRequest.getLayout()); tabMapper.flush(); if (oldTabLayout.getNumberOfZones() > currentRequest.getLayout().getNumberOfZones()) { updateMapper.execute(new UpdateGadgetsWithNewTabLayoutRequest(tab.getTemplate().getId(), currentRequest .getLayout())); } Tab updatedTab = tabMapper.findById(currentRequest.getTabId()); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return updatedTab; } }
SetTabLayoutExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabLayoutRequest currentRequest = (SetTabLayoutRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(currentRequest.getTabId()); Layout oldTabLayout = tab.getTabLayout(); tab.setTabLayout(currentRequest.getLayout()); tabMapper.flush(); if (oldTabLayout.getNumberOfZones() > currentRequest.getLayout().getNumberOfZones()) { updateMapper.execute(new UpdateGadgetsWithNewTabLayoutRequest(tab.getTemplate().getId(), currentRequest .getLayout())); } Tab updatedTab = tabMapper.findById(currentRequest.getTabId()); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return updatedTab; } SetTabLayoutExecution(final TabMapper mapper, final UpdateGadgetsWithNewTabLayoutMapper inUpdateMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); }
SetTabLayoutExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabLayoutRequest currentRequest = (SetTabLayoutRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(currentRequest.getTabId()); Layout oldTabLayout = tab.getTabLayout(); tab.setTabLayout(currentRequest.getLayout()); tabMapper.flush(); if (oldTabLayout.getNumberOfZones() > currentRequest.getLayout().getNumberOfZones()) { updateMapper.execute(new UpdateGadgetsWithNewTabLayoutRequest(tab.getTemplate().getId(), currentRequest .getLayout())); } Tab updatedTab = tabMapper.findById(currentRequest.getTabId()); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return updatedTab; } SetTabLayoutExecution(final TabMapper mapper, final UpdateGadgetsWithNewTabLayoutMapper inUpdateMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); @Override Serializable execute(final PrincipalActionContext inActionContext); }
SetTabLayoutExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetTabLayoutRequest currentRequest = (SetTabLayoutRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(currentRequest.getTabId()); Layout oldTabLayout = tab.getTabLayout(); tab.setTabLayout(currentRequest.getLayout()); tabMapper.flush(); if (oldTabLayout.getNumberOfZones() > currentRequest.getLayout().getNumberOfZones()) { updateMapper.execute(new UpdateGadgetsWithNewTabLayoutRequest(tab.getTemplate().getId(), currentRequest .getLayout())); } Tab updatedTab = tabMapper.findById(currentRequest.getTabId()); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return updatedTab; } SetTabLayoutExecution(final TabMapper mapper, final UpdateGadgetsWithNewTabLayoutMapper inUpdateMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); @Override Serializable execute(final PrincipalActionContext inActionContext);  }