@Test public void testUndeleteExpiration() throws TabDeletionException { long fordsActiveTabId = fordsFirstTabId; int resultCount = getEntityManager() .createQuery("select version from Tab where id = :tabId and deleted = true").setParameter("tabId", fordsDeletedTabId).getResultList().size(); assertEquals("Could not find the already-deleted Tab", 1, resultCount); jpaTabGroupMapper.deleteTab(jpaTabMapper.findById(fordsActiveTabId)); resultCount = getEntityManager().createQuery("select version from Tab where id = :tabId and deleted = true") .setParameter("tabId", fordsDeletedTabId).getResultList().size(); assertEquals( "After deleting a Tab, the Tab that was deleted a long time ago should have been permanently deleted.", 0, resultCount); }
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);  }