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 /** 131 * Returns a range of all the trash entries matching the group ID. 132 * 133 * @param groupId the primary key of the group 134 * @param start the lower bound of the range of trash entries to return 135 * @param end the upper bound of the range of trash entries to return (not 136 inclusive) 137 * @param obc the comparator to order the trash entries (optionally 138 <code>null</code>) 139 * @return the range of matching trash entries ordered by comparator 140 <code>obc</code> 141 * @throws PrincipalException if a system exception occurred 142 */ 143 public static 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 return getService().getEntries(groupId, start, end, obc); 148 } 149 150 /** 151 * Moves the trash entry with the entity class name and primary key, 152 * restoring it to a new location identified by the destination container 153 * model ID. 154 * 155 * <p> 156 * This method throws a {@link TrashPermissionException} if the user did not 157 * have the permission to perform one of the necessary operations. The 158 * exception is created with a type specific to the operation: 159 * </p> 160 * 161 * <ul> 162 * <li> 163 * {@link TrashPermissionException#MOVE} - if the user did not have 164 * permission to move the trash entry to the new 165 * destination 166 * </li> 167 * <li> 168 * {@link TrashPermissionException#RESTORE} - if the user did not have 169 * permission to restore the trash entry 170 * </li> 171 * </ul> 172 * 173 * @param className the class name of the entity 174 * @param classPK the primary key of the entity 175 * @param destinationContainerModelId the primary key of the new location 176 * @param serviceContext the service context to be applied (optionally 177 <code>null</code>) 178 * @throws PortalException if a matching trash entry could not be found, if 179 the user did not have permission to move the trash entry to the 180 new location, if the user did not have permission to restore the 181 trash entry, if a duplicate trash entry exists at the new 182 location, or if a portal exception occurred 183 */ 184 public static void moveEntry(java.lang.String className, long classPK, 185 long destinationContainerModelId, 186 com.liferay.portal.service.ServiceContext serviceContext) 187 throws com.liferay.portal.kernel.exception.PortalException { 188 getService() 189 .moveEntry(className, classPK, destinationContainerModelId, 190 serviceContext); 191 } 192 193 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 194 java.lang.String className, long classPK) 195 throws com.liferay.portal.kernel.exception.PortalException { 196 return getService().restoreEntry(className, classPK); 197 } 198 199 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 200 java.lang.String className, long classPK, long overrideClassPK, 201 java.lang.String name) 202 throws com.liferay.portal.kernel.exception.PortalException { 203 return getService() 204 .restoreEntry(className, classPK, overrideClassPK, name); 205 } 206 207 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 208 long entryId) 209 throws com.liferay.portal.kernel.exception.PortalException { 210 return getService().restoreEntry(entryId); 211 } 212 213 /** 214 * Restores the trash entry to its original location. In order to handle a 215 * duplicate trash entry already existing at the original location, either 216 * pass in the primary key of the existing trash entry's entity to overwrite 217 * or pass in a new name to give to the trash entry being restored. 218 * 219 * <p> 220 * This method throws a {@link TrashPermissionException} if the user did not 221 * have the permission to perform one of the necessary operations. The 222 * exception is created with a type specific to the operation: 223 * </p> 224 * 225 * <ul> 226 * <li> 227 * {@link TrashPermissionException#RESTORE} - if the user did not have 228 * permission to restore the trash entry 229 * </li> 230 * <li> 231 * {@link TrashPermissionException#RESTORE_OVERWRITE} - if the user did not 232 * have permission to delete the existing trash entry 233 * </li> 234 * <li> 235 * {@link TrashPermissionException#RESTORE_RENAME} - if the user did not 236 * have permission to rename the trash entry 237 * </li> 238 * </ul> 239 * 240 * @param entryId the primary key of the trash entry to restore 241 * @param overrideClassPK the primary key of the entity to overwrite 242 (optionally <code>0</code>) 243 * @param name a new name to give to the trash entry being restored 244 (optionally <code>null</code>) 245 * @return the restored trash entry 246 * @throws PortalException if a matching trash entry could not be found, if 247 the user did not have permission to overwrite an existing trash 248 entry, to rename the trash entry being restored, or to restore 249 the trash entry in general 250 */ 251 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 252 long entryId, long overrideClassPK, java.lang.String name) 253 throws com.liferay.portal.kernel.exception.PortalException { 254 return getService().restoreEntry(entryId, overrideClassPK, name); 255 } 256 257 /** 258 * Sets the Spring bean ID for this bean. 259 * 260 * @param beanIdentifier the Spring bean ID for this bean 261 */ 262 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 263 getService().setBeanIdentifier(beanIdentifier); 264 } 265 266 public static TrashEntryService getService() { 267 if (_service == null) { 268 _service = (TrashEntryService)PortalBeanLocatorUtil.locate(TrashEntryService.class.getName()); 269 270 ReferenceRegistry.registerReference(TrashEntryServiceUtil.class, 271 "_service"); 272 } 273 274 return _service; 275 } 276 277 /** 278 * @deprecated As of 6.2.0 279 */ 280 @Deprecated 281 public void setService(TrashEntryService service) { 282 } 283 284 private static TrashEntryService _service; 285 }