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