001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Florent Guillaume 018 */ 019package org.nuxeo.ecm.core.trash; 020 021import java.util.List; 022import java.util.Set; 023 024import org.nuxeo.common.utils.Path; 025import org.nuxeo.ecm.core.api.DocumentModel; 026import org.nuxeo.ecm.core.api.DocumentRef; 027import org.nuxeo.ecm.core.api.NuxeoPrincipal; 028 029/** 030 * Service containing the logic about deleting/purging/undeleting a document. 031 * 032 * @deprecated since 10.2, use {@link org.nuxeo.ecm.core.api.trash.TrashService} instead. 033 */ 034@Deprecated 035public interface TrashService extends org.nuxeo.ecm.core.api.trash.TrashService { 036 037 /** 038 * Can a child of the folder be trashed? 039 * 040 * @param folder the folder 041 * @return {@code true} if the folder allows its children to be trashed 042 * @deprecated since 10.1 only used in JSF part, no replacement 043 */ 044 @Deprecated 045 boolean folderAllowsDelete(DocumentModel folder); 046 047 /** 048 * Is at least one doc deletable according to its container? 049 * 050 * @param docs the documents 051 * @return {@code true} if one doc is in a folder that allows its children to be trashed 052 * @deprecated since 10.1 only used in JSF part, no replacement 053 */ 054 @Deprecated 055 boolean checkDeletePermOnParents(List<DocumentModel> docs); 056 057 /** 058 * Is at least one doc deletable? 059 * 060 * @param docs the documents 061 * @param principal the current user (to check locks) 062 * @param checkProxies {@code true} to count proxies as non-deletable 063 * @return {@code true} if at least one doc is deletable 064 * @deprecated since 10.1 only used in JSF part, no replacement 065 */ 066 @Deprecated 067 boolean canDelete(List<DocumentModel> docs, NuxeoPrincipal principal, boolean checkProxies); 068 069 /** 070 * Are all documents purgeable/undeletable? 071 * <p> 072 * Documents need to be in the trash for this to be true, in addition to the standard permission checks. 073 * 074 * @param docs the documents 075 * @param principal the current user (to check locks) 076 * @return {@code true} if the documents are purgeable/undeletable 077 * @deprecated since 10.1, use {@link #canPurgeOrUntrash(List, NuxeoPrincipal)} 078 */ 079 @Deprecated 080 default boolean canPurgeOrUndelete(List<DocumentModel> docs, NuxeoPrincipal principal) { 081 return canPurgeOrUntrash(docs, principal); 082 } 083 084 /** 085 * Gets the trash info for a list of documents. 086 * 087 * @param docs the documents 088 * @param principal the current user (to check locks) 089 * @param checkProxies {@code true} to count proxies as non-deletable 090 * @param checkDeleted {@code true} if documents have to be in the trashed state to be considered (otherwise 091 * forbidden) 092 * @return the trash info 093 * @deprecated since 10.1 only used in JSF part, no replacement 094 */ 095 @Deprecated 096 TrashInfo getTrashInfo(List<DocumentModel> docs, NuxeoPrincipal principal, boolean checkProxies, boolean checkDeleted); 097 098 /** 099 * Gets the closest document's ancestor above all the paths. 100 * <p> 101 * This is used to find what safe document to redirect to when deleting some. 102 * 103 * @param doc the document 104 * @param paths the paths 105 * @return the closer document above doc and above all the paths 106 * @deprecated since 10.1 only used in JSF part, use {@link #getAboveDocument(DocumentModel, NuxeoPrincipal)} 107 * instead. 108 */ 109 @Deprecated 110 DocumentModel getAboveDocument(DocumentModel doc, Set<Path> paths); 111 112 /** 113 * Undeletes documents (and ancestors if needed to make them visible). 114 * <p> 115 * Also fires async events to untrash the children. 116 * 117 * @param docs the documents to undelete 118 * @return the set of ancestors whose children have been untrashed (for UI notification) 119 * @deprecated since 10.1 use {@link #untrashDocuments(List)} instead 120 */ 121 @Deprecated 122 Set<DocumentRef> undeleteDocuments(List<DocumentModel> docs); 123 124}