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