Пример #1
0
 private String getWorkspaceName(Workspace workspace) {
   if (workspaceNameCache == null) {
     workspaceNameCache = new HashMap<String, String>();
   }
   String name = workspaceNameCache.get(workspace.getId());
   if (name == null) {
     for (Plugin p : getBrix().getPlugins()) {
       if (p.isPluginWorkspace(workspace)) {
         name = p.getUserVisibleName(workspace, false);
       }
       workspaceNameCache.put(workspace.getId(), name);
     }
   }
   return name;
 }
Пример #2
0
  private List<Workspace> getWorkspaces() {
    Brix brix = getBrix();
    List<Workspace> workspaces = new ArrayList<Workspace>();

    Workspace current = getModelObject();

    for (Plugin p : brix.getPlugins()) {
      List<Workspace> filtered =
          brix.filterVisibleWorkspaces(p.getWorkspaces(current, false), Context.ADMINISTRATION);
      for (Workspace w : filtered) {
        if (workspaceNameCache == null) {
          workspaceNameCache = new HashMap<String, String>();
        }
        workspaceNameCache.put(w.getId(), p.getUserVisibleName(w, false));
        workspaces.add(w);
      }
    }

    if (!workspaces.contains(current)) {
      workspaces.add(current);
    }
    return workspaces;
  }