Class JcrRepositoryFileUtils


  • public class JcrRepositoryFileUtils
    extends Object
    Class of static methods where the real JCR work takes place.
    Author:
    mlowery
    • Constructor Detail

      • JcrRepositoryFileUtils

        public JcrRepositoryFileUtils()
    • Method Detail

      • getFileById

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile getFileById​(javax.jcr.Session session,
                                                                                              PentahoJcrConstants pentahoJcrConstants,
                                                                                              IPathConversionHelper pathConversionHelper,
                                                                                              ILockHelper lockHelper,
                                                                                              Serializable fileId)
                                                                                       throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • nodeToFile

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile nodeToFile​(javax.jcr.Session session,
                                                                                             PentahoJcrConstants pentahoJcrConstants,
                                                                                             IPathConversionHelper pathConversionHelper,
                                                                                             ILockHelper lockHelper,
                                                                                             javax.jcr.Node node)
                                                                                      throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • nodeToFileOld

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile nodeToFileOld​(javax.jcr.Session session,
                                                                                                PentahoJcrConstants pentahoJcrConstants,
                                                                                                IPathConversionHelper pathConversionHelper,
                                                                                                ILockHelper lockHelper,
                                                                                                javax.jcr.Node node,
                                                                                                boolean loadMaps,
                                                                                                org.pentaho.platform.api.locale.IPentahoLocale pentahoLocale)
                                                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • nodeToFile

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile nodeToFile​(javax.jcr.Session session,
                                                                                             PentahoJcrConstants pentahoJcrConstants,
                                                                                             IPathConversionHelper pathConversionHelper,
                                                                                             ILockHelper lockHelper,
                                                                                             javax.jcr.Node node,
                                                                                             boolean loadMaps,
                                                                                             org.pentaho.platform.api.locale.IPentahoLocale pentahoLocale)
                                                                                      throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getLocalizedString

        public static String getLocalizedString​(javax.jcr.Session session,
                                                PentahoJcrConstants pentahoJcrConstants,
                                                javax.jcr.Node localizedStringNode,
                                                org.pentaho.platform.api.locale.IPentahoLocale pentahoLocale)
                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getLocalePropertiesMap

        public static Map<String,​Properties> getLocalePropertiesMap​(javax.jcr.Session session,
                                                                          PentahoJcrConstants pentahoJcrConstants,
                                                                          javax.jcr.Node localesNode)
                                                                   throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getAbsolutePath

        public static String getAbsolutePath​(javax.jcr.Session session,
                                             PentahoJcrConstants pentahoJcrConstants,
                                             javax.jcr.Node node)
                                      throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getNodeId

        public static Serializable getNodeId​(javax.jcr.Session session,
                                             PentahoJcrConstants pentahoJcrConstants,
                                             javax.jcr.Node node)
                                      throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getNodeName

        public static String getNodeName​(javax.jcr.Session session,
                                         PentahoJcrConstants pentahoJcrConstants,
                                         javax.jcr.Node node)
                                  throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getVersionId

        public static String getVersionId​(javax.jcr.Session session,
                                          PentahoJcrConstants pentahoJcrConstants,
                                          javax.jcr.Node node)
                                   throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • createFolderNode

        public static javax.jcr.Node createFolderNode​(javax.jcr.Session session,
                                                      PentahoJcrConstants pentahoJcrConstants,
                                                      Serializable parentFolderId,
                                                      org.pentaho.platform.api.repository2.unified.RepositoryFile folder)
                                               throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • createFileNode

        public static javax.jcr.Node createFileNode​(javax.jcr.Session session,
                                                    PentahoJcrConstants pentahoJcrConstants,
                                                    Serializable parentFolderId,
                                                    org.pentaho.platform.api.repository2.unified.RepositoryFile file,
                                                    org.pentaho.platform.api.repository2.unified.IRepositoryFileData content,
                                                    ITransformer<org.pentaho.platform.api.repository2.unified.IRepositoryFileData> transformer)
                                             throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • updateFileNode

        public static javax.jcr.Node updateFileNode​(javax.jcr.Session session,
                                                    PentahoJcrConstants pentahoJcrConstants,
                                                    org.pentaho.platform.api.repository2.unified.RepositoryFile file,
                                                    org.pentaho.platform.api.repository2.unified.IRepositoryFileData content,
                                                    ITransformer<org.pentaho.platform.api.repository2.unified.IRepositoryFileData> transformer)
                                             throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • updateFolderNode

        public static javax.jcr.Node updateFolderNode​(javax.jcr.Session session,
                                                      PentahoJcrConstants pentahoJcrConstants,
                                                      org.pentaho.platform.api.repository2.unified.RepositoryFile folder)
                                               throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getContent

        public static org.pentaho.platform.api.repository2.unified.IRepositoryFileData getContent​(javax.jcr.Session session,
                                                                                                  PentahoJcrConstants pentahoJcrConstants,
                                                                                                  Serializable fileId,
                                                                                                  Serializable versionId,
                                                                                                  ITransformer<org.pentaho.platform.api.repository2.unified.IRepositoryFileData> transformer)
                                                                                           throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getChildren

        public static List<org.pentaho.platform.api.repository2.unified.RepositoryFile> getChildren​(javax.jcr.Session session,
                                                                                                    PentahoJcrConstants pentahoJcrConstants,
                                                                                                    IPathConversionHelper pathConversionHelper,
                                                                                                    ILockHelper lockHelper,
                                                                                                    org.pentaho.platform.api.repository2.unified.RepositoryRequest repositoryRequest)
                                                                                             throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • isPentahoFolder

        public static boolean isPentahoFolder​(PentahoJcrConstants pentahoJcrConstants,
                                              javax.jcr.Node node)
                                       throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • isPentahoHierarchyNode

        public static boolean isPentahoHierarchyNode​(javax.jcr.Session session,
                                                     PentahoJcrConstants pentahoJcrConstants,
                                                     javax.jcr.Node node)
                                              throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • isLocked

        public static boolean isLocked​(PentahoJcrConstants pentahoJcrConstants,
                                       javax.jcr.Node node)
                                throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • isPentahoFile

        public static boolean isPentahoFile​(PentahoJcrConstants pentahoJcrConstants,
                                            javax.jcr.Node node)
                                     throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • isVersioned

        public static boolean isVersioned​(javax.jcr.Session session,
                                          PentahoJcrConstants pentahoJcrConstants,
                                          javax.jcr.Node node)
                                   throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • isSupportedNodeType

        public static boolean isSupportedNodeType​(PentahoJcrConstants pentahoJcrConstants,
                                                  javax.jcr.Node node)
                                           throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • checkoutNearestVersionableFileIfNecessary

        public static void checkoutNearestVersionableFileIfNecessary​(javax.jcr.Session session,
                                                                     PentahoJcrConstants pentahoJcrConstants,
                                                                     Serializable fileId)
                                                              throws javax.jcr.RepositoryException
        Conditionally checks out node representing file if node is versionable.
        Throws:
        javax.jcr.RepositoryException
      • checkoutNearestVersionableNodeIfNecessary

        public static void checkoutNearestVersionableNodeIfNecessary​(javax.jcr.Session session,
                                                                     PentahoJcrConstants pentahoJcrConstants,
                                                                     javax.jcr.Node node)
                                                              throws javax.jcr.RepositoryException
        Conditionally checks out node if node is versionable.
        Throws:
        javax.jcr.RepositoryException
      • checkinNearestVersionableFileIfNecessary

        public static void checkinNearestVersionableFileIfNecessary​(javax.jcr.Session session,
                                                                    PentahoJcrConstants pentahoJcrConstants,
                                                                    Serializable fileId,
                                                                    String versionMessage)
                                                             throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • checkinNearestVersionableFileIfNecessary

        public static void checkinNearestVersionableFileIfNecessary​(javax.jcr.Session session,
                                                                    PentahoJcrConstants pentahoJcrConstants,
                                                                    Serializable fileId,
                                                                    String versionMessage,
                                                                    Date versionDate,
                                                                    boolean aclOnlyChange)
                                                             throws javax.jcr.RepositoryException
        Conditionally checks in node representing file if node is versionable.
        Throws:
        javax.jcr.RepositoryException
      • checkinNearestVersionableNodeIfNecessary

        public static void checkinNearestVersionableNodeIfNecessary​(javax.jcr.Session session,
                                                                    PentahoJcrConstants pentahoJcrConstants,
                                                                    javax.jcr.Node node,
                                                                    String versionMessage)
                                                             throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • checkinNearestVersionableNodeIfNecessary

        public static void checkinNearestVersionableNodeIfNecessary​(javax.jcr.Session session,
                                                                    PentahoJcrConstants pentahoJcrConstants,
                                                                    javax.jcr.Node node,
                                                                    String versionMessage,
                                                                    Date versionDate,
                                                                    boolean aclOnlyChange)
                                                             throws javax.jcr.RepositoryException
        Conditionally checks in node if node is versionable.

        TODO mlowery move commented out version labeling to its own method

        Throws:
        javax.jcr.RepositoryException
      • deleteFile

        public static void deleteFile​(javax.jcr.Session session,
                                      PentahoJcrConstants pentahoJcrConstants,
                                      Serializable fileId,
                                      ILockHelper lockTokenHelper)
                               throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • nodeIdToFile

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile nodeIdToFile​(javax.jcr.Session session,
                                                                                               PentahoJcrConstants pentahoJcrConstants,
                                                                                               IPathConversionHelper pathConversionHelper,
                                                                                               ILockHelper lockHelper,
                                                                                               Serializable fileId)
                                                                                        throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getVersionSummaries

        public static Object getVersionSummaries​(javax.jcr.Session session,
                                                 PentahoJcrConstants pentahoJcrConstants,
                                                 Serializable fileId,
                                                 boolean includeAclOnlyChanges)
                                          throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getFileAtVersion

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile getFileAtVersion​(javax.jcr.Session session,
                                                                                                   PentahoJcrConstants pentahoJcrConstants,
                                                                                                   IPathConversionHelper pathConversionHelper,
                                                                                                   ILockHelper lockHelper,
                                                                                                   Serializable fileId,
                                                                                                   Serializable versionId)
                                                                                            throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getFileContentType

        public static String getFileContentType​(javax.jcr.Session session,
                                                PentahoJcrConstants pentahoJcrConstants,
                                                Serializable fileId,
                                                Serializable versionId)
                                         throws javax.jcr.RepositoryException
        Returns the metadata regarding that identifies what transformer wrote this file's data.
        Throws:
        javax.jcr.RepositoryException
      • getParentId

        public static Serializable getParentId​(javax.jcr.Session session,
                                               Serializable fileId)
                                        throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getBaseVersionId

        public static Serializable getBaseVersionId​(javax.jcr.Session session,
                                                    Serializable fileId)
                                             throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getVersionSummary

        public static Object getVersionSummary​(javax.jcr.Session session,
                                               PentahoJcrConstants pentahoJcrConstants,
                                               Serializable fileId,
                                               Serializable versionId)
                                        throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getTree

        public static org.pentaho.platform.api.repository2.unified.RepositoryFileTree getTree​(javax.jcr.Session session,
                                                                                              PentahoJcrConstants pentahoJcrConstants,
                                                                                              IPathConversionHelper pathConversionHelper,
                                                                                              ILockHelper lockHelper,
                                                                                              String absPath,
                                                                                              org.pentaho.platform.api.repository2.unified.RepositoryRequest repositoryRequest,
                                                                                              org.pentaho.platform.api.repository2.unified.IRepositoryAccessVoterManager accessVoterManager)
                                                                                       throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • updateFileLocaleProperties

        public static javax.jcr.Node updateFileLocaleProperties​(javax.jcr.Session session,
                                                                Serializable fileId,
                                                                String locale,
                                                                Properties properties)
                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • deleteFileLocaleProperties

        public static javax.jcr.Node deleteFileLocaleProperties​(javax.jcr.Session session,
                                                                Serializable fileId,
                                                                String locale)
                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • setFileMetadata

        public static void setFileMetadata​(javax.jcr.Session session,
                                           Serializable fileId,
                                           Map<String,​Serializable> metadataMap)
                                    throws javax.jcr.ItemNotFoundException,
                                           javax.jcr.RepositoryException
        Throws:
        javax.jcr.ItemNotFoundException
        javax.jcr.RepositoryException
      • getFileMetadata

        public static Map<String,​Serializable> getFileMetadata​(javax.jcr.Session session,
                                                                     Serializable fileId)
                                                              throws javax.jcr.ItemNotFoundException,
                                                                     javax.jcr.RepositoryException
        Throws:
        javax.jcr.ItemNotFoundException
        javax.jcr.RepositoryException
      • getReservedChars

        public static List<Character> getReservedChars()
        Use override list from PentahoSystem if it exists
        Returns:
      • checkName

        public static void checkName​(String name)
        Checks for presence of black listed chars as well as illegal permutations of legal chars.
      • createFolder

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile createFolder​(javax.jcr.Session session,
                                                                                               CredentialsStrategySessionFactory sessionFactory,
                                                                                               org.pentaho.platform.api.repository2.unified.RepositoryFile parentFolder,
                                                                                               org.pentaho.platform.api.repository2.unified.RepositoryFile folder,
                                                                                               boolean inheritAces,
                                                                                               org.pentaho.platform.api.repository2.unified.RepositoryFileSid ownerSid,
                                                                                               IPathConversionHelper pathConversionHelper,
                                                                                               String versionMessage)
                                                                                        throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getFileByAbsolutePath

        public static org.pentaho.platform.api.repository2.unified.RepositoryFile getFileByAbsolutePath​(javax.jcr.Session session,
                                                                                                        String absPath,
                                                                                                        IPathConversionHelper pathConversionHelper,
                                                                                                        ILockHelper lockHelper,
                                                                                                        boolean loadMaps,
                                                                                                        org.pentaho.platform.api.locale.IPentahoLocale locale)
                                                                                                 throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getRepositoryVersionManager

        public static org.pentaho.platform.api.repository2.unified.IRepositoryVersionManager getRepositoryVersionManager()
      • setRepositoryVersionManager

        public static void setRepositoryVersionManager​(org.pentaho.platform.api.repository2.unified.IRepositoryVersionManager repositoryVersionManager)