private List<? extends MenuItem> getExtensionsViews() {
   final List<MenuItem> result = new ArrayList<MenuItem>(2);
   result.add(
       MenuFactory.newSimpleItem(constants.PlugIns())
           .withRoles(kieACL.getGrantedRoles(F_PLUGIN_MANAGEMENT))
           .place(new DefaultPlaceRequest("PlugInAuthoringPerspective"))
           .endMenu()
           .build()
           .getItems()
           .get(0));
   result.add(
       MenuFactory.newSimpleItem(constants.Apps())
           .withRoles(kieACL.getGrantedRoles(F_APPS))
           .place(new DefaultPlaceRequest("AppsPerspective"))
           .endMenu()
           .build()
           .getItems()
           .get(0));
   result.add(
       MenuFactory.newSimpleItem(constants.DataSets())
           .withRoles(kieACL.getGrantedRoles(F_DATASETS))
           .place(new DefaultPlaceRequest("DataSetAuthoringPerspective"))
           .endMenu()
           .build()
           .getItems()
           .get(0));
   return result;
 }
  private List<? extends MenuItem> getDashboardViews() {
    final List<MenuItem> result = new ArrayList<MenuItem>(1);
    result.add(
        MenuFactory.newSimpleItem(constants.Process_Dashboard())
            .withRoles(kieACL.getGrantedRoles(F_PROCESS_DASHBOARD))
            .place(new DefaultPlaceRequest("DashboardPerspective"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    final String dashbuilderURL =
        DashboardURLBuilder.getDashboardURL(
            "/dashbuilder/workspace", "showcase", LocaleInfo.getCurrentLocale().getLocaleName());
    result.add(
        MenuFactory.newSimpleItem(constants.Business_Dashboard())
            .withRoles(kieACL.getGrantedRoles(F_DASHBOARD_BUILDER))
            .respondsWith(
                new Command() {
                  @Override
                  public void execute() {
                    Window.open(dashbuilderURL, "_blank", "");
                  }
                })
            .endMenu()
            .build()
            .getItems()
            .get(0));

    return result;
  }
  private List<? extends MenuItem> getDeploymentViews() {
    final List<MenuItem> result = new ArrayList<MenuItem>(3);

    result.add(
        MenuFactory.newSimpleItem(constants.Process_Deployments())
            .withRoles(kieACL.getGrantedRoles(F_DEPLOYMENTS))
            .place(new DefaultPlaceRequest("Deployments"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    result.add(
        MenuFactory.newSimpleItem(constants.Rule_Deployments())
            .withRoles(kieACL.getGrantedRoles(F_MANAGEMENT))
            .place(new DefaultPlaceRequest("ServerManagementPerspective"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    result.add(
        MenuFactory.newSimpleItem(constants.Jobs())
            .withRoles(kieACL.getGrantedRoles(F_JOBS))
            .place(new DefaultPlaceRequest("Jobs"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    return result;
  }
  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.Home_Page())
            .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;
  }
 private List<Menus> getRoles() {
   final List<Menus> result = new ArrayList<Menus>(identity.getRoles().size());
   result.add(
       MenuFactory.newSimpleItem(constants.LogOut())
           .respondsWith(new LogoutCommand())
           .endMenu()
           .build());
   for (final Role role : identity.getRoles()) {
     if (!role.getName().equals("IS_REMEMBER_ME")) {
       result.add(
           MenuFactory.newSimpleItem(constants.Role() + ": " + role.getName()).endMenu().build());
     }
   }
   return result;
 }
  private List<? extends MenuItem> getAuthoringViews() {
    final List<MenuItem> result = new ArrayList<MenuItem>(4);

    result.add(
        MenuFactory.newSimpleItem(constants.Project_Authoring())
            .withRoles(kieACL.getGrantedRoles(F_PROJECT_AUTHORING))
            .place(new DefaultPlaceRequest("AuthoringPerspective"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    result.add(
        MenuFactory.newSimpleItem(constants.Contributors())
            .withRoles(kieACL.getGrantedRoles(F_CONTRIBUTORS))
            .place(new DefaultPlaceRequest("ContributorsPerspective"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    result.add(
        MenuFactory.newSimpleItem(constants.artifactRepository())
            .withRoles(kieACL.getGrantedRoles(F_ARTIFACT_REPO))
            .place(
                new DefaultPlaceRequest(
                    "org.guvnor.m2repo.client.perspectives.GuvnorM2RepoPerspective"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    result.add(
        MenuFactory.newSimpleItem(constants.Administration())
            .withRoles(kieACL.getGrantedRoles(F_ADMINISTRATION))
            .place(new DefaultPlaceRequest("AdministrationPerspective"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    return result;
  }
 @WorkbenchMenu
 public Menus getMenus() {
   return MenuFactory.newTopLevelMenu(constants.MenuOrganizationalUnits())
       .withPermission(OrganizationalUnit.RESOURCE_TYPE, OrganizationalUnitAction.READ)
       .menus()
       .menu(constants.MenuManageOrganizationalUnits())
       .respondsWith(
           () ->
               placeManager.goTo(
                   "org.kie.workbench.common.screens.organizationalunit.manager.OrganizationalUnitManager"))
       .endMenu()
       .endMenus()
       .endMenu()
       .newTopLevelMenu(constants.repositories())
       .menus()
       .menu(constants.listRepositories())
       .withPermission(Repository.RESOURCE_TYPE, RepositoryAction.READ)
       .respondsWith(() -> placeManager.goTo("RepositoriesEditor"))
       .endMenu()
       .menu(constants.cloneRepository())
       .withPermission(Repository.RESOURCE_TYPE, RepositoryAction.READ)
       .respondsWith(cloneRepoCommand)
       .endMenu()
       .menu(constants.newRepository())
       .withPermission(Repository.RESOURCE_TYPE, RepositoryAction.CREATE)
       .respondsWith(newRepoCommand)
       .endMenu()
       .endMenus()
       .endMenu()
       .build();
 }
  private List<? extends MenuItem> getProcessMGMTViews() {
    final List<MenuItem> result = new ArrayList<MenuItem>(2);

    result.add(
        MenuFactory.newSimpleItem(constants.Process_Definitions())
            .withRoles(kieACL.getGrantedRoles(F_PROCESS_DEFINITIONS))
            .place(new DefaultPlaceRequest("Process Definitions"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    result.add(
        MenuFactory.newSimpleItem(constants.Process_Instances())
            .withRoles(kieACL.getGrantedRoles(F_PROCESS_INSTANCES))
            .place(new DefaultPlaceRequest("DataSet Process Instances With Variables"))
            .endMenu()
            .build()
            .getItems()
            .get(0));

    return result;
  }
  @Perspective
  public PerspectiveDefinition getPerspective() {
    final PerspectiveDefinition perspective =
        new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());
    perspective.setName(constants.Administration());

    perspective
        .getRoot()
        .addPart(new PartDefinitionImpl(new DefaultPlaceRequest("RepositoriesEditor")));

    final PanelDefinition west =
        new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());
    west.setWidth(300);
    west.setMinWidth(200);
    west.addPart(new PartDefinitionImpl(new DefaultPlaceRequest("FileExplorer")));

    perspective.getRoot().insertChild(CompassPosition.WEST, west);

    return perspective;
  }