Search in sources :

Example 1 with MenuItem

use of com.ableneo.liferay.portal.setup.domain.MenuItem in project liferay-db-setup-core by ableneo.

the class SetupMenus method createMenuItems.

private static void createMenuItems(long groupId, Menu newMenu, long userId, ServiceContext serviceContext, SiteNavigationMenu menu) {
    LOG.info("Adding menu-items for '" + menu.getName() + "'");
    long parentMenuId = menu.getPrimaryKey();
    long parentMenuItem = 0L;
    // List<SiteNavigationMenuItem> currentItems = SiteNavigationMenuItemLocalServiceUtil.getSiteNavigationMenuItems(parentMenuId);
    for (MenuItem newMenuItem : newMenu.getMenuItem()) {
        // getExistingFromList(newMenuItem, currentItems);
        SiteNavigationMenuItem menuItem = null;
        // if (menuItem == null) {
        menuItem = createMenuItem(groupId, userId, serviceContext, parentMenuId, parentMenuItem, newMenuItem);
        // }
        if (menuItem != null && false == newMenuItem.getMenuItem().isEmpty()) {
            createMenuItems(groupId, userId, serviceContext, menu, menuItem, newMenuItem);
        }
    }
}
Also used : SiteNavigationMenuItem(com.liferay.site.navigation.model.SiteNavigationMenuItem) MenuItem(com.ableneo.liferay.portal.setup.domain.MenuItem) SiteNavigationMenuItem(com.liferay.site.navigation.model.SiteNavigationMenuItem)

Example 2 with MenuItem

use of com.ableneo.liferay.portal.setup.domain.MenuItem in project liferay-db-setup-core by ableneo.

the class SetupMenus method createMenuItems.

private static void createMenuItems(long groupId, long userId, ServiceContext serviceContext, SiteNavigationMenu parentMenu, SiteNavigationMenuItem parentMenuItem, MenuItem addFromMenuItems) {
    String parentName = parentMenuItem.getName();
    LOG.info(" i creating sub-menu-items under '" + parentName + "'");
    long parentMenuId = parentMenu.getPrimaryKey();
    long parentMenuItemId = parentMenuItem.getPrimaryKey();
    // List<SiteNavigationMenuItem> currentItems = SiteNavigationMenuItemLocalServiceUtil.getSiteNavigationMenuItems(parentMenuId, parentMenuItemId);
    for (MenuItem newMenuItem : addFromMenuItems.getMenuItem()) {
        // SiteNavigationMenuItem menuItem = getExistingFromList(newMenuItem, currentItems);
        SiteNavigationMenuItem menuItem = null;
        // if (menuItem == null) {
        menuItem = createMenuItem(groupId, userId, serviceContext, parentMenuId, parentMenuItemId, newMenuItem);
        // }
        if (menuItem != null && false == newMenuItem.getMenuItem().isEmpty()) {
            createMenuItems(groupId, userId, serviceContext, parentMenu, menuItem, newMenuItem);
        }
    }
}
Also used : SiteNavigationMenuItem(com.liferay.site.navigation.model.SiteNavigationMenuItem) MenuItem(com.ableneo.liferay.portal.setup.domain.MenuItem) SiteNavigationMenuItem(com.liferay.site.navigation.model.SiteNavigationMenuItem)

Aggregations

MenuItem (com.ableneo.liferay.portal.setup.domain.MenuItem)2 SiteNavigationMenuItem (com.liferay.site.navigation.model.SiteNavigationMenuItem)2