Examples of TabGroup


Examples of org.eurekastreams.server.domain.TabGroup

     *             thrown on error during tab deletion.
     */
    @Test
    public void testDeletedRecordRemainsAvailableinDBForUndelete() throws TabDeletionException
    {
        TabGroup fordsTabGroup = jpaTabGroupMapper.findById(fordsStartPageId);
        Tab fordTab1 = jpaTabMapper.findById(fordsFirstTabId);

        long pageId = fordsTabGroup.getId();
        long tabId = fordTab1.getId();
        int tabIndex = fordTab1.getTabIndex();

        // delete the first tab
        jpaTabGroupMapper.deleteTab(fordTab1);
View Full Code Here

Examples of org.eurekastreams.server.domain.TabGroup

     *             thrown on error during tab deletion.
     */
    @Test
    public void testDeletingTabRemovesFromCollection() throws TabDeletionException
    {
        TabGroup tabGroup = jpaTabGroupMapper.findById(fordsStartPageId);
        Tab fordTab1 = jpaTabMapper.findById(fordsFirstTabId);

        // delete the first tab
        jpaTabGroupMapper.deleteTab(fordTab1);
        jpaTabGroupMapper.flush();

        // clear the entityManager so we can re-query the collection
        getEntityManager().clear();

        // re-get and assert
        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());
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.TabGroup

     * Test deleting a tab, then undeleting it.
     */
    @Test
    public void testDeleteThenUndelete()
    {
        TabGroup tabGroup = jpaTabGroupMapper.findById(fordsStartPageId);
        Tab fordTab2 = jpaTabMapper.findById(fordsSecondTabId);

        final int expectedTabCountAfterDeletingAndUndeleting = 3;

        // delete the first tab
        try
        {
            jpaTabGroupMapper.deleteTab(fordTab2);
        }
        catch (TabDeletionException e)
        {
            throw new RuntimeException(e);
        }
        jpaTabGroupMapper.flush();

        // clear the entityManager so we can re-query the collection
        getEntityManager().clear();

        try
        {
            jpaTabGroupMapper.undeleteTab(fordsSecondTabId);
        }
        catch (TabUndeletionException e)
        {
            log.error(e);
        }
        jpaTabGroupMapper.flush();

        // clear the entityManager so we can re-query the collection
        getEntityManager().clear();

        // re-get and assert
        tabGroup = jpaTabGroupMapper.findById(fordsStartPageId);
        assertEquals("Expected 3 tabs in Ford's startPage after deleting and undeleting.",
                expectedTabCountAfterDeletingAndUndeleting, tabGroup.getTabs().size());

        assertEquals(
                "Expected the previously 1st tab to still be 1st after deleting and undeleting the original second tab",
                fordsFirstTabId, tabGroup.getTabs().get(0).getId());

        assertEquals("Expected the original 2nd tab to 2nd again after deleting and undeleting it", fordsSecondTabId,
                tabGroup.getTabs().get(1).getId());

        assertEquals("Expected the previously 2nd tab to be 3rd after deleting and undeleting the original second tab",
                fordsThirdTabId, tabGroup.getTabs().get(2).getId());
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.TabGroup

    public void testUndeleteTabRestoresTabToItsOriginalPosition() throws TabUndeletionException
    {
        final int expectedTabCountBeforeUndelete = 3;

        // undelete the previously deleted tab
        TabGroup tabGroup = jpaTabGroupMapper.findById(fordsStartPageId);
        assertEquals("Expected 3 tabs in Ford's first tabGroup before undeleting the previously-deleted tab.",
                expectedTabCountBeforeUndelete, tabGroup.getTabs().size());

        jpaTabGroupMapper.undeleteTab(fordsDeletedTabId);
        jpaTabGroupMapper.flush();

        // clear the getEntityManager()'s cache so we're going back to the
        // databGroupase.
        tabGroup = jpaTabGroupMapper.findById(fordsStartPageId);
        assertEquals("Expected 4 tabs in Ford's third tabGroup after undeleting the previously-deleted tab.",
                expectedTabCountBeforeUndelete + 1, tabGroup.getTabs().size());

        assertEquals(
                "Expected the previously 1st tab to still be 1st after deleting and undeleting the original 2nd tab",
                fordsFirstTabId, tabGroup.getTabs().get(0).getId());

        assertEquals("Expected the undeleted original 2nd tab to be 2nd again.", fordsDeletedTabId, tabGroup.getTabs()
                .get(1).getId());

        assertEquals("Expected the previously 2nd tab to be 3rd after deleting and undeleting the original 2nd tab",
                fordsSecondTabId, tabGroup.getTabs().get(2).getId());

        assertEquals("Expected the previously 3rd tab to be 4th after deleting and undeleting the original 2nd tab",
                fordsThirdTabId, tabGroup.getTabs().get(3).getId());
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.TabGroup

     * tabIndex is set to the last index.
     */
    @Test
    public void testAddTabSetsTabIndexToLast()
    {
        TabGroup tabGroup = jpaTabGroupMapper.findById(fordsStartPageId);
        Tab tab = new Tab("FooBar", Layout.THREECOLUMN);

        tabGroup.getTabs().add(tab);

        jpaTabGroupMapper.flush();
        jpaTabGroupMapper.clear();

        int expectedIndex = tabGroup.getTabs().size() - 1;
        long tabId = tab.getId();

        tab = jpaTabMapper.findById(tabId);

        assertEquals("Expected tabIndex to be tabs.size()-1 when adding a tab to a tabGroup, after flush()",
View Full Code Here

Examples of org.eurekastreams.server.domain.TabGroup

    public void deleteTab(final Tab tab) throws TabDeletionException
    {
        logger.debug("Attempting to delete the tab with id=" + tab.getId());

        // make sure the tab exists in the input TabGroup
        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);
        }

        // remove the tab from the collection to rearrange the tabIndexes of the
        // other tabs
        if (tabGroup.getTabs().size() > 1)
        {
            tabGroup.getTabs().remove(tab);
        }

        // mark it as deleted, and re-attach it to the tabGroup, because the
        // previous statement detatched it.
        markTabAsDeleted(tabGroup, tab);
View Full Code Here

Examples of org.eurekastreams.server.domain.TabGroup

     */

    public Tab undeleteTab(final long tabId) throws TabUndeletionException
    {
        // make sure the Tab exists in the input tabGroup
        TabGroup tabGroup = null;
        long start;
        try
        {
            start = System.currentTimeMillis();
            logger.debug("***Getting tab group by tab Id");
            tabGroup = getTabGroupByTabId(tabId, true);
            logger.debug("***Done getting tab group by tab Id (" + (System.currentTimeMillis() - start) + "ms");
        }
        catch (Exception ex)
        {
            throw new TabUndeletionException("Could not find either the specified Tab or tabGroup for TabId=" + tabId,
                    tabId);
        }

        start = System.currentTimeMillis();
        logger.debug("***Getting tab to undelete by tab Id and status");
        /* get the deleted Tab from the tab group */
        Tab tabToUndelete = (Tab) getEntityManager().createQuery("from Tab where id = :TabId and deleted = true")
                .setParameter("TabId", tabId).getSingleResult();
        logger.debug("***Done Getting tab to undelete by tab Id and status (" + (System.currentTimeMillis() - start)
                + "ms");

        if (tabToUndelete == null)
        {
            throw new TabUndeletionException("Failure when trying to get Tab with id=" + tabId, tabId);
        }

        try
        {
            /*
             * re-insert the undeleted tab into the collection
             */
            tabGroup.getTabs().add(tabToUndelete.getTabIndex(), tabToUndelete);

            /* update the status of the undeleted Tab in the database */
            start = System.currentTimeMillis();
            logger.debug("***Update tab status");
            getEntityManager()
                    .createQuery(
                            "update versioned Tab set deleted = false, "
                                    + "dateDeleted = null, tabGroupId = :tabGroupId " + "where id = :TabId")
                    .setParameter("TabId", tabToUndelete.getId()).setParameter("tabGroupId", tabGroup.getId())
                    .executeUpdate();
            logger.debug("***Done Update tab status (" + (System.currentTimeMillis() - start) + "ms)");

            logger.debug("Un-deleted the tab with id=" + tabToUndelete.getId());

View Full Code Here

Examples of org.eurekastreams.server.domain.TabGroup

            displayNameSuffix = "";
        }
        person.setDisplayNameSuffix(displayNameSuffix);

        // create and add start page tabs
        TabGroup startTabGroup = new TabGroup();

        PersonPropertiesResponse properties = personPropertiesGenerator.getPersonProperties(inFields);

        for (TabTemplate tt : properties.getTabTemplates())
        {
            for (Gadget gadget : tt.getGadgets())
            {
                gadget.setOwner(person);
            }
            startTabGroup.addTab(new Tab(tt));
        }

        person.setStartTabGroup(startTabGroup);
        person.setTheme(properties.getTheme());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.