List of usage examples for com.liferay.portal.kernel.repository Repository getFileEntry
public FileEntry getFileEntry(long fileEntryId) throws PortalException;
From source file:com.liferay.document.library.internal.trash.DLFileEntryTrashHandler.java
License:Open Source License
protected DLFileEntry fetchDLFileEntry(long classPK) throws PortalException { Repository repository = RepositoryProviderUtil.getFileEntryRepository(classPK); if (!repository.isCapabilityProvided(TrashCapability.class)) { return null; }/*w w w .ja va 2 s. com*/ FileEntry fileEntry = repository.getFileEntry(classPK); return (DLFileEntry) fileEntry.getModel(); }
From source file:com.liferay.document.library.internal.trash.DLFileEntryTrashHandler.java
License:Open Source License
protected DLFileEntry getDLFileEntry(long classPK) throws PortalException { Repository repository = RepositoryProviderUtil.getFileEntryRepository(classPK); if (!repository.isCapabilityProvided(TrashCapability.class)) { throw new UnsupportedCapabilityException(TrashCapability.class, "Repository " + repository.getRepositoryId()); }/*from w w w . jav a2 s. c om*/ FileEntry fileEntry = repository.getFileEntry(classPK); return (DLFileEntry) fileEntry.getModel(); }
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.java
License:Open Source License
/** * Cancels the check out of the file entry. If a user has not checked out * the specified file entry, invoking this method will result in no changes. * * <p>/*from w ww .ja va 2 s . c o m*/ * When a file entry is checked out, a PWC (private working copy) is created * and the original file entry is locked. A client can make as many changes * to the PWC as he desires without those changes being visible to other * users. If the user is satisfied with the changes, he may elect to check * in his changes, resulting in a new file version based on the PWC; the PWC * will be removed and the file entry will be unlocked. If the user is not * satisfied with the changes, he may elect to cancel his check out; this * results in the deletion of the PWC and unlocking of the file entry. * </p> * * @param fileEntryId the primary key of the file entry to cancel the * checkout * @throws PortalException if the file entry could not be found * @throws SystemException if a system exception occurred * @see #checkInFileEntry(long, boolean, String, ServiceContext) * @see #checkOutFileEntry(long) */ public void cancelCheckOut(long fileEntryId) throws PortalException, SystemException { Repository repository = getRepository(0, fileEntryId, 0); FileEntry fileEntry = repository.getFileEntry(fileEntryId); DLProcessorRegistryUtil.cleanUp(fileEntry.getLatestFileVersion()); repository.cancelCheckOut(fileEntryId); ServiceContext serviceContext = new ServiceContext(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH); dlAppHelperLocalService.updateFileEntry(getUserId(), fileEntry, fileEntry.getFileVersion(), serviceContext); }
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.java
License:Open Source License
/** * Deletes the file entry with the primary key. * * @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 *///from w w w . ja v a2 s . com public void deleteFileEntry(long fileEntryId) throws PortalException, SystemException { Repository repository = getRepository(0, fileEntryId, 0); FileEntry fileEntry = repository.getFileEntry(fileEntryId); dlAppHelperLocalService.deleteFileEntry(fileEntry); repository.deleteFileEntry(fileEntryId); }
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.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 ww w.j a v a2s . c om*/ public FileEntry getFileEntry(long fileEntryId) throws PortalException, SystemException { Repository repository = getRepository(0, fileEntryId, 0); return repository.getFileEntry(fileEntryId); }
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.java
License:Open Source License
protected void deleteFileEntry(long oldFileEntryId, long newFileEntryId, Repository fromRepository, Repository toRepository) throws PortalException, SystemException { try {/*w w w. j a v a 2 s.c o m*/ FileEntry fileEntry = fromRepository.getFileEntry(oldFileEntryId); dlAppHelperLocalService.deleteFileEntry(fileEntry); fromRepository.deleteFileEntry(oldFileEntryId); } catch (PortalException pe) { FileEntry fileEntry = toRepository.getFileEntry(newFileEntryId); toRepository.deleteFileEntry(newFileEntryId); dlAppHelperLocalService.deleteFileEntry(fileEntry); throw pe; } }
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.java
License:Open Source License
protected FileEntry moveFileEntries(long fileEntryId, long newFolderId, Repository fromRepository, Repository toRepository, ServiceContext serviceContext) throws SystemException, PortalException { FileEntry sourceFileEntry = fromRepository.getFileEntry(fileEntryId); FileEntry destinationFileEntry = copyFileEntry(toRepository, sourceFileEntry, newFolderId, serviceContext); deleteFileEntry(fileEntryId, destinationFileEntry.getFileEntryId(), fromRepository, toRepository); return destinationFileEntry; }