private List<? extends MenuItem> getHomeViews(
      final Boolean socialEnabled, final boolean usersSystemActive) {
    final AbstractWorkbenchPerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();
    final List<MenuItem> result = new ArrayList<MenuItem>(1);

    result.add(
        MenuFactory.newSimpleItem(constants.homePage())
            .place(new DefaultPlaceRequest(defaultPerspective.getIdentifier()))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    // Social menu items.
    if (socialEnabled) {
      result.add(
          MenuFactory.newSimpleItem(constants.timeline())
              .place(new DefaultPlaceRequest("SocialHomePagePerspective"))
              .endMenu()
              .build()
              .getItems()
              .get(0));

      result.add(
          MenuFactory.newSimpleItem(constants.people())
              .place(new DefaultPlaceRequest("UserHomePagePerspective"))
              .endMenu()
              .build()
              .getItems()
              .get(0));
    }

    // User management menu items (only if services are active and constrained to admin roles).
    if (usersSystemActive) {
      result.add(
          MenuFactory.newSimpleItem(constants.userManagement())
              .withRoles(kieACL.getGrantedRoles(F_ADMINISTRATION))
              .place(new DefaultPlaceRequest("UsersManagementPerspective"))
              .endMenu()
              .build()
              .getItems()
              .get(0));
      result.add(
          MenuFactory.newSimpleItem(constants.groupManagement())
              .withRoles(kieACL.getGrantedRoles(F_ADMINISTRATION))
              .place(new DefaultPlaceRequest("GroupsManagementPerspective"))
              .endMenu()
              .build()
              .getItems()
              .get(0));
    }

    return result;
  }
  @Override
  protected void setupMenu() {

    final AbstractWorkbenchPerspectiveActivity defaultPerspective =
        menusHelper.getDefaultPerspectiveActivity();
    final Menus menus =
        MenuFactory.newTopLevelMenu(constants.Home())
            .place(new DefaultPlaceRequest(defaultPerspective.getIdentifier()))
            .endMenu()
            .newTopLevelMenu(constants.Authoring())
            .withItems(getAuthoringViews())
            .endMenu()
            .newTopLevelMenu(constants.Deploy())
            .withItems(getDeploymentViews())
            .endMenu()
            .newTopLevelMenu(constants.Case_Management())
            .withItems(getCaseManagementViews())
            .endMenu()
            .newTopLevelMenu(constants.Process_Management())
            .withItems(getProcessManagementViews())
            .endMenu()
            .newTopLevelMenu(constants.Work())
            .withItems(getWorkViews())
            .endMenu()
            .newTopLevelMenu(constants.Dashboards())
            .withItems(getDashboardsViews())
            .endMenu()
            .newTopLevelMenu(constants.Extensions())
            .withItems(menusHelper.getExtensionsViews())
            .endMenu()
            .newTopLevelMenu(constants.Experimental())
            .withItems(getExperimentalViews())
            .endMenu()
            .newTopLevelCustomMenu(iocManager.lookupBean(SearchMenuBuilder.class).getInstance())
            .endMenu()
            .build();

    menuBar.addMenus(menus);

    menusHelper.addRolesMenuItems();
    menusHelper.addGroupsMenuItems();
    menusHelper.addWorkbenchConfigurationMenuItem();
    menusHelper.addUtilitiesMenuItems();
  }
 private AbstractWorkbenchPerspectiveActivity getDefaultPerspectiveActivity() {
   AbstractWorkbenchPerspectiveActivity defaultPerspective = null;
   final Collection<IOCBeanDef<AbstractWorkbenchPerspectiveActivity>> perspectives =
       iocManager.lookupBeans(AbstractWorkbenchPerspectiveActivity.class);
   final Iterator<IOCBeanDef<AbstractWorkbenchPerspectiveActivity>> perspectivesIterator =
       perspectives.iterator();
   outer_loop:
   while (perspectivesIterator.hasNext()) {
     final IOCBeanDef<AbstractWorkbenchPerspectiveActivity> perspective =
         perspectivesIterator.next();
     final AbstractWorkbenchPerspectiveActivity instance = perspective.getInstance();
     if (instance.isDefault()) {
       defaultPerspective = instance;
       break outer_loop;
     } else {
       iocManager.destroyBean(instance);
     }
   }
   return defaultPerspective;
 }