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