*
*/
@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();
// Call mapper to update gadgets for a shrinking layout.
if (oldTabLayout.getNumberOfZones() > currentRequest.getLayout().getNumberOfZones())
{
updateMapper.execute(new UpdateGadgetsWithNewTabLayoutRequest(tab.getTemplate().getId(), currentRequest
.getLayout()));
}
// Need to retrieve the updated tab and touch the gadgets to return to the caller.
Tab updatedTab = tabMapper.findById(currentRequest.getTabId());
deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID
+ inActionContext.getPrincipal().getId()));
return updatedTab;