2 Replies Latest reply on Dec 24, 2012 3:44 AM by Nicolas Filotto

    How to access my own node directly using path

    Sunghun Park Newbie

      Hi all.

       

      I just started eXo portal development and looking into documentation. Exo is based on Gatein and it brought me here to ask a question.

       

      I created my own node type and content using it. I got the path of the coent in a view template and I want to get the node for my cotent and manipulate it.

       

      But I don't know how I can do that.

       

      My node's path is :

       

      /jcr:system/jcr:versionStorage/a770e7a50a1601724c76cbeb16e74c35/1/jcr:frozenNode

       

      I have tried like below but it did not work.

       

       

      import javax.jcr.Node;

      import javax.jcr.NodeIterator;

      import javax.jcr.Property;

      import javax.jcr.PropertyIterator;

      import javax.jcr.Session;

      import javax.jcr.Repository;

      import org.exoplatform.container.ExoContainer;

      import org.exoplatform.container.ExoContainerContext;

      import org.exoplatform.services.jcr.core.ManageableRepository;

      import org.exoplatform.services.jcr.RepositoryService;

       

      ExoContainer myContainer = ExoContainerContext.getCurrentContainer();

      RepositoryService repositoryService = (RepositoryService)myContainer.getComponentInstanceOfType(RepositoryService.class);

      Repository repository = repositoryService.getCurrentRepository();

       

      Session jcrSession = repository.login("system");   //I found this workspace from eXo IDE

       

      Node root = jcrSession.getRootNode();   

      root.getNode("jcr:versionStorage");  //jcr:system/jcr:versionStorage, /jcr:versionStorage and in many different way

       

       

      Can anyone help me? Thanks in advance.

        • 1. Re: How to access my own node directly using path
          Anh Vu Nguyen Newbie

          Hi Sunghun Park,

          Can you please show us the exception stack trace or any warning, error message you got?

           

          Or at least, can you please login to collaboration workspace and try to get your node again (repository.login("collaboration"))

          Hope it helps.

          Regards,

          Vu Nguyen

          1 of 1 people found this helpful
          • 2. Re: How to access my own node directly using path
            Nicolas Filotto Novice

            If you use node.getNode(String), the expected parameter is a relative path so in your case the path should be node.getNode("jcr:system/jcr:versionStorage/a770e7a50a1601724c76cbeb16e74c35/1/jcr:frozenNode"). If it doesn't work, I guess there is an access permission issue, did you try to access to this node with the root account? Did you try to access using CRaSH? Which product do you use exactly? and what is the version of the product?

            1 of 1 people found this helpful