Class JCRNodeFinder

  • All Implemented Interfaces:
    NodeFinder

    public class JCRNodeFinder
    extends Object
    implements NodeFinder
    Created by The eXo Platform SAS.
    Version:
    $Id: JCRNodeFinder.java 00000 Feb 26, 2013 pnedonosko $
    Author:
    Peter Nedonosko
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator
      The hierarchy creator.
      protected org.exoplatform.services.jcr.RepositoryService jcrService
      The jcr service.
      protected org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService
      The session provider service.
    • Constructor Summary

      Constructors 
      Constructor Description
      JCRNodeFinder​(org.exoplatform.services.jcr.RepositoryService jcrService, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator)
      Instantiates a new JCR node finder.
    • Field Detail

      • jcrService

        protected final org.exoplatform.services.jcr.RepositoryService jcrService
        The jcr service.
      • sessionProviderService

        protected final org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService
        The session provider service.
      • hierarchyCreator

        protected final org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator
        The hierarchy creator.
    • Constructor Detail

      • JCRNodeFinder

        public JCRNodeFinder​(org.exoplatform.services.jcr.RepositoryService jcrService,
                             org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService,
                             org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator)
        Instantiates a new JCR node finder.
        Parameters:
        jcrService - the jcr service
        sessionProviderService - the session provider service
        hierarchyCreator - the hierarchy creator
    • Method Detail

      • getItem

        public javax.jcr.Item getItem​(javax.jcr.Session userSession,
                                      String path,
                                      boolean symlinkTarget)
                               throws javax.jcr.PathNotFoundException,
                                      javax.jcr.RepositoryException
        Return JCR item by given path.
        Specified by:
        getItem in interface NodeFinder
        Parameters:
        userSession - Session
        path - String
        symlinkTarget - boolean, if true and found item is a symlink node, return the symlink target node, if false just return the item obtained from the session
        Returns:
        the item
        Throws:
        javax.jcr.PathNotFoundException - if item not found by given path
        javax.jcr.RepositoryException - if repository error eccurs
      • findItem

        public javax.jcr.Item findItem​(javax.jcr.Session userSession,
                                       String path)
                                throws javax.jcr.PathNotFoundException,
                                       javax.jcr.RepositoryException
        Find JCR item by given path, if the path points to a symlink this method return a target node of the link.
        Specified by:
        findItem in interface NodeFinder
        Parameters:
        userSession - Session
        path - String
        Returns:
        the item
        Throws:
        javax.jcr.PathNotFoundException - if item not found by given path
        javax.jcr.RepositoryException - if repository error eccurs
      • findLinked

        public Collection<javax.jcr.Node> findLinked​(javax.jcr.Session session,
                                                     String uuid)
                                              throws javax.jcr.PathNotFoundException,
                                                     javax.jcr.RepositoryException
        Find nodes linked to given node.
        Specified by:
        findLinked in interface NodeFinder
        Parameters:
        session - the session
        uuid - String
        Returns:
        Collection of nodes
        Throws:
        javax.jcr.PathNotFoundException - the path not found exception
        javax.jcr.RepositoryException - the repository exception
      • cleanName

        public String cleanName​(String name)
        Align given name to current repository conventions by removing or escaping forbidden characters.
        Specified by:
        cleanName in interface NodeFinder
        Parameters:
        name - String
        Returns:
        String cleaned name
      • getUserNode

        public javax.jcr.Node getUserNode​(String userName)
                                   throws Exception
        Return user home node of given user.
        Specified by:
        getUserNode in interface NodeFinder
        Parameters:
        userName - String with user name in organization
        Returns:
        Node user home node
        Throws:
        Exception - the exception