/portal-service/src/com/liferay/portal/kernel/repository/DefaultLocalRepositoryImpl.java

https://github.com/Oggi/liferay-portal · Java · 284 lines · 185 code · 71 blank · 28 comment · 0 complexity · 99f53cbdb0549680109680bfc2b05430 MD5 · raw file

  1. /**
  2. * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. package com.liferay.portal.kernel.repository;
  15. import com.liferay.portal.kernel.exception.PortalException;
  16. import com.liferay.portal.kernel.exception.SystemException;
  17. import com.liferay.portal.kernel.repository.model.FileEntry;
  18. import com.liferay.portal.kernel.repository.model.FileVersion;
  19. import com.liferay.portal.kernel.repository.model.Folder;
  20. import com.liferay.portal.kernel.util.OrderByComparator;
  21. import com.liferay.portal.service.ServiceContext;
  22. import java.io.File;
  23. import java.io.InputStream;
  24. import java.util.List;
  25. /**
  26. * This class is designed for third party repository implementations. Since the
  27. * paradigm of remote and local services exists only within Liferay, the
  28. * assumption is that all permission checking will be delegated to the specific
  29. * repository.
  30. *
  31. * There are also many calls within this class that pass in a user ID as a
  32. * parameter. These methods should only be called for administration of Liferay
  33. * repositories and are hence not supported in all third party repositories.
  34. * This includes moving between document library hooks and LAR import/export.
  35. * Calling these methods will throw an
  36. * <code>UnsupportedOperationException</code>.
  37. *
  38. * @author Alexander Chow
  39. */
  40. public class DefaultLocalRepositoryImpl implements LocalRepository {
  41. public DefaultLocalRepositoryImpl(Repository repository) {
  42. _repository = repository;
  43. }
  44. public FileEntry addFileEntry(
  45. long userId, long folderId, String sourceFileName, String mimeType,
  46. String title, String description, String changeLog, File file,
  47. ServiceContext serviceContext) {
  48. throw new UnsupportedOperationException();
  49. }
  50. public FileEntry addFileEntry(
  51. long userId, long folderId, String sourceFileName, String mimeType,
  52. String title, String description, String changeLog, InputStream is,
  53. long size, ServiceContext serviceContext) {
  54. throw new UnsupportedOperationException();
  55. }
  56. public Folder addFolder(
  57. long userId, long parentFolderId, String title, String description,
  58. ServiceContext serviceContext) {
  59. throw new UnsupportedOperationException();
  60. }
  61. public void deleteAll() {
  62. throw new UnsupportedOperationException();
  63. }
  64. public void deleteFileEntry(long fileEntryId)
  65. throws PortalException, SystemException {
  66. _repository.deleteFileEntry(fileEntryId);
  67. }
  68. public void deleteFolder(long folderId)
  69. throws PortalException, SystemException {
  70. _repository.deleteFolder(folderId);
  71. }
  72. public List<FileEntry> getFileEntries(
  73. long folderId, int start, int end, OrderByComparator obc)
  74. throws SystemException {
  75. return _repository.getFileEntries(folderId, start, end, obc);
  76. }
  77. public List<Object> getFileEntriesAndFileShortcuts(
  78. long folderId, int status, int start, int end)
  79. throws SystemException {
  80. return _repository.getFileEntriesAndFileShortcuts(
  81. folderId, status, start, end);
  82. }
  83. public int getFileEntriesAndFileShortcutsCount(long folderId, int status)
  84. throws SystemException {
  85. return _repository.getFileEntriesAndFileShortcutsCount(
  86. folderId, status);
  87. }
  88. public int getFileEntriesCount(long folderId) throws SystemException {
  89. return _repository.getFileEntriesCount(folderId);
  90. }
  91. public FileEntry getFileEntry(long fileEntryId)
  92. throws PortalException, SystemException {
  93. return _repository.getFileEntry(fileEntryId);
  94. }
  95. public FileEntry getFileEntry(long folderId, String title)
  96. throws PortalException, SystemException {
  97. return _repository.getFileEntry(folderId, title);
  98. }
  99. public FileEntry getFileEntryByUuid(String uuid)
  100. throws PortalException, SystemException {
  101. return _repository.getFileEntryByUuid(uuid);
  102. }
  103. public FileVersion getFileVersion(long fileVersionId)
  104. throws PortalException, SystemException {
  105. return _repository.getFileVersion(fileVersionId);
  106. }
  107. public Folder getFolder(long folderId)
  108. throws PortalException, SystemException {
  109. return _repository.getFolder(folderId);
  110. }
  111. public Folder getFolder(long parentFolderId, String title)
  112. throws PortalException, SystemException {
  113. return _repository.getFolder(parentFolderId, title);
  114. }
  115. public List<Folder> getFolders(
  116. long parentFolderId, boolean includeMountfolders, int start,
  117. int end, OrderByComparator obc)
  118. throws SystemException {
  119. return _repository.getFolders(
  120. parentFolderId, includeMountfolders, start, end, obc);
  121. }
  122. public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
  123. long folderId, int status, boolean includeMountFolders, int start,
  124. int end, OrderByComparator obc)
  125. throws SystemException {
  126. return _repository.getFoldersAndFileEntriesAndFileShortcuts(
  127. folderId, status, includeMountFolders, start, end, obc);
  128. }
  129. public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
  130. long folderId, int status, int start, int end,
  131. OrderByComparator obc)
  132. throws SystemException {
  133. return getFoldersAndFileEntriesAndFileShortcuts(
  134. folderId, status, true, start, end, obc);
  135. }
  136. public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
  137. long folderId, int status, String[] mimeTypes,
  138. boolean includeMountFolders, int start, int end,
  139. OrderByComparator obc)
  140. throws SystemException {
  141. return _repository.getFoldersAndFileEntriesAndFileShortcuts(
  142. folderId, status, mimeTypes, includeMountFolders, start, end, obc);
  143. }
  144. public int getFoldersAndFileEntriesAndFileShortcutsCount(
  145. long folderId, int status)
  146. throws SystemException {
  147. return getFoldersAndFileEntriesAndFileShortcutsCount(
  148. folderId, status, true);
  149. }
  150. public int getFoldersAndFileEntriesAndFileShortcutsCount(
  151. long folderId, int status, boolean includeMountFolders)
  152. throws SystemException {
  153. return _repository.getFoldersAndFileEntriesAndFileShortcutsCount(
  154. folderId, status, includeMountFolders);
  155. }
  156. public int getFoldersAndFileEntriesAndFileShortcutsCount(
  157. long folderId, int status, String[] mimeTypes,
  158. boolean includeMountFolders)
  159. throws SystemException {
  160. return _repository.getFoldersAndFileEntriesAndFileShortcutsCount(
  161. folderId, status, mimeTypes, includeMountFolders);
  162. }
  163. public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
  164. throws SystemException {
  165. return _repository.getFoldersCount(parentFolderId, includeMountfolders);
  166. }
  167. public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
  168. throws SystemException {
  169. return _repository.getFoldersFileEntriesCount(folderIds, status);
  170. }
  171. public List<Folder> getMountFolders(
  172. long parentFolderId, int start, int end, OrderByComparator obc)
  173. throws SystemException {
  174. return _repository.getMountFolders(parentFolderId, start, end, obc);
  175. }
  176. public int getMountFoldersCount(long parentFolderId)
  177. throws SystemException {
  178. return _repository.getMountFoldersCount(parentFolderId);
  179. }
  180. public long getRepositoryId() {
  181. return _repository.getRepositoryId();
  182. }
  183. public FileEntry moveFileEntry(
  184. long userId, long fileEntryId, long newFolderId,
  185. ServiceContext serviceContext) {
  186. throw new UnsupportedOperationException();
  187. }
  188. public void updateAsset(
  189. long userId, FileEntry fileEntry, FileVersion fileVersion,
  190. long[] assetCategoryIds, String[] assetTagNames,
  191. long[] assetLinkEntryIds) {
  192. throw new UnsupportedOperationException();
  193. }
  194. public FileEntry updateFileEntry(
  195. long userId, long fileEntryId, String sourceFileName, String mimeType,
  196. String title, String description, String changeLog,
  197. boolean majorVersion, File file, ServiceContext serviceContext) {
  198. throw new UnsupportedOperationException();
  199. }
  200. public FileEntry updateFileEntry(
  201. long userId, long fileEntryId, String sourceFileName, String mimeType,
  202. String title, String description, String changeLog,
  203. boolean majorVersion, InputStream is, long size,
  204. ServiceContext serviceContext) {
  205. throw new UnsupportedOperationException();
  206. }
  207. public Folder updateFolder(
  208. long folderId, long parentFolderId, String title,
  209. String description, ServiceContext serviceContext) {
  210. throw new UnsupportedOperationException();
  211. }
  212. private Repository _repository;
  213. }