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