org.pentaho.platform.repository2.unified.jcr
Class JcrRepositoryFileUtils

java.lang.Object
  extended by org.pentaho.platform.repository2.unified.jcr.JcrRepositoryFileUtils

public class JcrRepositoryFileUtils
extends Object

Class of static methods where the real JCR work takes place.

Author:
mlowery

Constructor Summary
JcrRepositoryFileUtils()
           
 
Method Summary
static void checkinNearestVersionableFileIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, String versionMessage)
          Conditionally checks in node representing file if node is versionable.
static void checkinNearestVersionableNodeIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.Node node, String versionMessage)
          Conditionally checks in node if node is versionable.
static void checkoutNearestVersionableFileIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId)
          Conditionally checks out node representing file if node is versionable.
static void checkoutNearestVersionableNodeIfNecessary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.Node node)
          Conditionally checks out node if node is versionable.
static javax.jcr.Node createFileNode(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable parentFolderId, RepositoryFile file, IRepositoryFileData content, ITransformer<IRepositoryFileData> transformer)
           
static javax.jcr.Node createFolderNode(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable parentFolderId, RepositoryFile folder)
           
static void deleteFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, ILockHelper lockTokenHelper)
           
static Serializable getBaseVersionId(javax.jcr.Session session, Serializable fileId)
           
static List<RepositoryFile> getChildren(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, IOwnerLookupHelper ownerLookupHelper, IPathConversionHelper pathConversionHelper, Serializable folderId, String filter)
           
static IRepositoryFileData getContent(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, Serializable versionId, ITransformer<IRepositoryFileData> transformer)
           
static RepositoryFile getFileAtVersion(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, IOwnerLookupHelper ownerLookupHelper, IPathConversionHelper pathConversionHelper, Serializable fileId, Serializable versionId)
           
static RepositoryFile getFileById(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, IOwnerLookupHelper ownerLookupHelper, IPathConversionHelper pathConversionHelper, Serializable fileId)
           
static String getFileContentType(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, Serializable versionId)
          Returns the metadata regarding that identifies what transformer wrote this file's data.
static Serializable getParentId(javax.jcr.Session session, Serializable fileId)
           
static RepositoryFileTree getTree(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, IOwnerLookupHelper ownerLookupHelper, IPathConversionHelper pathConversionHelper, String absPath, int depth, String filter)
           
static Object getVersionSummaries(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId)
           
static Object getVersionSummary(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId, Serializable versionId)
           
static boolean isPentahoFile(PentahoJcrConstants pentahoJcrConstants, javax.jcr.Node node)
           
static boolean isPentahoFolder(PentahoJcrConstants pentahoJcrConstants, javax.jcr.Node node)
           
static boolean isSupportedNodeType(PentahoJcrConstants pentahoJcrConstants, javax.jcr.Node node)
           
static Object nodeIdToFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, IOwnerLookupHelper ownerLookupHelper, IPathConversionHelper pathConversionHelper, Serializable fileId)
           
static RepositoryFile nodeToFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, IOwnerLookupHelper ownerLookupHelper, IPathConversionHelper pathConversionHelper, javax.jcr.Node node)
           
static RepositoryFile nodeToFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, IOwnerLookupHelper ownerLookupHelper, IPathConversionHelper pathConversionHelper, javax.jcr.Node node, boolean loadMaps)
           
static javax.jcr.Node updateFileNode(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, RepositoryFile file, IRepositoryFileData content, ITransformer<IRepositoryFileData> transformer)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JcrRepositoryFileUtils

public JcrRepositoryFileUtils()
Method Detail

getFileById

public static RepositoryFile getFileById(javax.jcr.Session session,
                                         PentahoJcrConstants pentahoJcrConstants,
                                         IOwnerLookupHelper ownerLookupHelper,
                                         IPathConversionHelper pathConversionHelper,
                                         Serializable fileId)
                                  throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

nodeToFile

public static RepositoryFile nodeToFile(javax.jcr.Session session,
                                        PentahoJcrConstants pentahoJcrConstants,
                                        IOwnerLookupHelper ownerLookupHelper,
                                        IPathConversionHelper pathConversionHelper,
                                        javax.jcr.Node node)
                                 throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

nodeToFile

public static RepositoryFile nodeToFile(javax.jcr.Session session,
                                        PentahoJcrConstants pentahoJcrConstants,
                                        IOwnerLookupHelper ownerLookupHelper,
                                        IPathConversionHelper pathConversionHelper,
                                        javax.jcr.Node node,
                                        boolean loadMaps)
                                 throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

createFolderNode

public static javax.jcr.Node createFolderNode(javax.jcr.Session session,
                                              PentahoJcrConstants pentahoJcrConstants,
                                              Serializable parentFolderId,
                                              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,
                                            RepositoryFile file,
                                            IRepositoryFileData content,
                                            ITransformer<IRepositoryFileData> transformer)
                                     throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

updateFileNode

public static javax.jcr.Node updateFileNode(javax.jcr.Session session,
                                            PentahoJcrConstants pentahoJcrConstants,
                                            RepositoryFile file,
                                            IRepositoryFileData content,
                                            ITransformer<IRepositoryFileData> transformer)
                                     throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getContent

public static IRepositoryFileData getContent(javax.jcr.Session session,
                                             PentahoJcrConstants pentahoJcrConstants,
                                             Serializable fileId,
                                             Serializable versionId,
                                             ITransformer<IRepositoryFileData> transformer)
                                      throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getChildren

public static List<RepositoryFile> getChildren(javax.jcr.Session session,
                                               PentahoJcrConstants pentahoJcrConstants,
                                               IOwnerLookupHelper ownerLookupHelper,
                                               IPathConversionHelper pathConversionHelper,
                                               Serializable folderId,
                                               String filter)
                                        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

isPentahoFile

public static boolean isPentahoFile(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
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
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 Object nodeIdToFile(javax.jcr.Session session,
                                  PentahoJcrConstants pentahoJcrConstants,
                                  IOwnerLookupHelper ownerLookupHelper,
                                  IPathConversionHelper pathConversionHelper,
                                  Serializable fileId)
                           throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getVersionSummaries

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

getFileAtVersion

public static RepositoryFile getFileAtVersion(javax.jcr.Session session,
                                              PentahoJcrConstants pentahoJcrConstants,
                                              IOwnerLookupHelper ownerLookupHelper,
                                              IPathConversionHelper pathConversionHelper,
                                              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 RepositoryFileTree getTree(javax.jcr.Session session,
                                         PentahoJcrConstants pentahoJcrConstants,
                                         IOwnerLookupHelper ownerLookupHelper,
                                         IPathConversionHelper pathConversionHelper,
                                         String absPath,
                                         int depth,
                                         String filter)
                                  throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException