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.portal.kernel.repository.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.repository.model.FileEntry;
019    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
020    import com.liferay.portal.service.ServiceContext;
021    
022    /**
023     * @author Adolfo P??rez
024     */
025    public class RepositoryTrashUtil {
026    
027            public static RepositoryTrash getRepositoryTrash() {
028                    PortalRuntimePermission.checkGetBeanProperty(RepositoryTrashUtil.class);
029    
030                    return _repositoryTrash;
031            }
032    
033            public static FileEntry moveFileEntryFromTrash(
034                            long userId, long repositoryId, long fileEntryId, long newFolderId,
035                            ServiceContext serviceContext)
036                    throws PortalException {
037    
038                    return getRepositoryTrash().moveFileEntryFromTrash(
039                            userId, repositoryId, fileEntryId, newFolderId, serviceContext);
040            }
041    
042            public static FileEntry moveFileEntryToTrash(
043                            long userId, long repositoryId, long fileEntryId)
044                    throws PortalException {
045    
046                    return getRepositoryTrash().moveFileEntryToTrash(
047                            userId, repositoryId, fileEntryId);
048            }
049    
050            public static void restoreFileEntryFromTrash(
051                            long userId, long repositoryId, long fileEntryId)
052                    throws PortalException {
053    
054                    getRepositoryTrash().restoreFileEntryFromTrash(
055                            userId, repositoryId, fileEntryId);
056            }
057    
058            public void setRepositoryTrash(RepositoryTrash repositoryTrash) {
059                    PortalRuntimePermission.checkSetBeanProperty(getClass());
060    
061                    _repositoryTrash = repositoryTrash;
062            }
063    
064            private static RepositoryTrash _repositoryTrash;
065    
066    }