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.ExpiredLockException;
018    import com.liferay.portal.InvalidLockException;
019    import com.liferay.portal.NoSuchLockException;
020    import com.liferay.portal.NoSuchWorkflowDefinitionLinkException;
021    import com.liferay.portal.kernel.dao.orm.QueryDefinition;
022    import com.liferay.portal.kernel.dao.orm.QueryUtil;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.increment.BufferedIncrement;
026    import com.liferay.portal.kernel.increment.DateOverrideIncrement;
027    import com.liferay.portal.kernel.lar.ExportImportThreadLocal;
028    import com.liferay.portal.kernel.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.search.Indexable;
031    import com.liferay.portal.kernel.search.IndexableType;
032    import com.liferay.portal.kernel.search.Indexer;
033    import com.liferay.portal.kernel.search.IndexerRegistryUtil;
034    import com.liferay.portal.kernel.systemevent.SystemEvent;
035    import com.liferay.portal.kernel.util.ObjectValuePair;
036    import com.liferay.portal.kernel.util.OrderByComparator;
037    import com.liferay.portal.kernel.util.ParamUtil;
038    import com.liferay.portal.kernel.util.StringPool;
039    import com.liferay.portal.kernel.util.TreeModelFinder;
040    import com.liferay.portal.kernel.util.TreePathUtil;
041    import com.liferay.portal.kernel.util.Validator;
042    import com.liferay.portal.kernel.workflow.WorkflowConstants;
043    import com.liferay.portal.model.Group;
044    import com.liferay.portal.model.Lock;
045    import com.liferay.portal.model.Repository;
046    import com.liferay.portal.model.ResourceConstants;
047    import com.liferay.portal.model.SystemEventConstants;
048    import com.liferay.portal.model.TreeModel;
049    import com.liferay.portal.model.User;
050    import com.liferay.portal.model.WorkflowDefinitionLink;
051    import com.liferay.portal.repository.liferayrepository.model.LiferayFolder;
052    import com.liferay.portal.service.ServiceContext;
053    import com.liferay.portlet.documentlibrary.DuplicateFileException;
054    import com.liferay.portlet.documentlibrary.DuplicateFolderNameException;
055    import com.liferay.portlet.documentlibrary.FolderNameException;
056    import com.liferay.portlet.documentlibrary.InvalidFolderException;
057    import com.liferay.portlet.documentlibrary.NoSuchDirectoryException;
058    import com.liferay.portlet.documentlibrary.NoSuchFileEntryException;
059    import com.liferay.portlet.documentlibrary.NoSuchFolderException;
060    import com.liferay.portlet.documentlibrary.model.DLFileEntryType;
061    import com.liferay.portlet.documentlibrary.model.DLFileEntryTypeConstants;
062    import com.liferay.portlet.documentlibrary.model.DLFolder;
063    import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
064    import com.liferay.portlet.documentlibrary.model.impl.DLFolderImpl;
065    import com.liferay.portlet.documentlibrary.service.base.DLFolderLocalServiceBaseImpl;
066    import com.liferay.portlet.documentlibrary.store.DLStoreUtil;
067    import com.liferay.portlet.documentlibrary.util.comparator.FolderIdComparator;
068    
069    import java.io.Serializable;
070    
071    import java.util.ArrayList;
072    import java.util.Collections;
073    import java.util.Date;
074    import java.util.List;
075    import java.util.Map;
076    
077    /**
078     * @author Brian Wing Shun Chan
079     * @author Alexander Chow
080     */
081    public class DLFolderLocalServiceImpl extends DLFolderLocalServiceBaseImpl {
082    
083            @Override
084            public DLFolder addFolder(
085                            long userId, long groupId, long repositoryId, boolean mountPoint,
086                            long parentFolderId, String name, String description,
087                            boolean hidden, ServiceContext serviceContext)
088                    throws PortalException, SystemException {
089    
090                    // Folder
091    
092                    User user = userPersistence.findByPrimaryKey(userId);
093                    parentFolderId = getParentFolderId(
094                            groupId, repositoryId, parentFolderId);
095                    Date now = new Date();
096    
097                    validateFolder(groupId, parentFolderId, name);
098    
099                    long folderId = counterLocalService.increment();
100    
101                    DLFolder dlFolder = dlFolderPersistence.create(folderId);
102    
103                    dlFolder.setUuid(serviceContext.getUuid());
104                    dlFolder.setGroupId(groupId);
105                    dlFolder.setCompanyId(user.getCompanyId());
106                    dlFolder.setUserId(user.getUserId());
107                    dlFolder.setUserName(user.getFullName());
108                    dlFolder.setCreateDate(serviceContext.getCreateDate(now));
109                    dlFolder.setModifiedDate(serviceContext.getModifiedDate(now));
110                    dlFolder.setRepositoryId(repositoryId);
111                    dlFolder.setMountPoint(mountPoint);
112                    dlFolder.setParentFolderId(parentFolderId);
113                    dlFolder.setTreePath(dlFolder.buildTreePath());
114                    dlFolder.setName(name);
115                    dlFolder.setDescription(description);
116                    dlFolder.setLastPostDate(now);
117                    dlFolder.setHidden(hidden);
118                    dlFolder.setOverrideFileEntryTypes(false);
119                    dlFolder.setExpandoBridgeAttributes(serviceContext);
120    
121                    dlFolderPersistence.update(dlFolder);
122    
123                    // Resources
124    
125                    if (serviceContext.isAddGroupPermissions() ||
126                            serviceContext.isAddGuestPermissions()) {
127    
128                            addFolderResources(
129                                    dlFolder, serviceContext.isAddGroupPermissions(),
130                                    serviceContext.isAddGuestPermissions());
131                    }
132                    else {
133                            if (serviceContext.isDeriveDefaultPermissions()) {
134                                    serviceContext.deriveDefaultPermissions(
135                                            repositoryId, DLFolderConstants.getClassName());
136                            }
137    
138                            addFolderResources(
139                                    dlFolder, serviceContext.getGroupPermissions(),
140                                    serviceContext.getGuestPermissions());
141                    }
142    
143                    // Parent folder
144    
145                    if (parentFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
146                            dlFolderLocalService.updateLastPostDate(parentFolderId, now);
147                    }
148    
149                    // App helper
150    
151                    dlAppHelperLocalService.addFolder(
152                            userId, new LiferayFolder(dlFolder), serviceContext);
153    
154                    return dlFolder;
155            }
156    
157            /**
158             * @deprecated As of 6.2.0, replaced by more general {@link #addFolder(long,
159             *             long, long, boolean, long, String, String, boolean,
160             *             ServiceContext)}
161             */
162            @Override
163            public DLFolder addFolder(
164                            long userId, long groupId, long repositoryId, boolean mountPoint,
165                            long parentFolderId, String name, String description,
166                            ServiceContext serviceContext)
167                    throws PortalException, SystemException {
168    
169                    return addFolder(
170                            userId, groupId, repositoryId, mountPoint, parentFolderId, name,
171                            description, false, serviceContext);
172            }
173    
174            /**
175             * @deprecated As of 7.0.0, replaced by {@link #deleteAllByGroup(long)}
176             */
177            @Override
178            public void deleteAll(long groupId)
179                    throws PortalException, SystemException {
180    
181                    deleteAllByGroup(groupId);
182            }
183    
184            @Override
185            public void deleteAllByGroup(long groupId)
186                    throws PortalException, SystemException {
187    
188                    Group group = groupLocalService.getGroup(groupId);
189    
190                    List<DLFolder> dlFolders = dlFolderPersistence.findByGroupId(groupId);
191    
192                    for (DLFolder dlFolder : dlFolders) {
193                            dlFolderLocalService.deleteFolder(dlFolder);
194                    }
195    
196                    dlFileEntryLocalService.deleteFileEntries(
197                            groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
198    
199                    dlFileEntryTypeLocalService.deleteFileEntryTypes(groupId);
200    
201                    dlFileShortcutLocalService.deleteFileShortcuts(
202                            groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
203    
204                    try {
205                            DLStoreUtil.deleteDirectory(
206                                    group.getCompanyId(), groupId, StringPool.BLANK);
207                    }
208                    catch (NoSuchDirectoryException nsde) {
209                            if (_log.isDebugEnabled()) {
210                                    _log.debug(nsde.getMessage());
211                            }
212                    }
213            }
214    
215            @Override
216            public void deleteAllByRepository(long repositoryId)
217                    throws PortalException, SystemException {
218    
219                    Repository repository = repositoryLocalService.fetchRepository(
220                            repositoryId);
221    
222                    long groupId = repositoryId;
223    
224                    if (repository != null) {
225                            groupId = repository.getGroupId();
226                    }
227    
228                    Group group = groupLocalService.getGroup(groupId);
229    
230                    List<DLFolder> dlFolders = dlFolderPersistence.findByRepositoryIdList(
231                            repositoryId);
232    
233                    for (DLFolder dlFolder : dlFolders) {
234                            dlFolderLocalService.deleteFolder(dlFolder);
235                    }
236    
237                    if (repository != null) {
238                            dlFileEntryLocalService.deleteRepositoryFileEntries(
239                                    repository.getRepositoryId(), repository.getDlFolderId());
240                    }
241                    else {
242                            dlFileEntryLocalService.deleteFileEntries(
243                                    groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
244    
245                            dlFileShortcutLocalService.deleteFileShortcuts(
246                                    groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
247                    }
248    
249                    try {
250                            DLStoreUtil.deleteDirectory(
251                                    group.getCompanyId(), repositoryId, StringPool.BLANK);
252                    }
253                    catch (NoSuchDirectoryException nsde) {
254                            if (_log.isDebugEnabled()) {
255                                    _log.debug(nsde.getMessage());
256                            }
257                    }
258            }
259    
260            @Indexable(type = IndexableType.DELETE)
261            @Override
262            @SystemEvent(
263                    action = SystemEventConstants.ACTION_SKIP, send = false,
264                    type = SystemEventConstants.TYPE_DELETE)
265            public DLFolder deleteFolder(DLFolder dlFolder)
266                    throws PortalException, SystemException {
267    
268                    return deleteFolder(dlFolder, true);
269            }
270    
271            @Indexable(type = IndexableType.DELETE)
272            @Override
273            @SystemEvent(
274                    action = SystemEventConstants.ACTION_SKIP, send = false,
275                    type = SystemEventConstants.TYPE_DELETE)
276            public DLFolder deleteFolder(
277                            DLFolder dlFolder, boolean includeTrashedEntries)
278                    throws PortalException, SystemException {
279    
280                    // Folders
281    
282                    List<DLFolder> dlFolders = dlFolderPersistence.findByG_P(
283                            dlFolder.getGroupId(), dlFolder.getFolderId());
284    
285                    for (DLFolder curDLFolder : dlFolders) {
286                            if (includeTrashedEntries || !curDLFolder.isInTrashExplicitly()) {
287                                    dlFolderLocalService.deleteFolder(
288                                            curDLFolder, includeTrashedEntries);
289                            }
290                    }
291    
292                    // Resources
293    
294                    resourceLocalService.deleteResource(
295                            dlFolder.getCompanyId(), DLFolder.class.getName(),
296                            ResourceConstants.SCOPE_INDIVIDUAL, dlFolder.getFolderId());
297    
298                    // WebDAVProps
299    
300                    webDAVPropsLocalService.deleteWebDAVProps(
301                            DLFolder.class.getName(), dlFolder.getFolderId());
302    
303                    // File entries
304    
305                    dlFileEntryLocalService.deleteFileEntries(
306                            dlFolder.getGroupId(), dlFolder.getFolderId(),
307                            includeTrashedEntries);
308    
309                    // File entry types
310    
311                    List<Long> fileEntryTypeIds = new ArrayList<Long>();
312    
313                    for (DLFileEntryType dlFileEntryType :
314                                    dlFileEntryTypeLocalService.getDLFolderDLFileEntryTypes(
315                                            dlFolder.getFolderId())) {
316    
317                            fileEntryTypeIds.add(dlFileEntryType.getFileEntryTypeId());
318                    }
319    
320                    if (fileEntryTypeIds.isEmpty()) {
321                            fileEntryTypeIds.add(
322                                    DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_ALL);
323                    }
324    
325                    dlFileEntryTypeLocalService.unsetFolderFileEntryTypes(
326                            dlFolder.getFolderId());
327    
328                    // File shortcuts
329    
330                    dlFileShortcutLocalService.deleteFileShortcuts(
331                            dlFolder.getGroupId(), dlFolder.getFolderId(),
332                            includeTrashedEntries);
333    
334                    // Expando
335    
336                    expandoRowLocalService.deleteRows(dlFolder.getFolderId());
337    
338                    // App helper
339    
340                    dlAppHelperLocalService.deleteFolder(new LiferayFolder(dlFolder));
341    
342                    // Folder
343    
344                    dlFolderPersistence.remove(dlFolder);
345    
346                    // Directory
347    
348                    try {
349                            if (includeTrashedEntries) {
350                                    DLStoreUtil.deleteDirectory(
351                                            dlFolder.getCompanyId(), dlFolder.getFolderId(),
352                                            StringPool.BLANK);
353                            }
354                    }
355                    catch (NoSuchDirectoryException nsde) {
356                            if (_log.isDebugEnabled()) {
357                                    _log.debug(nsde.getMessage());
358                            }
359                    }
360    
361                    // Workflow
362    
363                    for (long fileEntryTypeId : fileEntryTypeIds) {
364                            WorkflowDefinitionLink workflowDefinitionLink = null;
365    
366                            try {
367                                    workflowDefinitionLink =
368                                            workflowDefinitionLinkLocalService.
369                                                    getWorkflowDefinitionLink(
370                                                            dlFolder.getCompanyId(), dlFolder.getGroupId(),
371                                                            DLFolder.class.getName(), dlFolder.getFolderId(),
372                                                            fileEntryTypeId);
373                            }
374                            catch (NoSuchWorkflowDefinitionLinkException nswdle) {
375                                    continue;
376                            }
377    
378                            workflowDefinitionLinkLocalService.deleteWorkflowDefinitionLink(
379                                    workflowDefinitionLink);
380                    }
381    
382                    return dlFolder;
383            }
384    
385            @Indexable(type = IndexableType.DELETE)
386            @Override
387            public DLFolder deleteFolder(long folderId)
388                    throws PortalException, SystemException {
389    
390                    return dlFolderLocalService.deleteFolder(folderId, true);
391            }
392    
393            @Indexable(type = IndexableType.DELETE)
394            @Override
395            public DLFolder deleteFolder(long folderId, boolean includeTrashedEntries)
396                    throws PortalException, SystemException {
397    
398                    DLFolder dlFolder = dlFolderPersistence.findByPrimaryKey(folderId);
399    
400                    return dlFolderLocalService.deleteFolder(
401                            dlFolder, includeTrashedEntries);
402            }
403    
404            @Indexable(type = IndexableType.DELETE)
405            @Override
406            public DLFolder deleteFolder(
407                            long userId, long folderId, boolean includeTrashedEntries)
408                    throws PortalException, SystemException {
409    
410                    boolean hasLock = hasFolderLock(userId, folderId);
411    
412                    Lock lock = null;
413    
414                    if (!hasLock) {
415    
416                            // Lock
417    
418                            lock = lockFolder(
419                                    userId, folderId, null, false,
420                                    DLFolderImpl.LOCK_EXPIRATION_TIME);
421                    }
422    
423                    try {
424                            return deleteFolder(folderId, includeTrashedEntries);
425                    }
426                    finally {
427                            if (!hasLock) {
428    
429                                    // Unlock
430    
431                                    unlockFolder(folderId, lock.getUuid());
432                            }
433                    }
434            }
435    
436            @Override
437            public DLFolder fetchFolder(long folderId) throws SystemException {
438                    return dlFolderPersistence.fetchByPrimaryKey(folderId);
439            }
440    
441            @Override
442            public DLFolder fetchFolder(long groupId, long parentFolderId, String name)
443                    throws SystemException {
444    
445                    return dlFolderPersistence.fetchByG_P_N(groupId, parentFolderId, name);
446            }
447    
448            @Override
449            public List<DLFolder> getCompanyFolders(long companyId, int start, int end)
450                    throws SystemException {
451    
452                    return dlFolderPersistence.findByCompanyId(companyId, start, end);
453            }
454    
455            @Override
456            public int getCompanyFoldersCount(long companyId) throws SystemException {
457                    return dlFolderPersistence.countByCompanyId(companyId);
458            }
459    
460            /**
461             * @deprecated As of 6.2.0, replaced by {@link
462             *             #getFileEntriesAndFileShortcuts(long, long, QueryDefinition)}
463             */
464            @Override
465            public List<Object> getFileEntriesAndFileShortcuts(
466                            long groupId, long folderId, int status, int start, int end)
467                    throws SystemException {
468    
469                    QueryDefinition queryDefinition = new QueryDefinition(
470                            status, start, end, null);
471    
472                    return getFileEntriesAndFileShortcuts(
473                            groupId, folderId, queryDefinition);
474            }
475    
476            @Override
477            public List<Object> getFileEntriesAndFileShortcuts(
478                            long groupId, long folderId, QueryDefinition queryDefinition)
479                    throws SystemException {
480    
481                    return dlFolderFinder.findFE_FS_ByG_F(
482                            groupId, folderId, queryDefinition);
483            }
484    
485            /**
486             * @deprecated As of 6.2.0, replaced by {@link
487             *             #getFileEntriesAndFileShortcutsCount(long, long,
488             *             QueryDefinition)}
489             */
490            @Override
491            public int getFileEntriesAndFileShortcutsCount(
492                            long groupId, long folderId, int status)
493                    throws SystemException {
494    
495                    QueryDefinition queryDefinition = new QueryDefinition(status);
496    
497                    return getFileEntriesAndFileShortcutsCount(
498                            groupId, folderId, queryDefinition);
499            }
500    
501            @Override
502            public int getFileEntriesAndFileShortcutsCount(
503                            long groupId, long folderId, QueryDefinition queryDefinition)
504                    throws SystemException {
505    
506                    return dlFolderFinder.countFE_FS_ByG_F(
507                            groupId, folderId, queryDefinition);
508            }
509    
510            @Override
511            public DLFolder getFolder(long folderId)
512                    throws PortalException, SystemException {
513    
514                    return dlFolderPersistence.findByPrimaryKey(folderId);
515            }
516    
517            @Override
518            public DLFolder getFolder(long groupId, long parentFolderId, String name)
519                    throws PortalException, SystemException {
520    
521                    return dlFolderPersistence.findByG_P_N(groupId, parentFolderId, name);
522            }
523    
524            @Override
525            public long getFolderId(long companyId, long folderId)
526                    throws SystemException {
527    
528                    if (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
529    
530                            // Ensure folder exists and belongs to the proper company
531    
532                            DLFolder dlFolder = dlFolderPersistence.fetchByPrimaryKey(folderId);
533    
534                            if ((dlFolder == null) || (companyId != dlFolder.getCompanyId())) {
535                                    folderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
536                            }
537                    }
538    
539                    return folderId;
540            }
541    
542            @Override
543            public List<DLFolder> getFolders(long groupId, long parentFolderId)
544                    throws SystemException {
545    
546                    return getFolders(groupId, parentFolderId, true);
547            }
548    
549            @Override
550            public List<DLFolder> getFolders(
551                            long groupId, long parentFolderId, boolean includeMountfolders)
552                    throws SystemException {
553    
554                    if (includeMountfolders) {
555                            return dlFolderPersistence.findByG_P(groupId, parentFolderId);
556                    }
557                    else {
558                            return dlFolderPersistence.findByG_M_P_H(
559                                    groupId, false, parentFolderId, false);
560                    }
561            }
562    
563            @Override
564            public List<DLFolder> getFolders(
565                            long groupId, long parentFolderId, boolean includeMountfolders,
566                            int start, int end, OrderByComparator obc)
567                    throws SystemException {
568    
569                    if (includeMountfolders) {
570                            return dlFolderPersistence.findByG_P(
571                                    groupId, parentFolderId, start, end, obc);
572                    }
573                    else {
574                            return dlFolderPersistence.findByG_M_P_H(
575                                    groupId, false, parentFolderId, false, start, end, obc);
576                    }
577            }
578    
579            @Override
580            public List<DLFolder> getFolders(
581                            long groupId, long parentFolderId, int start, int end,
582                            OrderByComparator obc)
583                    throws SystemException {
584    
585                    return getFolders(groupId, parentFolderId, true, start, end, obc);
586            }
587    
588            /**
589             * @deprecated As of 6.2.0, replaced by {@link
590             *             #getFoldersAndFileEntriesAndFileShortcuts(long, long,
591             *             String[], boolean, QueryDefinition)}
592             */
593            @Override
594            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
595                            long groupId, long folderId, int status,
596                            boolean includeMountFolders, int start, int end,
597                            OrderByComparator obc)
598                    throws SystemException {
599    
600                    QueryDefinition queryDefinition = new QueryDefinition(
601                            status, start, end, obc);
602    
603                    return getFoldersAndFileEntriesAndFileShortcuts(
604                            groupId, folderId, null, includeMountFolders, queryDefinition);
605            }
606    
607            /**
608             * @deprecated As of 6.2.0, replaced by {@link
609             *             #getFoldersAndFileEntriesAndFileShortcutsCount(long, long,
610             *             String[], boolean, QueryDefinition)}
611             */
612            @Override
613            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
614                            long groupId, long folderId, int status, String[] mimeTypes,
615                            boolean includeMountFolders, int start, int end,
616                            OrderByComparator obc)
617                    throws SystemException {
618    
619                    QueryDefinition queryDefinition = new QueryDefinition(
620                            status, start, end, obc);
621    
622                    return getFoldersAndFileEntriesAndFileShortcuts(
623                            groupId, folderId, mimeTypes, includeMountFolders, queryDefinition);
624            }
625    
626            @Override
627            public List<Object> getFoldersAndFileEntriesAndFileShortcuts(
628                            long groupId, long folderId, String[] mimeTypes,
629                            boolean includeMountFolders, QueryDefinition queryDefinition)
630                    throws SystemException {
631    
632                    return dlFolderFinder.findF_FE_FS_ByG_F_M_M(
633                            groupId, folderId, mimeTypes, includeMountFolders, queryDefinition);
634            }
635    
636            /**
637             * @deprecated As of 6.2.0, replaced by {@link
638             *             #getFoldersAndFileEntriesAndFileShortcutsCount(long, long,
639             *             String[], boolean, QueryDefinition)}
640             */
641            @Override
642            public int getFoldersAndFileEntriesAndFileShortcutsCount(
643                            long groupId, long folderId, int status,
644                            boolean includeMountFolders)
645                    throws SystemException {
646    
647                    QueryDefinition queryDefinition = new QueryDefinition(status);
648    
649                    return getFoldersAndFileEntriesAndFileShortcutsCount(
650                            groupId, folderId, null, includeMountFolders, queryDefinition);
651            }
652    
653            /**
654             * @deprecated As of 6.2.0, replaced by {@link
655             *             #getFoldersAndFileEntriesAndFileShortcutsCount(long, long,
656             *             String[], boolean, QueryDefinition)}
657             */
658            @Override
659            public int getFoldersAndFileEntriesAndFileShortcutsCount(
660                            long groupId, long folderId, int status, String[] mimeTypes,
661                            boolean includeMountFolders)
662                    throws SystemException {
663    
664                    QueryDefinition queryDefinition = new QueryDefinition(status);
665    
666                    return getFoldersAndFileEntriesAndFileShortcutsCount(
667                            groupId, folderId, mimeTypes, includeMountFolders, queryDefinition);
668            }
669    
670            @Override
671            public int getFoldersAndFileEntriesAndFileShortcutsCount(
672                            long groupId, long folderId, String[] mimeTypes,
673                            boolean includeMountFolders, QueryDefinition queryDefinition)
674                    throws SystemException {
675    
676                    return dlFolderFinder.countF_FE_FS_ByG_F_M_M(
677                            groupId, folderId, mimeTypes, includeMountFolders, queryDefinition);
678            }
679    
680            @Override
681            public int getFoldersCount(long groupId, long parentFolderId)
682                    throws SystemException {
683    
684                    return getFoldersCount(groupId, parentFolderId, true);
685            }
686    
687            @Override
688            public int getFoldersCount(
689                            long groupId, long parentFolderId, boolean includeMountfolders)
690                    throws SystemException {
691    
692                    if (includeMountfolders) {
693                            return dlFolderPersistence.countByG_P(groupId, parentFolderId);
694                    }
695                    else {
696                            return dlFolderPersistence.countByG_M_P_H(
697                                    groupId, false, parentFolderId, false);
698                    }
699            }
700    
701            @Override
702            public int getFoldersCount(
703                            long groupId, long parentFolderId, int status,
704                            boolean includeMountfolders)
705                    throws SystemException {
706    
707                    if (includeMountfolders) {
708                            return dlFolderPersistence.countByG_P_H_S(
709                                    groupId, parentFolderId, false, status);
710                    }
711                    else {
712                            return dlFolderPersistence.countByG_M_P_H_S(
713                                    groupId, false, parentFolderId, false, status);
714                    }
715            }
716    
717            @Override
718            public DLFolder getMountFolder(long repositoryId)
719                    throws PortalException, SystemException {
720    
721                    return dlFolderPersistence.findByRepositoryId(repositoryId);
722            }
723    
724            @Override
725            public List<DLFolder> getMountFolders(
726                            long groupId, long parentFolderId, int start, int end,
727                            OrderByComparator obc)
728                    throws SystemException {
729    
730                    return dlFolderPersistence.findByG_M_P_H(
731                            groupId, true, parentFolderId, false, start, end, obc);
732            }
733    
734            @Override
735            public int getMountFoldersCount(long groupId, long parentFolderId)
736                    throws SystemException {
737    
738                    return dlFolderPersistence.countByG_M_P_H(
739                            groupId, true, parentFolderId, false);
740            }
741    
742            @Override
743            public List<DLFolder> getNoAssetFolders() throws SystemException {
744                    return dlFolderFinder.findF_ByNoAssets();
745            }
746    
747            @Override
748            public void getSubfolderIds(
749                            List<Long> folderIds, long groupId, long folderId)
750                    throws SystemException {
751    
752                    List<DLFolder> dlFolders = dlFolderPersistence.findByG_P(
753                            groupId, folderId);
754    
755                    for (DLFolder dlFolder : dlFolders) {
756                            folderIds.add(dlFolder.getFolderId());
757    
758                            getSubfolderIds(
759                                    folderIds, dlFolder.getGroupId(), dlFolder.getFolderId());
760                    }
761            }
762    
763            @Override
764            public boolean hasFolderLock(long userId, long folderId)
765                    throws SystemException {
766    
767                    return lockLocalService.hasLock(
768                            userId, DLFolder.class.getName(), folderId);
769            }
770    
771            @Override
772            public Lock lockFolder(long userId, long folderId)
773                    throws PortalException, SystemException {
774    
775                    return lockFolder(
776                            userId, folderId, null, false, DLFolderImpl.LOCK_EXPIRATION_TIME);
777            }
778    
779            @Override
780            public Lock lockFolder(
781                            long userId, long folderId, String owner, boolean inheritable,
782                            long expirationTime)
783                    throws PortalException, SystemException {
784    
785                    if ((expirationTime <= 0) ||
786                            (expirationTime > DLFolderImpl.LOCK_EXPIRATION_TIME)) {
787    
788                            expirationTime = DLFolderImpl.LOCK_EXPIRATION_TIME;
789                    }
790    
791                    return lockLocalService.lock(
792                            userId, DLFolder.class.getName(), folderId, owner, inheritable,
793                            expirationTime);
794            }
795    
796            @Indexable(type = IndexableType.REINDEX)
797            @Override
798            public DLFolder moveFolder(
799                            long userId, long folderId, long parentFolderId,
800                            ServiceContext serviceContext)
801                    throws PortalException, SystemException {
802    
803                    DLFolder dlFolder = dlFolderPersistence.findByPrimaryKey(folderId);
804    
805                    parentFolderId = getParentFolderId(dlFolder, parentFolderId);
806    
807                    if (dlFolder.getParentFolderId() == parentFolderId) {
808                            return dlFolder;
809                    }
810    
811                    boolean hasLock = hasFolderLock(userId, folderId);
812    
813                    Lock lock = null;
814    
815                    if (!hasLock) {
816    
817                            // Lock
818    
819                            lock = lockFolder(userId, folderId);
820                    }
821    
822                    try {
823                            validateFolder(
824                                    dlFolder.getFolderId(), dlFolder.getGroupId(), parentFolderId,
825                                    dlFolder.getName());
826    
827                            dlFolder.setModifiedDate(serviceContext.getModifiedDate(null));
828                            dlFolder.setParentFolderId(parentFolderId);
829                            dlFolder.setTreePath(dlFolder.buildTreePath());
830                            dlFolder.setExpandoBridgeAttributes(serviceContext);
831    
832                            dlFolderPersistence.update(dlFolder);
833    
834                            dlAppHelperLocalService.moveFolder(new LiferayFolder(dlFolder));
835    
836                            rebuildTree(
837                                    dlFolder.getCompanyId(), folderId, dlFolder.getTreePath(),
838                                    true);
839    
840                            return dlFolder;
841                    }
842                    finally {
843                            if (!hasLock) {
844    
845                                    // Unlock
846    
847                                    unlockFolder(folderId, lock.getUuid());
848                            }
849                    }
850            }
851    
852            @Override
853            public void rebuildTree(long companyId)
854                    throws PortalException, SystemException {
855    
856                    rebuildTree(
857                            companyId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
858                            StringPool.SLASH, false);
859            }
860    
861            @Override
862            public void rebuildTree(
863                            long companyId, long parentFolderId, String parentTreePath,
864                            final boolean reindex)
865                    throws PortalException, SystemException {
866    
867                    TreePathUtil.rebuildTree(
868                            companyId, parentFolderId, parentTreePath,
869                            new TreeModelFinder<DLFolder>() {
870    
871                                    @Override
872                                    public List<DLFolder> findTreeModels(
873                                                    long previousId, long companyId, long parentPrimaryKey,
874                                                    int size)
875                                            throws SystemException {
876    
877                                            return dlFolderPersistence.findByF_C_P_NotS(
878                                                    previousId, companyId, parentPrimaryKey,
879                                                    WorkflowConstants.STATUS_IN_TRASH, QueryUtil.ALL_POS,
880                                                    size, new FolderIdComparator());
881                                    }
882    
883                                    @Override
884                                    public void rebuildDependentModelsTreePaths(
885                                                    long parentPrimaryKey, String treePath)
886                                            throws PortalException, SystemException {
887    
888                                            dlFileEntryLocalService.setTreePaths(
889                                                    parentPrimaryKey, treePath, false);
890                                            dlFileShortcutLocalService.setTreePaths(
891                                                    parentPrimaryKey, treePath);
892                                            dlFileVersionLocalService.setTreePaths(
893                                                    parentPrimaryKey, treePath);
894                                    }
895    
896                                    @Override
897                                    public void reindexTreeModels(List<TreeModel> treeModels)
898                                            throws PortalException {
899    
900                                            if (!reindex) {
901                                                    return;
902                                            }
903    
904                                            Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(
905                                                    DLFolder.class);
906    
907                                            for (TreeModel treeModel : treeModels) {
908                                                    indexer.reindex(treeModel);
909                                            }
910                                    }
911                            }
912                    );
913            }
914    
915            @Override
916            public void unlockFolder(
917                            long groupId, long parentFolderId, String name, String lockUuid)
918                    throws PortalException, SystemException {
919    
920                    DLFolder dlFolder = getFolder(groupId, parentFolderId, name);
921    
922                    unlockFolder(dlFolder.getFolderId(), lockUuid);
923            }
924    
925            @Override
926            public void unlockFolder(long folderId, String lockUuid)
927                    throws PortalException, SystemException {
928    
929                    if (Validator.isNotNull(lockUuid)) {
930                            try {
931                                    Lock lock = lockLocalService.getLock(
932                                            DLFolder.class.getName(), folderId);
933    
934                                    if (!lockUuid.equals(lock.getUuid())) {
935                                            throw new InvalidLockException("UUIDs do not match");
936                                    }
937                            }
938                            catch (PortalException pe) {
939                                    if (pe instanceof ExpiredLockException ||
940                                            pe instanceof NoSuchLockException) {
941                                    }
942                                    else {
943                                            throw pe;
944                                    }
945                            }
946                    }
947    
948                    lockLocalService.unlock(DLFolder.class.getName(), folderId);
949            }
950    
951            @Indexable(type = IndexableType.REINDEX)
952            @Override
953            public DLFolder updateFolder(
954                            long folderId, long parentFolderId, String name, String description,
955                            long defaultFileEntryTypeId, List<Long> fileEntryTypeIds,
956                            boolean overrideFileEntryTypes, ServiceContext serviceContext)
957                    throws PortalException, SystemException {
958    
959                    boolean hasLock = hasFolderLock(serviceContext.getUserId(), folderId);
960    
961                    Lock lock = null;
962    
963                    if (!hasLock) {
964    
965                            // Lock
966    
967                            lock = lockFolder(
968                                    serviceContext.getUserId(), folderId, null, false,
969                                    DLFolderImpl.LOCK_EXPIRATION_TIME);
970                    }
971    
972                    try {
973    
974                            // File entry types
975    
976                            DLFolder dlFolder = null;
977    
978                            if (folderId > DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
979                                    dlFolder = dlFolderLocalService.updateFolderAndFileEntryTypes(
980                                            serviceContext.getUserId(), folderId, parentFolderId, name,
981                                            description, defaultFileEntryTypeId, fileEntryTypeIds,
982                                            overrideFileEntryTypes, serviceContext);
983    
984                                    dlFileEntryTypeLocalService.cascadeFileEntryTypes(
985                                            serviceContext.getUserId(), dlFolder);
986                            }
987    
988                            // Workflow definitions
989    
990                            List<ObjectValuePair<Long, String>> workflowDefinitionOVPs =
991                                    new ArrayList<ObjectValuePair<Long, String>>();
992    
993                            if (fileEntryTypeIds.isEmpty()) {
994                                    fileEntryTypeIds.add(
995                                            DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_ALL);
996                            }
997                            else {
998                                    workflowDefinitionOVPs.add(
999                                            new ObjectValuePair<Long, String>(
1000                                                    DLFileEntryTypeConstants.FILE_ENTRY_TYPE_ID_ALL,
1001                                                    StringPool.BLANK));
1002                            }
1003    
1004                            for (long fileEntryTypeId : fileEntryTypeIds) {
1005                                    String workflowDefinition = StringPool.BLANK;
1006    
1007                                    if (overrideFileEntryTypes ||
1008                                            (folderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) {
1009    
1010                                            workflowDefinition = ParamUtil.getString(
1011                                                    serviceContext, "workflowDefinition" + fileEntryTypeId);
1012                                    }
1013    
1014                                    workflowDefinitionOVPs.add(
1015                                            new ObjectValuePair<Long, String>(
1016                                                    fileEntryTypeId, workflowDefinition));
1017                            }
1018    
1019                            workflowDefinitionLinkLocalService.updateWorkflowDefinitionLinks(
1020                                    serviceContext.getUserId(), serviceContext.getCompanyId(),
1021                                    serviceContext.getScopeGroupId(), DLFolder.class.getName(),
1022                                    folderId, workflowDefinitionOVPs);
1023    
1024                            return dlFolder;
1025                    }
1026                    finally {
1027                            if (!hasLock) {
1028    
1029                                    // Unlock
1030    
1031                                    unlockFolder(folderId, lock.getUuid());
1032                            }
1033                    }
1034            }
1035    
1036            @Indexable(type = IndexableType.REINDEX)
1037            @Override
1038            public DLFolder updateFolder(
1039                            long folderId, String name, String description,
1040                            long defaultFileEntryTypeId, List<Long> fileEntryTypeIds,
1041                            boolean overrideFileEntryTypes, ServiceContext serviceContext)
1042                    throws PortalException, SystemException {
1043    
1044                    long parentFolderId = DLFolderConstants.DEFAULT_PARENT_FOLDER_ID;
1045    
1046                    if (folderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
1047                            DLFolder dlFolder = getDLFolder(folderId);
1048    
1049                            parentFolderId = dlFolder.getParentFolderId();
1050                    }
1051    
1052                    return updateFolder(
1053                            folderId, parentFolderId, name, description, defaultFileEntryTypeId,
1054                            fileEntryTypeIds, overrideFileEntryTypes, serviceContext);
1055            }
1056    
1057            @Override
1058            public DLFolder updateFolderAndFileEntryTypes(
1059                            long userId, long folderId, long parentFolderId, String name,
1060                            String description, long defaultFileEntryTypeId,
1061                            List<Long> fileEntryTypeIds, boolean overrideFileEntryTypes,
1062                            ServiceContext serviceContext)
1063                    throws PortalException, SystemException {
1064    
1065                    boolean hasLock = hasFolderLock(userId, folderId);
1066    
1067                    Lock lock = null;
1068    
1069                    if (!hasLock) {
1070    
1071                            // Lock
1072    
1073                            lock = lockFolder(
1074                                    userId, folderId, null, false,
1075                                    DLFolderImpl.LOCK_EXPIRATION_TIME);
1076                    }
1077    
1078                    try {
1079    
1080                            // Folder
1081    
1082                            if (!overrideFileEntryTypes) {
1083                                    fileEntryTypeIds = Collections.emptyList();
1084                            }
1085    
1086                            DLFolder dlFolder = dlFolderPersistence.findByPrimaryKey(folderId);
1087    
1088                            parentFolderId = getParentFolderId(dlFolder, parentFolderId);
1089    
1090                            validateFolder(
1091                                    folderId, dlFolder.getGroupId(), parentFolderId, name);
1092    
1093                            long oldParentFolderId = dlFolder.getParentFolderId();
1094    
1095                            if (oldParentFolderId != parentFolderId) {
1096                                    dlFolder.setParentFolderId(parentFolderId);
1097                                    dlFolder.setTreePath(dlFolder.buildTreePath());
1098                            }
1099    
1100                            dlFolder.setModifiedDate(serviceContext.getModifiedDate(null));
1101                            dlFolder.setName(name);
1102                            dlFolder.setDescription(description);
1103                            dlFolder.setExpandoBridgeAttributes(serviceContext);
1104                            dlFolder.setOverrideFileEntryTypes(overrideFileEntryTypes);
1105                            dlFolder.setDefaultFileEntryTypeId(defaultFileEntryTypeId);
1106    
1107                            dlFolderPersistence.update(dlFolder);
1108    
1109                            // File entry types
1110    
1111                            if (fileEntryTypeIds != null) {
1112                                    dlFileEntryTypeLocalService.updateFolderFileEntryTypes(
1113                                            dlFolder, fileEntryTypeIds, defaultFileEntryTypeId,
1114                                            serviceContext);
1115                            }
1116    
1117                            // App helper
1118    
1119                            dlAppHelperLocalService.updateFolder(
1120                                    userId, new LiferayFolder(dlFolder), serviceContext);
1121    
1122                            if (oldParentFolderId != parentFolderId) {
1123                                    rebuildTree(
1124                                            dlFolder.getCompanyId(), folderId, dlFolder.getTreePath(),
1125                                            true);
1126                            }
1127    
1128                            return dlFolder;
1129                    }
1130                    finally {
1131                            if (!hasLock) {
1132    
1133                                    // Unlock
1134    
1135                                    unlockFolder(folderId, lock.getUuid());
1136                            }
1137                    }
1138            }
1139    
1140            @BufferedIncrement(
1141                    configuration = "DLFolderEntry",
1142                    incrementClass = DateOverrideIncrement.class)
1143            @Override
1144            public void updateLastPostDate(long folderId, Date lastPostDate)
1145                    throws PortalException, SystemException {
1146    
1147                    if (ExportImportThreadLocal.isImportInProcess() ||
1148                            (folderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) ||
1149                            (lastPostDate == null)) {
1150    
1151                            return;
1152                    }
1153    
1154                    DLFolder dlFolder = dlFolderPersistence.findByPrimaryKey(folderId);
1155    
1156                    if (lastPostDate.before(dlFolder.getLastPostDate())) {
1157                            return;
1158                    }
1159    
1160                    dlFolder.setLastPostDate(lastPostDate);
1161    
1162                    dlFolderPersistence.update(dlFolder);
1163            }
1164    
1165            @Override
1166            public DLFolder updateStatus(
1167                            long userId, long folderId, int status,
1168                            Map<String, Serializable> workflowContext,
1169                            ServiceContext serviceContext)
1170                    throws PortalException, SystemException {
1171    
1172                    // Folder
1173    
1174                    User user = userPersistence.findByPrimaryKey(userId);
1175    
1176                    DLFolder dlFolder = dlFolderPersistence.findByPrimaryKey(folderId);
1177    
1178                    int oldStatus = dlFolder.getStatus();
1179    
1180                    dlFolder.setStatus(status);
1181                    dlFolder.setStatusByUserId(user.getUserId());
1182                    dlFolder.setStatusByUserName(user.getFullName());
1183                    dlFolder.setStatusDate(new Date());
1184    
1185                    dlFolderPersistence.update(dlFolder);
1186    
1187                    // Asset
1188    
1189                    if (status == WorkflowConstants.STATUS_APPROVED) {
1190                            assetEntryLocalService.updateVisible(
1191                                    DLFolder.class.getName(), dlFolder.getFolderId(), true);
1192                    }
1193                    else if (status == WorkflowConstants.STATUS_IN_TRASH) {
1194                            assetEntryLocalService.updateVisible(
1195                                    DLFolder.class.getName(), dlFolder.getFolderId(), false);
1196                    }
1197    
1198                    // Indexer
1199    
1200                    if (((status == WorkflowConstants.STATUS_APPROVED) ||
1201                             (status == WorkflowConstants.STATUS_IN_TRASH) ||
1202                             (oldStatus == WorkflowConstants.STATUS_IN_TRASH)) &&
1203                            ((serviceContext == null) || serviceContext.isIndexingEnabled())) {
1204    
1205                            Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(
1206                                    DLFolderConstants.getClassName());
1207    
1208                            indexer.reindex(dlFolder);
1209                    }
1210    
1211                    return dlFolder;
1212            }
1213    
1214            protected void addFolderResources(
1215                            DLFolder dlFolder, boolean addGroupPermissions,
1216                            boolean addGuestPermissions)
1217                    throws PortalException, SystemException {
1218    
1219                    resourceLocalService.addResources(
1220                            dlFolder.getCompanyId(), dlFolder.getGroupId(),
1221                            dlFolder.getUserId(), DLFolder.class.getName(),
1222                            dlFolder.getFolderId(), false, addGroupPermissions,
1223                            addGuestPermissions);
1224            }
1225    
1226            protected void addFolderResources(
1227                            DLFolder dlFolder, String[] groupPermissions,
1228                            String[] guestPermissions)
1229                    throws PortalException, SystemException {
1230    
1231                    resourceLocalService.addModelResources(
1232                            dlFolder.getCompanyId(), dlFolder.getGroupId(),
1233                            dlFolder.getUserId(), DLFolder.class.getName(),
1234                            dlFolder.getFolderId(), groupPermissions, guestPermissions);
1235            }
1236    
1237            protected void addFolderResources(
1238                            long folderId, boolean addGroupPermissions,
1239                            boolean addGuestPermissions)
1240                    throws PortalException, SystemException {
1241    
1242                    DLFolder dlFolder = dlFolderPersistence.findByPrimaryKey(folderId);
1243    
1244                    addFolderResources(dlFolder, addGroupPermissions, addGuestPermissions);
1245            }
1246    
1247            protected void addFolderResources(
1248                            long folderId, String[] groupPermissions, String[] guestPermissions)
1249                    throws PortalException, SystemException {
1250    
1251                    DLFolder dlFolder = dlFolderPersistence.findByPrimaryKey(folderId);
1252    
1253                    addFolderResources(dlFolder, groupPermissions, guestPermissions);
1254            }
1255    
1256            protected long getParentFolderId(DLFolder dlFolder, long parentFolderId)
1257                    throws PortalException, SystemException {
1258    
1259                    parentFolderId = getParentFolderId(
1260                            dlFolder.getGroupId(), dlFolder.getRepositoryId(), parentFolderId);
1261    
1262                    if (parentFolderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
1263                            return parentFolderId;
1264                    }
1265    
1266                    if (dlFolder.getFolderId() == parentFolderId) {
1267                            throw new InvalidFolderException(
1268                                    InvalidFolderException.CANNOT_MOVE_INTO_ITSELF, parentFolderId);
1269                    }
1270    
1271                    List<Long> subfolderIds = new ArrayList<Long>();
1272    
1273                    getSubfolderIds(
1274                            subfolderIds, dlFolder.getGroupId(), dlFolder.getFolderId());
1275    
1276                    if (subfolderIds.contains(parentFolderId)) {
1277                            throw new InvalidFolderException(
1278                                    InvalidFolderException.CANNOT_MOVE_INTO_CHILD_FOLDER,
1279                                    parentFolderId);
1280                    }
1281    
1282                    return parentFolderId;
1283            }
1284    
1285            protected long getParentFolderId(
1286                            long groupId, long repositoryId, long parentFolderId)
1287                    throws PortalException, SystemException {
1288    
1289                    if (parentFolderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
1290                            return parentFolderId;
1291                    }
1292    
1293                    DLFolder parentDLFolder = dlFolderPersistence.findByPrimaryKey(
1294                            parentFolderId);
1295    
1296                    if (parentDLFolder.getGroupId() != groupId) {
1297                            throw new NoSuchFolderException(
1298                                    String.format(
1299                                            "No folder exists with the primary key %s in group %s",
1300                                            parentFolderId, groupId));
1301                    }
1302    
1303                    if ((parentDLFolder.getRepositoryId() != repositoryId) &&
1304                            (parentDLFolder.getRepositoryId() != groupId)) {
1305    
1306                            Repository repository = repositoryLocalService.getRepository(
1307                                    repositoryId);
1308    
1309                            if (repository.getGroupId() != parentDLFolder.getGroupId()) {
1310                                    throw new NoSuchFolderException(
1311                                            String.format(
1312                                                    "No folder exists with the primary key %s in " +
1313                                                            "repository %s",
1314                                                    parentFolderId, repositoryId));
1315                            }
1316                    }
1317    
1318                    return parentDLFolder.getFolderId();
1319            }
1320    
1321            protected void validateFolder(
1322                            long folderId, long groupId, long parentFolderId, String name)
1323                    throws PortalException, SystemException {
1324    
1325                    validateFolderName(name);
1326    
1327                    DLStoreUtil.validateDirectoryName(name);
1328    
1329                    try {
1330                            dlFileEntryLocalService.getFileEntry(groupId, parentFolderId, name);
1331    
1332                            throw new DuplicateFileException(name);
1333                    }
1334                    catch (NoSuchFileEntryException nsfee) {
1335                    }
1336    
1337                    DLFolder dlFolder = dlFolderPersistence.fetchByG_P_N(
1338                            groupId, parentFolderId, name);
1339    
1340                    if ((dlFolder != null) && (dlFolder.getFolderId() != folderId)) {
1341                            throw new DuplicateFolderNameException(name);
1342                    }
1343            }
1344    
1345            protected void validateFolder(
1346                            long groupId, long parentFolderId, String name)
1347                    throws PortalException, SystemException {
1348    
1349                    long folderId = 0;
1350    
1351                    validateFolder(folderId, groupId, parentFolderId, name);
1352            }
1353    
1354            protected void validateFolderName(String folderName)
1355                    throws PortalException {
1356    
1357                    if (folderName.contains(StringPool.SLASH)) {
1358                            throw new FolderNameException(folderName);
1359                    }
1360            }
1361    
1362            private static Log _log = LogFactoryUtil.getLog(
1363                    DLFolderLocalServiceImpl.class);
1364    
1365    }