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

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

Introduction

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

Prototype

public FileEntry getFileEntry(long fileEntryId) throws PortalException;

Source Link

Usage

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

License:Open Source License

/**
 * Deletes the file entry.//from   www .ja v a2 s.co  m
 *
 * @param  fileEntryId the primary key of the file entry
 * @throws PortalException if the file entry could not be found
 * @throws SystemException if a system exception occurred
 */
public void deleteFileEntry(long fileEntryId) throws PortalException, SystemException {

    LocalRepository localRepository = getLocalRepository(0, fileEntryId, 0);

    FileEntry fileEntry = localRepository.getFileEntry(fileEntryId);

    localRepository.deleteFileEntry(fileEntryId);

    dlAppHelperLocalService.deleteFileEntry(fileEntry);
}

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

License:Open Source License

/**
 * Returns the file entry with the primary key.
 *
 * @param  fileEntryId the primary key of the file entry
 * @return the file entry with the primary key
 * @throws PortalException if the file entry could not be found
 * @throws SystemException if a system exception occurred
 *//*from w  w  w  .j a  v  a 2s  . c om*/
public FileEntry getFileEntry(long fileEntryId) throws PortalException, SystemException {

    LocalRepository localRepository = getLocalRepository(0, fileEntryId, 0);

    return localRepository.getFileEntry(fileEntryId);
}

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

License:Open Source License

protected void deleteFileEntry(long oldFileEntryId, long newFileEntryId, LocalRepository fromLocalRepository,
        LocalRepository toLocalRepository) throws PortalException, SystemException {

    try {/* w  w  w .  j  a  v  a 2 s . com*/
        FileEntry fileEntry = fromLocalRepository.getFileEntry(oldFileEntryId);

        fromLocalRepository.deleteFileEntry(oldFileEntryId);

        dlAppHelperLocalService.deleteFileEntry(fileEntry);
    } catch (PortalException pe) {
        FileEntry fileEntry = toLocalRepository.getFileEntry(newFileEntryId);

        toLocalRepository.deleteFileEntry(newFileEntryId);

        dlAppHelperLocalService.deleteFileEntry(fileEntry);

        throw pe;
    }
}

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

License:Open Source License

protected FileEntry moveFileEntries(long userId, long fileEntryId, long newFolderId,
        LocalRepository fromLocalRepository, LocalRepository toLocalRepository, ServiceContext serviceContext)
        throws SystemException, PortalException {

    FileEntry sourceFileEntry = fromLocalRepository.getFileEntry(fileEntryId);

    FileEntry destinationFileEntry = copyFileEntry(userId, toLocalRepository, sourceFileEntry, newFolderId,
            serviceContext);// w w  w . j  a v a2  s  .co  m

    deleteFileEntry(fileEntryId, destinationFileEntry.getFileEntryId(), fromLocalRepository, toLocalRepository);

    return destinationFileEntry;
}