Liferay 6.1.2-ce-ga3

com.liferay.portlet.documentlibrary.store
Class JCRStore

java.lang.Object
  extended by com.liferay.portlet.documentlibrary.store.BaseStore
      extended by com.liferay.portlet.documentlibrary.store.JCRStore
All Implemented Interfaces:
Store

public class JCRStore
extends BaseStore


Field Summary
 
Fields inherited from interface com.liferay.portlet.documentlibrary.store.Store
VERSION_DEFAULT
 
Constructor Summary
JCRStore()
           
 
Method Summary
 void addDirectory(long companyId, long repositoryId, String dirName)
          Adds a directory.
 void addFile(long companyId, long repositoryId, String fileName, InputStream is)
          Adds a file based on an InputStream object.
 void checkRoot(long companyId)
          Ensures company's root directory exists.
 void deleteDirectory(long companyId, long repositoryId, String dirName)
          Deletes a directory.
 void deleteFile(long companyId, long repositoryId, String fileName)
          Deletes a file.
 void deleteFile(long companyId, long repositoryId, String fileName, String versionLabel)
          Deletes a file at a particular version.
 InputStream getFileAsStream(long companyId, long repositoryId, String fileName, String versionLabel)
          Returns the file as an InputStream object.
protected  javax.jcr.Node getFileContentNode(long companyId, long repositoryId, String fileName, String versionLabel)
           
protected  javax.jcr.Node getFileContentNode(javax.jcr.Session session, long companyId, long repositoryId, String fileName, String versionLabel)
           
 String[] getFileNames(long companyId, long repositoryId)
           
 String[] getFileNames(long companyId, long repositoryId, String dirName)
          Returns all files of the directory.
 long getFileSize(long companyId, long repositoryId, String fileName)
          Returns the size of the file.
protected  javax.jcr.Node getFolderNode(javax.jcr.Node node, long name)
           
protected  javax.jcr.Node getFolderNode(javax.jcr.Node node, String name)
           
protected  javax.jcr.Node getRootNode(javax.jcr.Session session, long companyId)
           
 boolean hasDirectory(long companyId, long repositoryId, String dirName)
          Returns true if the directory exists.
 boolean hasFile(long companyId, long repositoryId, String fileName, String versionLabel)
          Returns true if the file exists.
 void move(String srcDir, String destDir)
          Moves an existing directory.
 void updateFile(long companyId, long repositoryId, long newRepositoryId, String fileName)
          Moves a file to a new data repository.
 void updateFile(long companyId, long repositoryId, String fileName, String newFileName)
           
 void updateFile(long companyId, long repositoryId, String fileName, String versionLabel, InputStream is)
          Updates a file based on an InputStream object.
 
Methods inherited from class com.liferay.portlet.documentlibrary.store.BaseStore
addFile, addFile, copyFileVersion, getFile, getFile, getFileAsBytes, getFileAsBytes, getFileAsStream, hasFile, updateFile, updateFile, updateFileVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCRStore

public JCRStore()
Method Detail

addDirectory

public void addDirectory(long companyId,
                         long repositoryId,
                         String dirName)
                  throws PortalException,
                         SystemException
Description copied from class: BaseStore
Adds a directory.

Specified by:
addDirectory in interface Store
Specified by:
addDirectory in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
dirName - the directory's name
Throws:
PortalException - if the directory's information was invalid
SystemException - if a system exception occurred

addFile

public void addFile(long companyId,
                    long repositoryId,
                    String fileName,
                    InputStream is)
             throws PortalException,
                    SystemException
Description copied from class: BaseStore
Adds a file based on an InputStream object.

Specified by:
addFile in interface Store
Specified by:
addFile in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
fileName - the file name
is - the files's data
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

checkRoot

public void checkRoot(long companyId)
               throws SystemException
Description copied from class: BaseStore
Ensures company's root directory exists. Only implemented by checkRoot(long).

Specified by:
checkRoot in interface Store
Specified by:
checkRoot in class BaseStore
Parameters:
companyId - the primary key of the company
Throws:
SystemException - if a system exception occurred

deleteDirectory

public void deleteDirectory(long companyId,
                            long repositoryId,
                            String dirName)
                     throws PortalException
Description copied from class: BaseStore
Deletes a directory.

Specified by:
deleteDirectory in interface Store
Specified by:
deleteDirectory in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
dirName - the directory's name
Throws:
PortalException - if the directory's information was invalid

deleteFile

public void deleteFile(long companyId,
                       long repositoryId,
                       String fileName)
                throws PortalException,
                       SystemException
Description copied from class: BaseStore
Deletes a file. If a file has multiple versions, all versions will be deleted.

Specified by:
deleteFile in interface Store
Specified by:
deleteFile in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
fileName - the file's name
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

deleteFile

public void deleteFile(long companyId,
                       long repositoryId,
                       String fileName,
                       String versionLabel)
                throws PortalException,
                       SystemException
Description copied from class: BaseStore
Deletes a file at a particular version.

Specified by:
deleteFile in interface Store
Specified by:
deleteFile in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
fileName - the file's name
versionLabel - the file's version label
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

getFileAsStream

public InputStream getFileAsStream(long companyId,
                                   long repositoryId,
                                   String fileName,
                                   String versionLabel)
                            throws PortalException,
                                   SystemException
Description copied from class: BaseStore
Returns the file as an InputStream object.

Specified by:
getFileAsStream in interface Store
Specified by:
getFileAsStream in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
fileName - the file's name
versionLabel - the file's version label
Returns:
Returns the InputStream object with the file's name
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

getFileNames

public String[] getFileNames(long companyId,
                             long repositoryId)
                      throws SystemException
Throws:
SystemException

getFileNames

public String[] getFileNames(long companyId,
                             long repositoryId,
                             String dirName)
                      throws PortalException,
                             SystemException
Description copied from class: BaseStore
Returns all files of the directory.

Specified by:
getFileNames in interface Store
Specified by:
getFileNames in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
dirName - the directory's name
Returns:
Returns all files of the directory
Throws:
PortalException - if the directory's information was invalid
SystemException - if a system exception occurred

getFileSize

public long getFileSize(long companyId,
                        long repositoryId,
                        String fileName)
                 throws PortalException,
                        SystemException
Description copied from class: BaseStore
Returns the size of the file.

Specified by:
getFileSize in interface Store
Specified by:
getFileSize in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
fileName - the file's name
Returns:
Returns the size of the file
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

hasDirectory

public boolean hasDirectory(long companyId,
                            long repositoryId,
                            String dirName)
                     throws SystemException
Description copied from class: BaseStore
Returns true if the directory exists.

Specified by:
hasDirectory in interface Store
Specified by:
hasDirectory in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
dirName - the directory's name
Returns:
true if the directory exists; false otherwise
Throws:
SystemException - if a system exception occurred

hasFile

public boolean hasFile(long companyId,
                       long repositoryId,
                       String fileName,
                       String versionLabel)
                throws PortalException,
                       SystemException
Description copied from class: BaseStore
Returns true if the file exists.

Specified by:
hasFile in interface Store
Specified by:
hasFile in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
fileName - the file's name
versionLabel - the file's version label
Returns:
true if the file exists; false otherwise
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

move

public void move(String srcDir,
                 String destDir)
          throws SystemException
Description copied from class: BaseStore
Moves an existing directory. Only implemented by move(String, String).

Specified by:
move in interface Store
Specified by:
move in class BaseStore
Parameters:
srcDir - the original directory's name
destDir - the new directory's name
Throws:
SystemException - if a system exception occurred

updateFile

public void updateFile(long companyId,
                       long repositoryId,
                       long newRepositoryId,
                       String fileName)
                throws PortalException,
                       SystemException
Description copied from class: BaseStore
Moves a file to a new data repository.

Specified by:
updateFile in interface Store
Specified by:
updateFile in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository
newRepositoryId - the primary key of the new data repository
fileName - the file's name
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

updateFile

public void updateFile(long companyId,
                       long repositoryId,
                       String fileName,
                       String newFileName)
                throws PortalException,
                       SystemException
Throws:
PortalException
SystemException

updateFile

public void updateFile(long companyId,
                       long repositoryId,
                       String fileName,
                       String versionLabel,
                       InputStream is)
                throws PortalException,
                       SystemException
Description copied from class: BaseStore
Updates a file based on an InputStream object.

Specified by:
updateFile in interface Store
Specified by:
updateFile in class BaseStore
Parameters:
companyId - the primary key of the company
repositoryId - the primary key of the data repository (optionally CompanyConstants#SYSTEM)
fileName - the file name
versionLabel - the file's new version label
is - the new file's data
Throws:
PortalException - if the file's information was invalid
SystemException - if a system exception occurred

getFileContentNode

protected javax.jcr.Node getFileContentNode(long companyId,
                                            long repositoryId,
                                            String fileName,
                                            String versionLabel)
                                     throws PortalException,
                                            SystemException
Throws:
PortalException
SystemException

getFileContentNode

protected javax.jcr.Node getFileContentNode(javax.jcr.Session session,
                                            long companyId,
                                            long repositoryId,
                                            String fileName,
                                            String versionLabel)
                                     throws PortalException,
                                            SystemException
Throws:
PortalException
SystemException

getFolderNode

protected javax.jcr.Node getFolderNode(javax.jcr.Node node,
                                       long name)
                                throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getFolderNode

protected javax.jcr.Node getFolderNode(javax.jcr.Node node,
                                       String name)
                                throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getRootNode

protected javax.jcr.Node getRootNode(javax.jcr.Session session,
                                     long companyId)
                              throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

Liferay 6.1.2-ce-ga3