001
014
015 package com.liferay.portal.kernel.repository.cmis;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.repository.BaseRepository;
020 import com.liferay.portal.kernel.repository.BaseRepositoryImpl;
021 import com.liferay.portal.kernel.repository.RepositoryException;
022 import com.liferay.portal.kernel.repository.model.FileEntry;
023 import com.liferay.portal.kernel.repository.model.FileVersion;
024 import com.liferay.portal.kernel.repository.model.Folder;
025 import com.liferay.portal.kernel.search.Hits;
026 import com.liferay.portal.kernel.search.Query;
027 import com.liferay.portal.kernel.search.SearchContext;
028 import com.liferay.portal.kernel.search.SearchException;
029 import com.liferay.portal.kernel.util.GetterUtil;
030 import com.liferay.portal.kernel.util.OrderByComparator;
031 import com.liferay.portal.model.CompanyConstants;
032 import com.liferay.portal.model.Lock;
033 import com.liferay.portal.model.User;
034 import com.liferay.portal.security.auth.PrincipalThreadLocal;
035 import com.liferay.portal.service.ServiceContext;
036
037 import java.io.InputStream;
038
039 import java.util.List;
040 import java.util.Map;
041
042
045 public abstract class CMISRepositoryHandler extends BaseRepositoryImpl {
046
047 public FileEntry addFileEntry(
048 long folderId, String sourceFileName, String mimeType, String title,
049 String description, String changeLog, InputStream is, long size,
050 ServiceContext serviceContext)
051 throws PortalException, SystemException {
052
053 return _baseCmisRepository.addFileEntry(
054 folderId, sourceFileName, mimeType, title, description, changeLog,
055 is, size, serviceContext);
056 }
057
058 public Folder addFolder(
059 long parentFolderId, String title, String description,
060 ServiceContext serviceContext)
061 throws PortalException, SystemException {
062
063 return _baseCmisRepository.addFolder(
064 parentFolderId, title, description, serviceContext);
065 }
066
067 public void cancelCheckOut(long fileEntryId)
068 throws PortalException, SystemException {
069
070 _baseCmisRepository.cancelCheckOut(fileEntryId);
071 }
072
073 public void checkInFileEntry(
074 long fileEntryId, boolean major, String changeLog,
075 ServiceContext serviceContext)
076 throws PortalException, SystemException {
077
078 _baseCmisRepository.checkInFileEntry(
079 fileEntryId, major, changeLog, serviceContext);
080 }
081
082 public void checkInFileEntry(long fileEntryId, String lockUuid)
083 throws PortalException, SystemException {
084
085 _baseCmisRepository.checkInFileEntry(fileEntryId, lockUuid);
086 }
087
088 public FileEntry checkOutFileEntry(long fileEntryId)
089 throws PortalException, SystemException {
090
091 return _baseCmisRepository.checkOutFileEntry(fileEntryId);
092 }
093
094 public FileEntry checkOutFileEntry(
095 long fileEntryId, String owner, long expirationTime)
096 throws PortalException, SystemException {
097
098 return _baseCmisRepository.checkOutFileEntry(
099 fileEntryId, owner, expirationTime);
100 }
101
102 public FileEntry copyFileEntry(
103 long groupId, long fileEntryId, long destFolderId,
104 ServiceContext serviceContext)
105 throws PortalException, SystemException {
106
107 return _baseCmisRepository.copyFileEntry(
108 groupId, fileEntryId, destFolderId, serviceContext);
109 }
110
111 public void deleteFileEntry(long fileEntryId)
112 throws PortalException, SystemException {
113
114 _baseCmisRepository.deleteFileEntry(fileEntryId);
115 }
116
117 public void deleteFolder(long folderId)
118 throws PortalException, SystemException {
119
120 _baseCmisRepository.deleteFolder(folderId);
121 }
122
123 public BaseRepository getCmisRepository() {
124 return _baseCmisRepository;
125 }
126
127 public List<FileEntry> getFileEntries(
128 long folderId, int start, int end, OrderByComparator obc)
129 throws SystemException {
130
131 return _baseCmisRepository.getFileEntries(folderId, start, end, obc);
132 }
133
134 public List<FileEntry> getFileEntries(
135 long folderId, long fileEntryTypeId, int start, int end,
136 OrderByComparator obc)
137 throws SystemException {
138
139 return _baseCmisRepository.getFileEntries(
140 folderId, fileEntryTypeId, start, end, obc);
141 }
142
143 public int getFileEntriesCount(long folderId) throws SystemException {
144 return _baseCmisRepository.getFileEntriesCount(folderId);
145 }
146
147 public int getFileEntriesCount(long folderId, long fileEntryTypeId)
148 throws SystemException {
149
150 return _baseCmisRepository.getFileEntriesCount(
151 folderId, fileEntryTypeId);
152 }
153
154 public FileEntry getFileEntry(long fileEntryId)
155 throws PortalException, SystemException {
156
157 return _baseCmisRepository.getFileEntry(fileEntryId);
158 }
159
160 public FileEntry getFileEntry(long folderId, String title)
161 throws PortalException, SystemException {
162
163 return _baseCmisRepository.getFileEntry(folderId, title);
164 }
165
166 public FileEntry getFileEntryByUuid(String uuid)
167 throws PortalException, SystemException {
168
169 return _baseCmisRepository.getFileEntryByUuid(uuid);
170 }
171
172 public FileVersion getFileVersion(long fileVersionId)
173 throws PortalException, SystemException {
174
175 return _baseCmisRepository.getFileVersion(fileVersionId);
176 }
177
178 public Folder getFolder(long folderId)
179 throws PortalException, SystemException {
180
181 return _baseCmisRepository.getFolder(folderId);
182 }
183
184 public Folder getFolder(long parentFolderId, String title)
185 throws PortalException, SystemException {
186
187 return _baseCmisRepository.getFolder(parentFolderId, title);
188 }
189
190 public List<Folder> getFolders(
191 long parentFolderId, boolean includeMountfolders, int start,
192 int end, OrderByComparator obc)
193 throws SystemException {
194
195 return _baseCmisRepository.getFolders(
196 parentFolderId, includeMountfolders, start, end, obc);
197 }
198
199 @Override
200 public List<Object> getFoldersAndFileEntries(
201 long folderId, int start, int end, OrderByComparator obc)
202 throws SystemException {
203
204 return _baseCmisRepository.getFoldersAndFileEntries(
205 folderId, start, end, obc);
206 }
207
208 @Override
209 public int getFoldersAndFileEntriesCount(long folderId)
210 throws SystemException {
211
212 return _baseCmisRepository.getFoldersAndFileEntriesCount(folderId);
213 }
214
215 public int getFoldersCount(long parentFolderId, boolean includeMountfolders)
216 throws SystemException {
217
218 return _baseCmisRepository.getFoldersCount(
219 parentFolderId, includeMountfolders);
220 }
221
222 public int getFoldersFileEntriesCount(List<Long> folderIds, int status)
223 throws SystemException {
224
225 return _baseCmisRepository.getFoldersFileEntriesCount(
226 folderIds, status);
227 }
228
229 public String getLatestVersionId(String objectId) throws SystemException {
230 return _baseCmisRepository.getLatestVersionId(objectId);
231 }
232
233 public String getLogin() throws RepositoryException {
234 String login = PrincipalThreadLocal.getName();
235
236 try {
237 String authType =
238 companyLocalService.getCompany(getCompanyId()).getAuthType();
239
240 if (!authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
241 User user = userLocalService.getUser(GetterUtil.getLong(login));
242
243 if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
244 login = user.getEmailAddress();
245 }
246 else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
247 login = user.getScreenName();
248 }
249 }
250 }
251 catch (Exception e) {
252 throw new RepositoryException(e);
253 }
254
255 return login;
256 }
257
258 public List<Folder> getMountFolders(
259 long parentFolderId, int start, int end, OrderByComparator obc)
260 throws SystemException {
261
262 return _baseCmisRepository.getMountFolders(
263 parentFolderId, start, end, obc);
264 }
265
266 public int getMountFoldersCount(long parentFolderId)
267 throws SystemException {
268
269 return _baseCmisRepository.getMountFoldersCount(
270 parentFolderId);
271 }
272
273 public String getObjectName(String objectId)
274 throws PortalException, SystemException {
275
276 return _baseCmisRepository.getObjectName(objectId);
277 }
278
279 public List<String> getObjectPaths(String objectId)
280 throws PortalException, SystemException {
281
282 return _baseCmisRepository.getObjectPaths(objectId);
283 }
284
285 public abstract Session getSession()
286 throws PortalException, RepositoryException;
287
288 public List<Long> getSubfolderIds(long folderId, boolean recurse)
289 throws SystemException {
290
291 return _baseCmisRepository.getSubfolderIds(folderId, recurse);
292 }
293
294 public void getSubfolderIds(List<Long> folderIds, long folderId)
295 throws SystemException {
296
297 _baseCmisRepository.getSubfolderIds(folderIds, folderId);
298 }
299
300 @Override
301 public void initRepository() throws PortalException, SystemException {
302 _baseCmisRepository.initRepository();
303 }
304
305 public boolean isCancelCheckOutAllowable(String objectId)
306 throws PortalException, SystemException {
307
308 return _baseCmisRepository.isCancelCheckOutAllowable(objectId);
309 }
310
311 public boolean isCheckInAllowable(String objectId)
312 throws PortalException, SystemException {
313
314 return _baseCmisRepository.isCheckInAllowable(objectId);
315 }
316
317 public boolean isCheckOutAllowable(String objectId)
318 throws PortalException, SystemException {
319
320 return _baseCmisRepository.isCheckOutAllowable(objectId);
321 }
322
323 public boolean isDocumentRetrievableByVersionSeriesId() {
324 return true;
325 }
326
327 public boolean isRefreshBeforePermissionCheck() {
328 return false;
329 }
330
331 public boolean isSupportsMinorVersions(String productName) {
332
333
334
335 productName = productName.toLowerCase();
336
337 if (productName.contains("filenet") && productName.contains("p8")) {
338 return false;
339 }
340 else {
341 return true;
342 }
343 }
344
345 public Lock lockFolder(long folderId)
346 throws PortalException, SystemException {
347
348 return _baseCmisRepository.lockFolder(folderId);
349 }
350
351 public Lock lockFolder(
352 long folderId, String owner, boolean inheritable,
353 long expirationTime)
354 throws PortalException, SystemException {
355
356 return _baseCmisRepository.lockFolder(
357 folderId, owner, inheritable, expirationTime);
358 }
359
360 public FileEntry moveFileEntry(
361 long fileEntryId, long newFolderId, ServiceContext serviceContext)
362 throws PortalException, SystemException {
363
364 return _baseCmisRepository.moveFileEntry(
365 fileEntryId, newFolderId, serviceContext);
366 }
367
368 public Folder moveFolder(
369 long folderId, long newParentFolderId,
370 ServiceContext serviceContext)
371 throws PortalException, SystemException {
372
373 return _baseCmisRepository.moveFolder(
374 folderId, newParentFolderId, serviceContext);
375 }
376
377 public Lock refreshFileEntryLock(String lockUuid, long expirationTime)
378 throws PortalException, SystemException {
379
380 return _baseCmisRepository.refreshFileEntryLock(
381 lockUuid, expirationTime);
382 }
383
384 public Lock refreshFolderLock(String lockUuid, long expirationTime)
385 throws PortalException, SystemException {
386
387 return _baseCmisRepository.refreshFolderLock(lockUuid, expirationTime);
388 }
389
390 public void revertFileEntry(
391 long fileEntryId, String version, ServiceContext serviceContext)
392 throws PortalException, SystemException {
393
394 _baseCmisRepository.revertFileEntry(
395 fileEntryId, version, serviceContext);
396 }
397
398 @Override
399 public Hits search(SearchContext searchContext) throws SearchException {
400 return _baseCmisRepository.search(searchContext);
401 }
402
403 public Hits search(SearchContext searchContext, Query query)
404 throws SearchException {
405
406 return _baseCmisRepository.search(searchContext, query);
407 }
408
409 public void setCmisRepository(BaseCmisRepository baseCmisRepository) {
410 _baseCmisRepository = baseCmisRepository;
411 }
412
413 public FileEntry toFileEntry(String objectId)
414 throws PortalException, SystemException {
415
416 return _baseCmisRepository.toFileEntry(objectId);
417 }
418
419 public Folder toFolder(String objectId)
420 throws PortalException, SystemException {
421
422 return _baseCmisRepository.toFolder(objectId);
423 }
424
425 public void unlockFolder(long folderId, String lockUuid)
426 throws PortalException, SystemException {
427
428 _baseCmisRepository.unlockFolder(folderId, lockUuid);
429 }
430
431 public FileEntry updateFileEntry(
432 long fileEntryId, String sourceFileName, String mimeType,
433 String title, String description, String changeLog,
434 boolean majorVersion, InputStream is, long size,
435 ServiceContext serviceContext)
436 throws PortalException, SystemException {
437
438 return _baseCmisRepository.updateFileEntry(
439 fileEntryId, sourceFileName, mimeType, title, description,
440 changeLog, majorVersion, is, size, serviceContext);
441 }
442
443 public FileEntry updateFileEntry(
444 String objectId, String mimeType, Map<String, Object> properties,
445 InputStream is, String sourceFileName, long size,
446 ServiceContext serviceContext)
447 throws PortalException, SystemException {
448
449 return _baseCmisRepository.updateFileEntry(
450 objectId, mimeType, properties, is, sourceFileName, size,
451 serviceContext);
452 }
453
454 public Folder updateFolder(
455 long folderId, String title, String description,
456 ServiceContext serviceContext)
457 throws PortalException, SystemException {
458
459 return _baseCmisRepository.updateFolder(
460 folderId, title, description, serviceContext);
461 }
462
463 public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
464 throws PortalException, SystemException {
465
466 return _baseCmisRepository.verifyFileEntryCheckOut(
467 fileEntryId, lockUuid);
468 }
469
470 public boolean verifyInheritableLock(long folderId, String lockUuid)
471 throws PortalException, SystemException {
472
473 return _baseCmisRepository.verifyInheritableLock(
474 folderId, lockUuid);
475 }
476
477 private BaseCmisRepository _baseCmisRepository;
478
479 }