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