Package com.castronu.joomlajavaapi.domain

Examples of com.castronu.joomlajavaapi.domain.Menu


        List<Menu> menuWithThisPath = getMenuWithThisPath(path);
        if (menuWithThisPath.size()!=0) {
            throw new GenericErrorException("There is already a menu with this path " + path);
        }
        int parentId = computeParentId(path);
        Menu menu = MenuBuilder.aMenuCategory(title, alias, path, categoryId, parentId);
        getHibernateTemplate().save(menu);
        LOGGER.info("Menu "+ path + " created");
    }
View Full Code Here


        List<Menu> firstLevelMenus = getHibernateTemplate().findByCriteria(query);
        Integer counter = 1;
        counter = rebuildBranch(firstLevelMenus, counter);
        //Get the ROOT
        List<Menu> menuFromId = getMenuWithThisPath("");
        Menu rootMenu = menuFromId.get(0);
        rootMenu.setLft(0);
        rootMenu.setRgt(counter);
        persist(rootMenu);


    }
View Full Code Here

        }
    }

    public void createMenuArticle(String title,String alias,String path,int articleId,int categoryId){
        //TODO Parent ID
        Menu menu = MenuBuilder.aMenuArticle(title,alias, path, articleId,categoryId);
        getHibernateTemplate().save(menu);
        LOGGER.info("Menu for the article "+ path + " created");
    }
View Full Code Here

    @Before
    public void init() throws GenericErrorException {
        Category category = aCategoryWithPath("ROOT", "root", "", 0);
        categoryDao.save(category);
        Menu menu = aMenu("ROOTMenu","root","",0);
        menuDao.getHibernateTemplate().save(menu);

    }
View Full Code Here

    public void createCategoryAndMenuWithParents(){

        joomlaJavaApi.createCategoriesInCascadeWithMenu("Nord America/Colombia/Santa Marta");
        List<Menu> menuWithThisPath = menuDao.getMenuWithThisPath("nord-america/colombia/santa-marta");
        assertThat(menuWithThisPath.size(),is(1));
        Menu menu = menuWithThisPath.get(0);
        int parentId = menu.getParentId();
        menuWithThisPath = menuDao.getMenuWithThisPath("nord-america/colombia");
        assertThat(menuWithThisPath.size(),is(1));
        assertThat(menuWithThisPath.get(0).getId(),is(parentId));

View Full Code Here

        joomlaJavaApi.createMenuForCategory("Sud America/Colombia");
        joomlaJavaApi.createMenuForCategory("Sud America/Colombia/Santa Marta");

        List<Menu> menuWithThisPath = menuDao.getMenuWithThisPath(Converter.getPath(categoryPath));
        assertThat(menuWithThisPath.size(),is(1));
        Menu menu = menuWithThisPath.get(0);
        assertThat(menu.getTitle(),is("Santa Marta"));
        assertThat(menu.getAccess(),is(1));
        assertThat(menu.getAlias(),is("santa-marta"));

        menuWithThisPath = menuDao.getMenuWithThisPath("sud-america/colombia");
        int expectedParentId = menuWithThisPath.get(0).getId();
        int newExpectedParentId = menuWithThisPath.get(0).getParentId();
        assertThat(menu.getParentId(), is(expectedParentId));


        menuWithThisPath = menuDao.getMenuWithThisPath("sud-america");
        assertThat(menuWithThisPath.get(0).getId(),is(newExpectedParentId));
    }
View Full Code Here

public class MenuBuilder {
        private Menu menu;

        private MenuBuilder() {
            menu = new Menu();
        }
View Full Code Here

                        withLevel(level).withImg("img").
                withParentId(parentId).build();
    }

    public static Menu aMenuCategory(String title, String alias, String path, int categoryId, int parentId) {
        Menu menu = aMenu(title, alias, path, parentId);
        menu.setLink("index.php?option=com_content&view=category&id=" + categoryId);
        return menu;
    }
View Full Code Here

        menu.setLink("index.php?option=com_content&view=category&id=" + categoryId);
        return menu;
    }

    public static Menu aMenuArticle(String title, String alias,String path, int articleId, int parentId) {
        Menu menu = aMenu(title, alias, path, parentId);
        menu.setLink("index.php?option=com_content&view=article&id=" + articleId);
        return menu;


    }
View Full Code Here

TOP

Related Classes of com.castronu.joomlajavaapi.domain.Menu

Copyright © 2018 www.massapicom. 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.