List of usage examples for com.liferay.portal.kernel.repository LocalRepository deleteFileEntry
public void deleteFileEntry(long fileEntryId) throws PortalException;
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppLocalServiceImpl.java
License:Open Source License
/** * Deletes the file entry.// ww w. ja v a 2 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
protected FileEntry copyFileEntry(long userId, LocalRepository toLocalRepository, FileEntry fileEntry, long newFolderId, ServiceContext serviceContext) throws PortalException, SystemException { List<FileVersion> fileVersions = fileEntry.getFileVersions(WorkflowConstants.STATUS_ANY); FileVersion latestFileVersion = fileVersions.get(fileVersions.size() - 1); FileEntry destinationFileEntry = toLocalRepository.addFileEntry(userId, newFolderId, fileEntry.getTitle(), latestFileVersion.getMimeType(), latestFileVersion.getTitle(), latestFileVersion.getDescription(), StringPool.BLANK, latestFileVersion.getContentStream(false), latestFileVersion.getSize(), serviceContext);//www.j a v a2 s. co m for (int i = fileVersions.size() - 2; i >= 0; i--) { FileVersion fileVersion = fileVersions.get(i); FileVersion previousFileVersion = fileVersions.get(i + 1); try { destinationFileEntry = toLocalRepository.updateFileEntry(userId, destinationFileEntry.getFileEntryId(), fileEntry.getTitle(), destinationFileEntry.getMimeType(), destinationFileEntry.getTitle(), destinationFileEntry.getDescription(), StringPool.BLANK, isMajorVersion(fileVersion, previousFileVersion), fileVersion.getContentStream(false), fileVersion.getSize(), serviceContext); } catch (PortalException pe) { toLocalRepository.deleteFileEntry(destinationFileEntry.getFileEntryId()); throw pe; } } dlAppHelperLocalService.addFileEntry(userId, destinationFileEntry, destinationFileEntry.getFileVersion(), serviceContext); return destinationFileEntry; }
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 {//from w w w.j av a2s.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; } }