Example usage for com.liferay.portal.kernel.repository Repository getFileEntry

List of usage examples for com.liferay.portal.kernel.repository Repository getFileEntry

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.repository Repository getFileEntry.

Prototype

public FileEntry getFileEntry(long folderId, String title) throws PortalException;

Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.java

License:Open Source License

/**
 * Deletes the file entry with the title in the folder.
 *
 * @param  repositoryId the primary key of the repository
 * @param  folderId the primary key of the file entry's parent folder
 * @param  title the file entry's title//from  www .  j a v a 2 s . c  o  m
 * @throws PortalException if the file entry could not be found
 * @throws SystemException if a system exception occurred
 */
public void deleteFileEntryByTitle(long repositoryId, long folderId, String title)
        throws PortalException, SystemException {

    Repository repository = getRepository(repositoryId);

    FileEntry fileEntry = repository.getFileEntry(folderId, title);

    dlAppHelperLocalService.deleteFileEntry(fileEntry);

    repository.deleteFileEntry(folderId, title);
}

From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.java

License:Open Source License

/**
 * Returns the file entry with the title in the folder.
 *
 * @param  groupId the primary key of the file entry's group
 * @param  folderId the primary key of the file entry's folder
 * @param  title the file entry's title/*from   www  . j a  v a  2  s  . com*/
 * @return the file entry with the title in the folder
 * @throws PortalException if the file entry could not be found
 * @throws SystemException if a system exception occurred
 */
public FileEntry getFileEntry(long groupId, long folderId, String title)
        throws PortalException, SystemException {

    try {
        Repository repository = getRepository(groupId);

        return repository.getFileEntry(folderId, title);
    } catch (NoSuchFileEntryException nsfee) {
        if (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
            Repository repository = getRepository(folderId, 0, 0);

            return repository.getFileEntry(folderId, title);
        } else {
            throw nsfee;
        }
    }
}