コード例 #1
0
 @Override
 public boolean isVisible() {
   final Brix brix = Brix.get();
   final Workspace workspace = getWorkspaceModel().getObject();
   final Action action = new AccessWebDavUrlPluginAction(workspace);
   final boolean granted = brix.getAuthorizationStrategy().isActionAuthorized(action);
   return granted;
 }
コード例 #2
0
 public boolean canAddNodeChild(BrixNode node, Context context) {
   if (!isNodeEditable(node)) {
     return false;
   }
   Action action = new SiteNodeAction(context, Type.NODE_ADD_CHILD, node);
   return brix.getAuthorizationStrategy().isActionAuthorized(action);
 }
コード例 #3
0
 public boolean canRenameNode(BrixNode node, Context context) {
   if (!isNodeEditable(node)) {
     return false;
   }
   Action action = new SiteNodeAction(context, Type.NODE_DELETE, node);
   return brix.getAuthorizationStrategy().isActionAuthorized(action);
 }
コード例 #4
0
 protected void initializeExtensionPoints(Brix brix) {
   ExtensionPointRegistry registry = brix.getConfig().getRegistry();
   registry.register(RepositoryInitializer.POINT, new HierarchicalRepoInitializer());
   registry.register(JcrNodeWrapperFactory.POINT, TitledNode.FACTORY);
   registry.register(
       getManageNodeTabFactoryExtensionPoint(),
       new ManageFolderNodeTabFactory(getPluginLocator()));
 }
コード例 #5
0
  /**
   * Creates a uri path for the specified <code>node</code> By default this method uses {@link
   * BrixConfig#getMapper()} to map node path to a uri path.
   *
   * @param node node to create uri path for
   * @return uri path that represents the node
   */
  public Path getUriPathForNode(final BrixNode node) {
    // allow site plugin to translate jcr path into node path
    final String jcrPath = SitePlugin.get().fromRealWebNodePath(node.getPath());
    final Path nodePath = new Path(jcrPath);

    // use urimapper to create the uri
    return brix.getConfig().getMapper().getUriPathForNode(nodePath, brix);
  }
コード例 #6
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;
  }
コード例 #7
0
  public void initWorkspace(Workspace workspace, JcrSession workspaceSession) {
    JcrNode root = (JcrNode) workspaceSession.getItem(brix.getRootPath());
    JcrNode pluginRoot = null;
    if (root.hasNode(getRootNodeName())) {
      pluginRoot = root.getNode(getRootNodeName());
    } else {
      pluginRoot = root.addNode(getRootNodeName(), SimpleFolderNode.JCR_PRIMARY_TYPE);
    }

    if (pluginRoot != null) {
      if (!pluginRoot.isNodeType(BrixNode.JCR_TYPE_BRIX_NODE)) {
        pluginRoot.addMixin(BrixNode.JCR_TYPE_BRIX_NODE);
      }
    }
  }
コード例 #8
0
  /**
   * Resolves uri path to a {@link BrixNode}. By default this method uses {@link
   * BrixConfig#getMapper()} to map the uri to a node path.
   *
   * @param uriPath uri path
   * @return node that maps to the <code>uriPath</code> or <code>null</code> if none
   */
  public BrixNode getNodeForUriPath(final Path uriPath) {
    BrixNode node = null;

    // create desired nodepath
    final Path nodePath =
        brix.getConfig().getMapper().getNodePathForUriPath(uriPath.toAbsolute(), brix);

    if (nodePath != null) {
      // allow site plugin to translate the node path into an actual jcr
      // path
      final String jcrPath = SitePlugin.get().toRealWebNodePath(nodePath.toString());

      // retrieve jcr session
      final String workspace = getWorkspace();
      final JcrSession session = brix.getCurrentSession(workspace);

      if (session.itemExists(jcrPath)) {
        // node exists, return it
        node = (BrixNode) session.getItem(jcrPath);
      }
    }

    return node;
  }
コード例 #9
0
 private Brix getBrix() {
   return Brix.get();
 }
コード例 #10
0
 public Workspace getObject() {
   if (workspace == null && workspaceId != null) {
     workspace = Brix.get().getWorkspaceManager().getWorkspace(workspaceId);
   }
   return workspace;
 }
コード例 #11
0
 public boolean canViewNodeChildren(BrixNode node, Context context) {
   Action action = new SiteNodeAction(context, Type.NODE_VIEW_CHILDREN, node);
   return brix.getAuthorizationStrategy().isActionAuthorized(action);
 }
コード例 #12
0
 public String getRootNodePath() {
   return brix.getRootPath() + "/" + getRootNodeName();
 }
コード例 #13
0
 public Collection<? extends ManageNodeTabFactory> getManageNodeTabFactories() {
   return brix.getConfig().getRegistry().lookupCollection(getManageNodeTabFactoryExtensionPoint());
 }
コード例 #14
0
 public Collection<? extends NodeEditorPlugin> getNodeEditorPlugins() {
   return brix.getConfig().getRegistry().lookupCollection(getNodeEditorPluginExtensionPoint());
 }
コード例 #15
0
 private String getDefaultWorkspaceName() {
   final Workspace workspace =
       brix.getConfig().getMapper().getWorkspaceForRequest(RequestCycle.get(), brix);
   return (workspace != null) ? workspace.getId() : null;
 }
コード例 #16
0
 private boolean checkSession(String workspaceId) {
   return brix.getWorkspaceManager().workspaceExists(workspaceId);
 }