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