@Test public void testDeletingTabRemovesFromCollection() throws TabDeletionException { TabGroup tabGroup = jpaTabGroupMapper.findById(fordsStartPageId); Tab fordTab1 = jpaTabMapper.findById(fordsFirstTabId); jpaTabGroupMapper.deleteTab(fordTab1); jpaTabGroupMapper.flush(); getEntityManager().clear(); tabGroup = jpaTabGroupMapper.findById(fordsStartPageId); assertEquals("Expected 2 tabs after deleting the first one.", 2, tabGroup.getTabs().size()); assertEquals("Expected the previously second tab to be the first now after deleting the first one.", fordsSecondTabId, tabGroup.getTabs().get(0).getId()); }
public void deleteTab(final Tab tab) throws TabDeletionException { logger.debug("Attempting to delete the tab with id=" + tab.getId()); TabGroup tabGroup = null; try { tabGroup = getTabGroupByTabId(tab.getId(), false); } catch (Exception ex) { throw new TabDeletionException("Could not find either the specified Tab or TabGroup", ex, tab); } if (tabGroup.getTabs().size() > 1) { tabGroup.getTabs().remove(tab); } markTabAsDeleted(tabGroup, tab); cleanUpDeletedTabs(); }
TabGroupMapper extends DomainEntityMapper<TabGroup> { public void deleteTab(final Tab tab) throws TabDeletionException { logger.debug("Attempting to delete the tab with id=" + tab.getId()); TabGroup tabGroup = null; try { tabGroup = getTabGroupByTabId(tab.getId(), false); } catch (Exception ex) { throw new TabDeletionException("Could not find either the specified Tab or TabGroup", ex, tab); } if (tabGroup.getTabs().size() > 1) { tabGroup.getTabs().remove(tab); } markTabAsDeleted(tabGroup, tab); cleanUpDeletedTabs(); } }
TabGroupMapper extends DomainEntityMapper<TabGroup> { public void deleteTab(final Tab tab) throws TabDeletionException { logger.debug("Attempting to delete the tab with id=" + tab.getId()); TabGroup tabGroup = null; try { tabGroup = getTabGroupByTabId(tab.getId(), false); } catch (Exception ex) { throw new TabDeletionException("Could not find either the specified Tab or TabGroup", ex, tab); } if (tabGroup.getTabs().size() > 1) { tabGroup.getTabs().remove(tab); } markTabAsDeleted(tabGroup, tab); cleanUpDeletedTabs(); } TabGroupMapper(final QueryOptimizer inQueryOptimizer); }
TabGroupMapper extends DomainEntityMapper<TabGroup> { public void deleteTab(final Tab tab) throws TabDeletionException { logger.debug("Attempting to delete the tab with id=" + tab.getId()); TabGroup tabGroup = null; try { tabGroup = getTabGroupByTabId(tab.getId(), false); } catch (Exception ex) { throw new TabDeletionException("Could not find either the specified Tab or TabGroup", ex, tab); } if (tabGroup.getTabs().size() > 1) { tabGroup.getTabs().remove(tab); } markTabAsDeleted(tabGroup, tab); cleanUpDeletedTabs(); } TabGroupMapper(final QueryOptimizer inQueryOptimizer); void setUndeleteTabWindowInMinutes(final int undeleteWindowInMinutes); void deleteTab(final Tab tab); Tab undeleteTab(final long tabId); TabGroup getTabGroupByTabId(final long tabId, final boolean isDeleted); long getTabCountForTemplate(final TabTemplate template); }
TabGroupMapper extends DomainEntityMapper<TabGroup> { public void deleteTab(final Tab tab) throws TabDeletionException { logger.debug("Attempting to delete the tab with id=" + tab.getId()); TabGroup tabGroup = null; try { tabGroup = getTabGroupByTabId(tab.getId(), false); } catch (Exception ex) { throw new TabDeletionException("Could not find either the specified Tab or TabGroup", ex, tab); } if (tabGroup.getTabs().size() > 1) { tabGroup.getTabs().remove(tab); } markTabAsDeleted(tabGroup, tab); cleanUpDeletedTabs(); } TabGroupMapper(final QueryOptimizer inQueryOptimizer); void setUndeleteTabWindowInMinutes(final int undeleteWindowInMinutes); void deleteTab(final Tab tab); Tab undeleteTab(final long tabId); TabGroup getTabGroupByTabId(final long tabId, final boolean isDeleted); long getTabCountForTemplate(final TabTemplate template);  }