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.trash.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.exception.PortalException; 020 import com.liferay.portal.kernel.exception.SystemException; 021 import com.liferay.portal.kernel.jsonwebservice.JSONWebService; 022 import com.liferay.portal.kernel.security.access.control.AccessControlled; 023 import com.liferay.portal.kernel.transaction.Isolation; 024 import com.liferay.portal.kernel.transaction.Propagation; 025 import com.liferay.portal.kernel.transaction.Transactional; 026 import com.liferay.portal.service.BaseService; 027 028 /** 029 * Provides the remote service interface for TrashEntry. Methods of this 030 * service are expected to have security checks based on the propagated JAAS 031 * credentials because this service can be accessed remotely. 032 * 033 * @author Brian Wing Shun Chan 034 * @see TrashEntryServiceUtil 035 * @see com.liferay.portlet.trash.service.base.TrashEntryServiceBaseImpl 036 * @see com.liferay.portlet.trash.service.impl.TrashEntryServiceImpl 037 * @generated 038 */ 039 @AccessControlled 040 @JSONWebService 041 @ProviderType 042 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 043 PortalException.class, SystemException.class}) 044 public interface TrashEntryService extends BaseService { 045 /* 046 * NOTE FOR DEVELOPERS: 047 * 048 * Never modify or reference this interface directly. Always use {@link TrashEntryServiceUtil} to access the trash entry remote service. Add custom service methods to {@link com.liferay.portlet.trash.service.impl.TrashEntryServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 049 */ 050 051 /** 052 * Deletes the trash entries with the primary keys. 053 * 054 * @param entryIds the primary keys of the trash entries 055 * @throws PortalException if a trash entry with the primary key could not 056 be found or if the user did not have permission to delete any one 057 of the trash entries 058 */ 059 @Transactional(noRollbackFor = { 060 com.liferay.portal.TrashPermissionException.class} 061 ) 062 public void deleteEntries(long[] entryIds) throws PortalException; 063 064 /** 065 * Deletes the trash entries with the matching group ID considering 066 * permissions. 067 * 068 * @param groupId the primary key of the group 069 * @throws PortalException if a portal exception occurred 070 */ 071 @Transactional(noRollbackFor = { 072 com.liferay.portal.TrashPermissionException.class} 073 ) 074 public void deleteEntries(long groupId) throws PortalException; 075 076 /** 077 * Deletes the trash entry with the entity class name and class primary key. 078 * 079 * <p> 080 * This method throws a {@link TrashPermissionException} with type {@link 081 * TrashPermissionException#DELETE} if the user did not have permission to 082 * delete the trash entry. 083 * </p> 084 * 085 * @param className the class name of the entity 086 * @param classPK the primary key of the entity 087 * @throws PortalException if a trash entry with the entity class name and 088 primary key could not be found or if the user did not have 089 permission to delete the entry 090 */ 091 public void deleteEntry(java.lang.String className, long classPK) 092 throws PortalException; 093 094 /** 095 * Deletes the trash entry with the primary key. 096 * 097 * <p> 098 * This method throws a {@link TrashPermissionException} with type {@link 099 * TrashPermissionException#DELETE} if the user did not have permission to 100 * delete the trash entry. 101 * </p> 102 * 103 * @param entryId the primary key of the trash entry 104 * @throws PortalException if a trash entry with the primary key could not 105 be found or if the user did not have permission to delete the 106 trash entry 107 */ 108 public void deleteEntry(long entryId) throws PortalException; 109 110 /** 111 * Returns the Spring bean ID for this bean. 112 * 113 * @return the Spring bean ID for this bean 114 */ 115 public java.lang.String getBeanIdentifier(); 116 117 /** 118 * Returns the trash entries with the matching group ID. 119 * 120 * @param groupId the primary key of the group 121 * @return the matching trash entries 122 * @throws PrincipalException if a principal exception occurred 123 */ 124 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 125 public com.liferay.portlet.trash.model.TrashEntryList getEntries( 126 long groupId) 127 throws com.liferay.portal.security.auth.PrincipalException; 128 129 /** 130 * Returns a range of all the trash entries matching the group ID. 131 * 132 * @param groupId the primary key of the group 133 * @param start the lower bound of the range of trash entries to return 134 * @param end the upper bound of the range of trash entries to return (not 135 inclusive) 136 * @param obc the comparator to order the trash entries (optionally 137 <code>null</code>) 138 * @return the range of matching trash entries ordered by comparator 139 <code>obc</code> 140 * @throws PrincipalException if a system exception occurred 141 */ 142 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 143 public com.liferay.portlet.trash.model.TrashEntryList getEntries( 144 long groupId, int start, int end, 145 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.trash.model.TrashEntry> obc) 146 throws com.liferay.portal.security.auth.PrincipalException; 147 148 /** 149 * Moves the trash entry with the entity class name and primary key, 150 * restoring it to a new location identified by the destination container 151 * model ID. 152 * 153 * <p> 154 * This method throws a {@link TrashPermissionException} if the user did not 155 * have the permission to perform one of the necessary operations. The 156 * exception is created with a type specific to the operation: 157 * </p> 158 * 159 * <ul> 160 * <li> 161 * {@link TrashPermissionException#MOVE} - if the user did not have 162 * permission to move the trash entry to the new 163 * destination 164 * </li> 165 * <li> 166 * {@link TrashPermissionException#RESTORE} - if the user did not have 167 * permission to restore the trash entry 168 * </li> 169 * </ul> 170 * 171 * @param className the class name of the entity 172 * @param classPK the primary key of the entity 173 * @param destinationContainerModelId the primary key of the new location 174 * @param serviceContext the service context to be applied (optionally 175 <code>null</code>) 176 * @throws PortalException if a matching trash entry could not be found, if 177 the user did not have permission to move the trash entry to the 178 new location, if the user did not have permission to restore the 179 trash entry, if a duplicate trash entry exists at the new 180 location, or if a portal exception occurred 181 */ 182 public void moveEntry(java.lang.String className, long classPK, 183 long destinationContainerModelId, 184 com.liferay.portal.service.ServiceContext serviceContext) 185 throws PortalException; 186 187 public com.liferay.portlet.trash.model.TrashEntry restoreEntry( 188 java.lang.String className, long classPK) throws PortalException; 189 190 public com.liferay.portlet.trash.model.TrashEntry restoreEntry( 191 java.lang.String className, long classPK, long overrideClassPK, 192 java.lang.String name) throws PortalException; 193 194 public com.liferay.portlet.trash.model.TrashEntry restoreEntry(long entryId) 195 throws PortalException; 196 197 /** 198 * Restores the trash entry to its original location. In order to handle a 199 * duplicate trash entry already existing at the original location, either 200 * pass in the primary key of the existing trash entry's entity to overwrite 201 * or pass in a new name to give to the trash entry being restored. 202 * 203 * <p> 204 * This method throws a {@link TrashPermissionException} if the user did not 205 * have the permission to perform one of the necessary operations. The 206 * exception is created with a type specific to the operation: 207 * </p> 208 * 209 * <ul> 210 * <li> 211 * {@link TrashPermissionException#RESTORE} - if the user did not have 212 * permission to restore the trash entry 213 * </li> 214 * <li> 215 * {@link TrashPermissionException#RESTORE_OVERWRITE} - if the user did not 216 * have permission to delete the existing trash entry 217 * </li> 218 * <li> 219 * {@link TrashPermissionException#RESTORE_RENAME} - if the user did not 220 * have permission to rename the trash entry 221 * </li> 222 * </ul> 223 * 224 * @param entryId the primary key of the trash entry to restore 225 * @param overrideClassPK the primary key of the entity to overwrite 226 (optionally <code>0</code>) 227 * @param name a new name to give to the trash entry being restored 228 (optionally <code>null</code>) 229 * @return the restored trash entry 230 * @throws PortalException if a matching trash entry could not be found, if 231 the user did not have permission to overwrite an existing trash 232 entry, to rename the trash entry being restored, or to restore 233 the trash entry in general 234 */ 235 public com.liferay.portlet.trash.model.TrashEntry restoreEntry( 236 long entryId, long overrideClassPK, java.lang.String name) 237 throws PortalException; 238 239 /** 240 * Sets the Spring bean ID for this bean. 241 * 242 * @param beanIdentifier the Spring bean ID for this bean 243 */ 244 public void setBeanIdentifier(java.lang.String beanIdentifier); 245 }