001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.documentlibrary.service.impl;
016    
017    import com.liferay.portal.kernel.dao.orm.QueryDefinition;
018    import com.liferay.portal.kernel.exception.PortalException;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.search.Hits;
021    import com.liferay.portal.kernel.util.ArrayUtil;
022    import com.liferay.portal.kernel.util.OrderByComparator;
023    import com.liferay.portal.kernel.util.StringPool;
024    import com.liferay.portal.kernel.util.Validator;
025    import com.liferay.portal.kernel.workflow.WorkflowConstants;
026    import com.liferay.portal.model.Lock;
027    import com.liferay.portal.security.auth.PrincipalException;
028    import com.liferay.portal.security.permission.ActionKeys;
029    import com.liferay.portal.security.permission.PermissionChecker;
030    import com.liferay.portal.service.ServiceContext;
031    import com.liferay.portal.util.PropsValues;
032    import com.liferay.portlet.documentlibrary.NoSuchFileEntryException;
033    import com.liferay.portlet.documentlibrary.model.DLFileEntry;
034    import com.liferay.portlet.documentlibrary.model.DLFileVersion;
035    import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
036    import com.liferay.portlet.documentlibrary.model.impl.DLFileEntryImpl;
037    import com.liferay.portlet.documentlibrary.service.base.DLFileEntryServiceBaseImpl;
038    import com.liferay.portlet.documentlibrary.service.permission.DLFileEntryPermission;
039    import com.liferay.portlet.documentlibrary.service.permission.DLFolderPermission;
040    import com.liferay.portlet.documentlibrary.store.DLStoreUtil;
041    import com.liferay.portlet.dynamicdatamapping.storage.Fields;
042    import com.liferay.portlet.expando.util.ExpandoBridgeUtil;
043    
044    import java.io.File;
045    import java.io.InputStream;
046    
047    import java.util.ArrayList;
048    import java.util.Collections;
049    import java.util.List;
050    import java.util.Map;
051    
052    /**
053     * Provides the remote service for accessing, adding, checking in/out, deleting,
054     * locking/unlocking, moving, reverting, updating, and verifying document
055     * library file entries. Its methods include permission checks.
056     *
057     * @author Brian Wing Shun Chan
058     * @author Alexander Chow
059     */
060    public class DLFileEntryServiceImpl extends DLFileEntryServiceBaseImpl {
061    
062            @Override
063            public DLFileEntry addFileEntry(
064                            long groupId, long repositoryId, long folderId,
065                            String sourceFileName, String mimeType, String title,
066                            String description, String changeLog, long fileEntryTypeId,
067                            Map<String, Fields> fieldsMap, File file, InputStream is, long size,
068                            ServiceContext serviceContext)
069                    throws PortalException, SystemException {
070    
071                    DLFolderPermission.check(
072                            getPermissionChecker(), groupId, folderId, ActionKeys.ADD_DOCUMENT);
073    
074                    return dlFileEntryLocalService.addFileEntry(
075                            getUserId(), groupId, repositoryId, folderId, sourceFileName,
076                            mimeType, title, description, changeLog, fileEntryTypeId, fieldsMap,
077                            file, is, size, serviceContext);
078            }
079    
080            @Override
081            public DLFileVersion cancelCheckOut(long fileEntryId)
082                    throws PortalException, SystemException {
083    
084                    boolean locked = lockLocalService.isLocked(
085                            DLFileEntry.class.getName(), fileEntryId);
086    
087                    try {
088                            if (locked && !hasFileEntryLock(fileEntryId) &&
089                                    !DLFileEntryPermission.contains(
090                                            getPermissionChecker(), fileEntryId,
091                                            ActionKeys.OVERRIDE_CHECKOUT)) {
092    
093                                    throw new PrincipalException();
094                            }
095                    }
096                    catch (NoSuchFileEntryException nsfee) {
097                    }
098    
099                    return dlFileEntryLocalService.cancelCheckOut(getUserId(), fileEntryId);
100            }
101    
102            @Override
103            public void checkInFileEntry(
104                            long fileEntryId, boolean major, String changeLog,
105                            ServiceContext serviceContext)
106                    throws PortalException, SystemException {
107    
108                    boolean isLocked = lockLocalService.isLocked(
109                            DLFileEntry.class.getName(), fileEntryId);
110    
111                    try {
112                            if (isLocked && !hasFileEntryLock(fileEntryId) &&
113                                    !DLFileEntryPermission.contains(
114                                            getPermissionChecker(), fileEntryId,
115                                            ActionKeys.OVERRIDE_CHECKOUT)) {
116    
117                                    throw new PrincipalException();
118                            }
119                    }
120                    catch (NoSuchFileEntryException nsfee) {
121                    }
122    
123                    dlFileEntryLocalService.checkInFileEntry(
124                            getUserId(), fileEntryId, major, changeLog, serviceContext);
125            }
126    
127            /**
128             * @deprecated As of 6.2.0, replaced by {@link #checkInFileEntry(long,
129             *             String, ServiceContext)}
130             */
131            @Override
132            public void checkInFileEntry(long fileEntryId, String lockUuid)
133                    throws PortalException, SystemException {
134    
135                    checkInFileEntry(fileEntryId, lockUuid, new ServiceContext());
136            }
137    
138            @Override
139            public void checkInFileEntry(
140                            long fileEntryId, String lockUuid, ServiceContext serviceContext)
141                    throws PortalException, SystemException {
142    
143                    try {
144                            if (!hasFileEntryLock(fileEntryId) &&
145                                    !DLFileEntryPermission.contains(
146                                            getPermissionChecker(), fileEntryId,
147                                            ActionKeys.OVERRIDE_CHECKOUT)) {
148    
149                                    throw new PrincipalException();
150                            }
151                    }
152                    catch (NoSuchFileEntryException nsfee) {
153                    }
154    
155                    dlFileEntryLocalService.checkInFileEntry(
156                            getUserId(), fileEntryId, lockUuid, serviceContext);
157            }
158    
159            /**
160             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
161             *             ServiceContext)}
162             */
163            @Override
164            public DLFileEntry checkOutFileEntry(long fileEntryId)
165                    throws PortalException, SystemException {
166    
167                    return checkOutFileEntry(fileEntryId, new ServiceContext());
168            }
169    
170            @Override
171            public DLFileEntry checkOutFileEntry(
172                            long fileEntryId, ServiceContext serviceContext)
173                    throws PortalException, SystemException {
174    
175                    return checkOutFileEntry(
176                            fileEntryId, null, DLFileEntryImpl.LOCK_EXPIRATION_TIME,
177                            serviceContext);
178            }
179    
180            /**
181             * @deprecated As of 6.2.0, replaced by {@link #checkOutFileEntry(long,
182             *             String, long, ServiceContext)}
183             */
184            @Override
185            public DLFileEntry checkOutFileEntry(
186                            long fileEntryId, String owner, long expirationTime)
187                    throws PortalException, SystemException {
188    
189                    return checkOutFileEntry(
190                            fileEntryId, owner, expirationTime, new ServiceContext());
191            }
192    
193            @Override
194            public DLFileEntry checkOutFileEntry(
195                            long fileEntryId, String owner, long expirationTime,
196                            ServiceContext serviceContext)
197                    throws PortalException, SystemException {
198    
199                    DLFileEntryPermission.check(
200                            getPermissionChecker(), fileEntryId, ActionKeys.UPDATE);
201    
202                    return dlFileEntryLocalService.checkOutFileEntry(
203                            getUserId(), fileEntryId, owner, expirationTime, serviceContext);
204            }
205    
206            @Override
207            public DLFileEntry copyFileEntry(
208                            long groupId, long repositoryId, long fileEntryId,
209                            long destFolderId, ServiceContext serviceContext)
210                    throws PortalException, SystemException {
211    
212                    DLFileEntry dlFileEntry = getFileEntry(fileEntryId);
213    
214                    String sourceFileName = "A";
215    
216                    String extension = dlFileEntry.getExtension();
217    
218                    if (Validator.isNotNull(extension)) {
219                            sourceFileName = sourceFileName.concat(StringPool.PERIOD).concat(
220                                    extension);
221                    }
222    
223                    InputStream inputStream = DLStoreUtil.getFileAsStream(
224                            dlFileEntry.getCompanyId(), dlFileEntry.getDataRepositoryId(),
225                            dlFileEntry.getName());
226    
227                    DLFileEntry newDlFileEntry = addFileEntry(
228                            groupId, repositoryId, destFolderId, sourceFileName,
229                            dlFileEntry.getMimeType(), dlFileEntry.getTitle(),
230                            dlFileEntry.getDescription(), null,
231                            dlFileEntry.getFileEntryTypeId(), null, null, inputStream,
232                            dlFileEntry.getSize(), serviceContext);
233    
234                    DLFileVersion dlFileVersion = dlFileEntry.getFileVersion();
235    
236                    DLFileVersion newDlFileVersion = newDlFileEntry.getFileVersion();
237    
238                    ExpandoBridgeUtil.copyExpandoBridgeAttributes(
239                            dlFileVersion.getExpandoBridge(),
240                            newDlFileVersion.getExpandoBridge());
241    
242                    dlFileEntryLocalService.copyFileEntryMetadata(
243                            dlFileVersion.getCompanyId(), dlFileVersion.getFileEntryTypeId(),
244                            fileEntryId, newDlFileVersion.getFileVersionId(),
245                            dlFileVersion.getFileVersionId(), serviceContext);
246    
247                    return newDlFileEntry;
248            }
249    
250            @Override
251            public void deleteFileEntry(long fileEntryId)
252                    throws PortalException, SystemException {
253    
254                    DLFileEntryPermission.check(
255                            getPermissionChecker(), fileEntryId, ActionKeys.DELETE);
256    
257                    dlFileEntryLocalService.deleteFileEntry(getUserId(), fileEntryId);
258            }
259    
260            @Override
261            public void deleteFileEntry(long groupId, long folderId, String title)
262                    throws PortalException, SystemException {
263    
264                    DLFileEntry dlFileEntry = getFileEntry(groupId, folderId, title);
265    
266                    deleteFileEntry(dlFileEntry.getFileEntryId());
267            }
268    
269            @Override
270            public void deleteFileVersion(long fileEntryId, String version)
271                    throws PortalException, SystemException {
272    
273                    DLFileEntryPermission.check(
274                            getPermissionChecker(), fileEntryId, ActionKeys.DELETE);
275    
276                    dlFileEntryLocalService.deleteFileVersion(
277                            getUserId(), fileEntryId, version);
278            }
279    
280            @Override
281            public DLFileEntry fetchFileEntryByImageId(long imageId)
282                    throws PortalException, SystemException {
283    
284                    DLFileEntry dlFileEntry = dlFileEntryFinder.fetchByAnyImageId(imageId);
285    
286                    if (dlFileEntry != null) {
287                            DLFileEntryPermission.check(
288                                    getPermissionChecker(), dlFileEntry, ActionKeys.VIEW);
289                    }
290    
291                    return dlFileEntry;
292            }
293    
294            @Override
295            public InputStream getFileAsStream(long fileEntryId, String version)
296                    throws PortalException, SystemException {
297    
298                    DLFileEntryPermission.check(
299                            getPermissionChecker(), fileEntryId, ActionKeys.VIEW);
300    
301                    return dlFileEntryLocalService.getFileAsStream(fileEntryId, version);
302            }
303    
304            @Override
305            public InputStream getFileAsStream(
306                            long fileEntryId, String version, boolean incrementCounter)
307                    throws PortalException, SystemException {
308    
309                    DLFileEntryPermission.check(
310                            getPermissionChecker(), fileEntryId, ActionKeys.VIEW);
311    
312                    return dlFileEntryLocalService.getFileAsStream(
313                            fileEntryId, version, incrementCounter);
314            }
315    
316            @Override
317            public List<DLFileEntry> getFileEntries(
318                            long groupId, long folderId, int status, int start, int end,
319                            OrderByComparator obc)
320                    throws PortalException, SystemException {
321    
322                    DLFolderPermission.check(
323                            getPermissionChecker(), groupId, folderId, ActionKeys.VIEW);
324    
325                    List<Long> folderIds = new ArrayList<Long>();
326    
327                    folderIds.add(folderId);
328    
329                    QueryDefinition queryDefinition = new QueryDefinition(
330                            status, false, start, end, obc);
331    
332                    return dlFileEntryFinder.filterFindByG_F(
333                            groupId, folderIds, queryDefinition);
334            }
335    
336            @Override
337            public List<DLFileEntry> getFileEntries(
338                            long groupId, long folderId, int start, int end,
339                            OrderByComparator obc)
340                    throws PortalException, SystemException {
341    
342                    return getFileEntries(
343                            groupId, folderId, WorkflowConstants.STATUS_APPROVED, start, end,
344                            obc);
345            }
346    
347            @Override
348            public List<DLFileEntry> getFileEntries(
349                            long groupId, long folderId, long fileEntryTypeId, int start,
350                            int end, OrderByComparator obc)
351                    throws PortalException, SystemException {
352    
353                    DLFolderPermission.check(
354                            getPermissionChecker(), groupId, folderId, ActionKeys.VIEW);
355    
356                    return dlFileEntryPersistence.filterFindByG_F_F(
357                            groupId, folderId, fileEntryTypeId, start, end, obc);
358            }
359    
360            @Override
361            public List<DLFileEntry> getFileEntries(
362                            long groupId, long folderId, String[] mimeTypes, int start, int end,
363                            OrderByComparator obc)
364                    throws PortalException, SystemException {
365    
366                    DLFolderPermission.check(
367                            getPermissionChecker(), groupId, folderId, ActionKeys.VIEW);
368    
369                    List<Long> folderIds = new ArrayList<Long>();
370    
371                    folderIds.add(folderId);
372    
373                    QueryDefinition queryDefinition = new QueryDefinition(
374                            WorkflowConstants.STATUS_IN_TRASH, true, start, end, obc);
375    
376                    return dlFileEntryFinder.filterFindByG_U_F_M(
377                            groupId, 0, folderIds, mimeTypes, queryDefinition);
378            }
379    
380            @Override
381            public int getFileEntriesCount(long groupId, long folderId)
382                    throws SystemException {
383    
384                    return getFileEntriesCount(
385                            groupId, folderId, WorkflowConstants.STATUS_APPROVED);
386            }
387    
388            @Override
389            public int getFileEntriesCount(long groupId, long folderId, int status)
390                    throws SystemException {
391    
392                    List<Long> folderIds = new ArrayList<Long>();
393    
394                    folderIds.add(folderId);
395    
396                    return dlFileEntryFinder.filterCountByG_F(
397                            groupId, folderIds, new QueryDefinition(status));
398            }
399    
400            @Override
401            public int getFileEntriesCount(
402                            long groupId, long folderId, long fileEntryTypeId)
403                    throws SystemException {
404    
405                    return dlFileEntryPersistence.filterCountByG_F_F(
406                            groupId, folderId, fileEntryTypeId);
407            }
408    
409            @Override
410            public int getFileEntriesCount(
411                            long groupId, long folderId, String[] mimeTypes)
412                    throws SystemException {
413    
414                    List<Long> folderIds = new ArrayList<Long>();
415    
416                    folderIds.add(folderId);
417    
418                    return dlFileEntryFinder.filterCountByG_U_F_M(
419                            groupId, 0, folderIds, mimeTypes,
420                            new QueryDefinition(WorkflowConstants.STATUS_ANY));
421            }
422    
423            @Override
424            public DLFileEntry getFileEntry(long fileEntryId)
425                    throws PortalException, SystemException {
426    
427                    DLFileEntryPermission.check(
428                            getPermissionChecker(), fileEntryId, ActionKeys.VIEW);
429    
430                    return dlFileEntryLocalService.getFileEntry(fileEntryId);
431            }
432    
433            @Override
434            public DLFileEntry getFileEntry(long groupId, long folderId, String title)
435                    throws PortalException, SystemException {
436    
437                    DLFileEntry dlFileEntry = dlFileEntryLocalService.getFileEntry(
438                            groupId, folderId, title);
439    
440                    DLFileEntryPermission.check(
441                            getPermissionChecker(), dlFileEntry, ActionKeys.VIEW);
442    
443                    return dlFileEntry;
444            }
445    
446            @Override
447            public DLFileEntry getFileEntryByUuidAndGroupId(String uuid, long groupId)
448                    throws PortalException, SystemException {
449    
450                    DLFileEntry dlFileEntry = dlFileEntryPersistence.findByUUID_G(
451                            uuid, groupId);
452    
453                    DLFileEntryPermission.check(
454                            getPermissionChecker(), dlFileEntry, ActionKeys.VIEW);
455    
456                    return dlFileEntry;
457            }
458    
459            @Override
460            public Lock getFileEntryLock(long fileEntryId) {
461                    try {
462                            return lockLocalService.getLock(
463                                    DLFileEntry.class.getName(), fileEntryId);
464                    }
465                    catch (Exception e) {
466                            return null;
467                    }
468            }
469    
470            @Override
471            public int getFoldersFileEntriesCount(
472                            long groupId, List<Long> folderIds, int status)
473                    throws SystemException {
474    
475                    QueryDefinition queryDefinition = new QueryDefinition(status);
476    
477                    if (folderIds.size() <= PropsValues.SQL_DATA_MAX_PARAMETERS) {
478                            return dlFileEntryFinder.filterCountByG_F(
479                                    groupId, folderIds, queryDefinition);
480                    }
481                    else {
482                            int start = 0;
483                            int end = PropsValues.SQL_DATA_MAX_PARAMETERS;
484    
485                            int filesCount = dlFileEntryFinder.filterCountByG_F(
486                                    groupId, folderIds.subList(start, end), queryDefinition);
487    
488                            folderIds.subList(start, end).clear();
489    
490                            filesCount += getFoldersFileEntriesCount(
491                                    groupId, folderIds, status);
492    
493                            return filesCount;
494                    }
495            }
496    
497            @Override
498            public List<DLFileEntry> getGroupFileEntries(
499                            long groupId, long userId, long rootFolderId, int start, int end,
500                            OrderByComparator obc)
501                    throws PortalException, SystemException {
502    
503                    List<Long> folderIds = dlFolderService.getFolderIds(
504                            groupId, rootFolderId);
505    
506                    if (folderIds.size() == 0) {
507                            return Collections.emptyList();
508                    }
509                    else if (userId <= 0) {
510                            return dlFileEntryPersistence.filterFindByG_F(
511                                    groupId, ArrayUtil.toLongArray(folderIds), start, end, obc);
512                    }
513                    else {
514                            return dlFileEntryPersistence.filterFindByG_U_F(
515                                    groupId, userId, ArrayUtil.toLongArray(folderIds), start, end,
516                                    obc);
517                    }
518            }
519    
520            @Override
521            public List<DLFileEntry> getGroupFileEntries(
522                            long groupId, long userId, long rootFolderId, String[] mimeTypes,
523                            int status, int start, int end, OrderByComparator obc)
524                    throws PortalException, SystemException {
525    
526                    return getGroupFileEntries(
527                            groupId, userId, rootFolderId, 0, mimeTypes, status, start, end,
528                            obc);
529            }
530    
531            @Override
532            public List<DLFileEntry> getGroupFileEntries(
533                            long groupId, long userId, long repositoryId, long rootFolderId,
534                            String[] mimeTypes, int status, int start, int end,
535                            OrderByComparator obc)
536                    throws PortalException, SystemException {
537    
538                    List<Long> repositoryIds = new ArrayList<Long>();
539    
540                    if (repositoryId != 0) {
541                            repositoryIds.add(repositoryId);
542                    }
543    
544                    QueryDefinition queryDefinition = new QueryDefinition(
545                            status, start, end, obc);
546    
547                    if (rootFolderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
548                            return dlFileEntryFinder.filterFindByG_U_R_F_M(
549                                    groupId, userId, repositoryIds, new ArrayList<Long>(),
550                                    mimeTypes, queryDefinition);
551                    }
552    
553                    List<Long> folderIds = dlFolderService.getFolderIds(
554                            groupId, rootFolderId);
555    
556                    if (folderIds.size() == 0) {
557                            return Collections.emptyList();
558                    }
559    
560                    return dlFileEntryFinder.filterFindByG_U_R_F_M(
561                            groupId, userId, repositoryIds, folderIds, mimeTypes,
562                            queryDefinition);
563            }
564    
565            @Override
566            public int getGroupFileEntriesCount(
567                            long groupId, long userId, long rootFolderId)
568                    throws PortalException, SystemException {
569    
570                    List<Long> folderIds = dlFolderService.getFolderIds(
571                            groupId, rootFolderId);
572    
573                    if (folderIds.size() == 0) {
574                            return 0;
575                    }
576                    else if (userId <= 0) {
577                            return dlFileEntryPersistence.filterCountByG_F(
578                                    groupId, ArrayUtil.toLongArray(folderIds));
579                    }
580                    else {
581                            return dlFileEntryPersistence.filterCountByG_U_F(
582                                    groupId, userId, ArrayUtil.toLongArray(folderIds));
583                    }
584            }
585    
586            @Override
587            public int getGroupFileEntriesCount(
588                            long groupId, long userId, long rootFolderId, String[] mimeTypes,
589                            int status)
590                    throws PortalException, SystemException {
591    
592                    return getGroupFileEntriesCount(
593                            groupId, userId, 0, rootFolderId, mimeTypes, status);
594            }
595    
596            @Override
597            public int getGroupFileEntriesCount(
598                            long groupId, long userId, long repositoryId, long rootFolderId,
599                            String[] mimeTypes, int status)
600                    throws PortalException, SystemException {
601    
602                    List<Long> repositoryIds = new ArrayList<Long>();
603    
604                    if (repositoryId != 0) {
605                            repositoryIds.add(repositoryId);
606                    }
607    
608                    if (rootFolderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
609                            return dlFileEntryFinder.filterCountByG_U_R_F_M(
610                                    groupId, userId, repositoryIds, new ArrayList<Long>(),
611                                    mimeTypes, new QueryDefinition(status));
612                    }
613    
614                    List<Long> folderIds = dlFolderService.getFolderIds(
615                            groupId, rootFolderId);
616    
617                    if (folderIds.size() == 0) {
618                            return 0;
619                    }
620    
621                    return dlFileEntryFinder.filterCountByG_U_R_F_M(
622                            groupId, userId, repositoryIds, folderIds, mimeTypes,
623                            new QueryDefinition(status));
624            }
625    
626            @Override
627            public boolean hasFileEntryLock(long fileEntryId)
628                    throws PortalException, SystemException {
629    
630                    DLFileEntry dlFileEntry = dlFileEntryLocalService.getFileEntry(
631                            fileEntryId);
632    
633                    long folderId = dlFileEntry.getFolderId();
634    
635                    boolean hasLock = lockLocalService.hasLock(
636                            getUserId(), DLFileEntry.class.getName(), fileEntryId);
637    
638                    if (!hasLock &&
639                            (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) {
640    
641                            hasLock = dlFolderService.hasInheritableLock(folderId);
642                    }
643    
644                    return hasLock;
645            }
646    
647            @Override
648            public boolean isFileEntryCheckedOut(long fileEntryId)
649                    throws PortalException, SystemException {
650    
651                    return dlFileEntryLocalService.isFileEntryCheckedOut(fileEntryId);
652            }
653    
654            @Override
655            public DLFileEntry moveFileEntry(
656                            long fileEntryId, long newFolderId, ServiceContext serviceContext)
657                    throws PortalException, SystemException {
658    
659                    PermissionChecker permissionChecker = getPermissionChecker();
660    
661                    DLFileEntryPermission.check(
662                            permissionChecker, fileEntryId, ActionKeys.UPDATE);
663    
664                    DLFolderPermission.check(
665                            permissionChecker, serviceContext.getScopeGroupId(), newFolderId,
666                            ActionKeys.ADD_DOCUMENT);
667    
668                    return dlFileEntryLocalService.moveFileEntry(
669                            getUserId(), fileEntryId, newFolderId, serviceContext);
670            }
671    
672            @Override
673            public Lock refreshFileEntryLock(
674                            String lockUuid, long companyId, long expirationTime)
675                    throws PortalException, SystemException {
676    
677                    return lockLocalService.refresh(lockUuid, companyId, expirationTime);
678            }
679    
680            @Override
681            public void revertFileEntry(
682                            long fileEntryId, String version, ServiceContext serviceContext)
683                    throws PortalException, SystemException {
684    
685                    DLFileEntryPermission.check(
686                            getPermissionChecker(), fileEntryId, ActionKeys.UPDATE);
687    
688                    dlFileEntryLocalService.revertFileEntry(
689                            getUserId(), fileEntryId, version, serviceContext);
690            }
691    
692            @Override
693            public Hits search(
694                            long groupId, long creatorUserId, int status, int start, int end)
695                    throws PortalException, SystemException {
696    
697                    return dlFileEntryLocalService.search(
698                            groupId, getUserId(), creatorUserId, status, start, end);
699            }
700    
701            @Override
702            public Hits search(
703                            long groupId, long creatorUserId, long folderId, String[] mimeTypes,
704                            int status, int start, int end)
705                    throws PortalException, SystemException {
706    
707                    return dlFileEntryLocalService.search(
708                            groupId, getUserId(), creatorUserId, folderId, mimeTypes, status,
709                            start, end);
710            }
711    
712            @Override
713            public DLFileEntry updateFileEntry(
714                            long fileEntryId, String sourceFileName, String mimeType,
715                            String title, String description, String changeLog,
716                            boolean majorVersion, long fileEntryTypeId,
717                            Map<String, Fields> fieldsMap, File file, InputStream is, long size,
718                            ServiceContext serviceContext)
719                    throws PortalException, SystemException {
720    
721                    DLFileEntryPermission.check(
722                            getPermissionChecker(), fileEntryId, ActionKeys.UPDATE);
723    
724                    return dlFileEntryLocalService.updateFileEntry(
725                            getUserId(), fileEntryId, sourceFileName, mimeType, title,
726                            description, changeLog, majorVersion, fileEntryTypeId, fieldsMap,
727                            file, is, size, serviceContext);
728            }
729    
730            @Override
731            public boolean verifyFileEntryCheckOut(long fileEntryId, String lockUuid)
732                    throws PortalException, SystemException {
733    
734                    return dlFileEntryLocalService.verifyFileEntryCheckOut(
735                            fileEntryId, lockUuid);
736            }
737    
738            @Override
739            public boolean verifyFileEntryLock(long fileEntryId, String lockUuid)
740                    throws PortalException, SystemException {
741    
742                    return dlFileEntryLocalService.verifyFileEntryLock(
743                            fileEntryId, lockUuid);
744            }
745    
746    }