List of usage examples for com.liferay.portal.kernel.repository Repository getFileEntryByUuid
public FileEntry getFileEntryByUuid(String uuid) throws PortalException;
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppServiceImpl.java
License:Open Source License
/** * Returns the file entry with the UUID and group. * * @param uuid the file entry's universally unique identifier * @param groupId the primary key of the file entry's group * @return the file entry with the UUID and group * @throws PortalException if the file entry could not be found * @throws SystemException if a system exception occurred *//*from w ww . java 2s .c o m*/ public FileEntry getFileEntryByUuidAndGroupId(String uuid, long groupId) throws PortalException, SystemException { try { Repository repository = getRepository(groupId); return repository.getFileEntryByUuid(uuid); } catch (NoSuchFileEntryException nsfee) { List<com.liferay.portal.model.Repository> repositories = repositoryPersistence.findByGroupId(groupId); for (int i = 0; i < repositories.size(); i++) { try { long repositoryId = repositories.get(i).getRepositoryId(); Repository repository = getRepository(repositoryId); return repository.getFileEntryByUuid(uuid); } catch (NoSuchFileEntryException nsfee2) { } } } StringBundler msg = new StringBundler(6); msg.append("No DLFileEntry exists with the key {"); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchFileEntryException(msg.toString()); }