List of usage examples for com.liferay.portal.kernel.repository LocalRepository moveFileEntry
public FileEntry moveFileEntry(long userId, long fileEntryId, long newFolderId, ServiceContext serviceContext) throws PortalException;
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppLocalServiceImpl.java
License:Open Source License
/** * Moves the file entry to the new folder. * * @param userId the primary key of the user * @param fileEntryId the primary key of the file entry * @param newFolderId the primary key of the new folder * @param serviceContext the service context to be applied * @return the file entry/*from w w w. j a v a 2s . c om*/ * @throws PortalException if the file entry or the new folder could not be * found * @throws SystemException if a system exception occurred */ public FileEntry moveFileEntry(long userId, long fileEntryId, long newFolderId, ServiceContext serviceContext) throws PortalException, SystemException { LocalRepository fromLocalRepository = getLocalRepository(0, fileEntryId, 0); LocalRepository toLocalRepository = getLocalRepository(newFolderId, serviceContext); if (fromLocalRepository.getRepositoryId() == toLocalRepository.getRepositoryId()) { // Move file entries within repository FileEntry fileEntry = fromLocalRepository.moveFileEntry(userId, fileEntryId, newFolderId, serviceContext); return fileEntry; } // Move file entries between repositories return moveFileEntries(userId, fileEntryId, newFolderId, fromLocalRepository, toLocalRepository, serviceContext); }