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