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 */ 049 public static void deleteEntries(long[] entryIds) 050 throws com.liferay.portal.kernel.exception.PortalException { 051 getService().deleteEntries(entryIds); 052 } 053 054 /** 055 * Deletes the trash entries with the matching group ID considering 056 * permissions. 057 * 058 * @param groupId the primary key of the group 059 */ 060 public static void deleteEntries(long groupId) 061 throws com.liferay.portal.kernel.exception.PortalException { 062 getService().deleteEntries(groupId); 063 } 064 065 /** 066 * Deletes the trash entry with the entity class name and class primary key. 067 * 068 * <p> 069 * This method throws a {@link TrashPermissionException} with type {@link 070 * TrashPermissionException#DELETE} if the user did not have permission to 071 * delete the trash entry. 072 * </p> 073 * 074 * @param className the class name of the entity 075 * @param classPK the primary key of the entity 076 */ 077 public static void deleteEntry(java.lang.String className, long classPK) 078 throws com.liferay.portal.kernel.exception.PortalException { 079 getService().deleteEntry(className, classPK); 080 } 081 082 /** 083 * Deletes the trash entry with the primary key. 084 * 085 * <p> 086 * This method throws a {@link TrashPermissionException} with type {@link 087 * TrashPermissionException#DELETE} if the user did not have permission to 088 * delete the trash entry. 089 * </p> 090 * 091 * @param entryId the primary key of the trash entry 092 */ 093 public static void deleteEntry(long entryId) 094 throws com.liferay.portal.kernel.exception.PortalException { 095 getService().deleteEntry(entryId); 096 } 097 098 /** 099 * Returns the trash entries with the matching group ID. 100 * 101 * @param groupId the primary key of the group 102 * @return the matching trash entries 103 */ 104 public static com.liferay.portlet.trash.model.TrashEntryList getEntries( 105 long groupId) 106 throws com.liferay.portal.security.auth.PrincipalException { 107 return getService().getEntries(groupId); 108 } 109 110 public static java.util.List<com.liferay.portlet.trash.model.TrashEntry> getEntries( 111 long groupId, java.lang.String className) 112 throws com.liferay.portal.security.auth.PrincipalException { 113 return getService().getEntries(groupId, className); 114 } 115 116 /** 117 * Returns a range of all the trash entries matching the group ID. 118 * 119 * @param groupId the primary key of the group 120 * @param start the lower bound of the range of trash entries to return 121 * @param end the upper bound of the range of trash entries to return (not 122 inclusive) 123 * @param obc the comparator to order the trash entries (optionally 124 <code>null</code>) 125 * @return the range of matching trash entries ordered by comparator 126 <code>obc</code> 127 */ 128 public static com.liferay.portlet.trash.model.TrashEntryList getEntries( 129 long groupId, int start, int end, 130 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.trash.model.TrashEntry> obc) 131 throws com.liferay.portal.security.auth.PrincipalException { 132 return getService().getEntries(groupId, start, end, obc); 133 } 134 135 /** 136 * Returns the OSGi service identifier. 137 * 138 * @return the OSGi service identifier 139 */ 140 public static java.lang.String getOSGiServiceIdentifier() { 141 return getService().getOSGiServiceIdentifier(); 142 } 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 static void moveEntry(java.lang.String className, long classPK, 174 long destinationContainerModelId, 175 com.liferay.portal.service.ServiceContext serviceContext) 176 throws com.liferay.portal.kernel.exception.PortalException { 177 getService() 178 .moveEntry(className, classPK, destinationContainerModelId, 179 serviceContext); 180 } 181 182 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 183 java.lang.String className, long classPK) 184 throws com.liferay.portal.kernel.exception.PortalException { 185 return getService().restoreEntry(className, classPK); 186 } 187 188 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 189 java.lang.String className, long classPK, long overrideClassPK, 190 java.lang.String name) 191 throws com.liferay.portal.kernel.exception.PortalException { 192 return getService() 193 .restoreEntry(className, classPK, overrideClassPK, name); 194 } 195 196 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 197 long entryId) 198 throws com.liferay.portal.kernel.exception.PortalException { 199 return getService().restoreEntry(entryId); 200 } 201 202 /** 203 * Restores the trash entry to its original location. In order to handle a 204 * duplicate trash entry already existing at the original location, either 205 * pass in the primary key of the existing trash entry's entity to overwrite 206 * or pass in a new name to give to the trash entry being restored. 207 * 208 * <p> 209 * This method throws a {@link TrashPermissionException} if the user did not 210 * have the permission to perform one of the necessary operations. The 211 * exception is created with a type specific to the operation: 212 * </p> 213 * 214 * <ul> 215 * <li> 216 * {@link TrashPermissionException#RESTORE} - if the user did not have 217 * permission to restore the trash entry 218 * </li> 219 * <li> 220 * {@link TrashPermissionException#RESTORE_OVERWRITE} - if the user did not 221 * have permission to delete the existing trash entry 222 * </li> 223 * <li> 224 * {@link TrashPermissionException#RESTORE_RENAME} - if the user did not 225 * have permission to rename the trash entry 226 * </li> 227 * </ul> 228 * 229 * @param entryId the primary key of the trash entry to restore 230 * @param overrideClassPK the primary key of the entity to overwrite 231 (optionally <code>0</code>) 232 * @param name a new name to give to the trash entry being restored 233 (optionally <code>null</code>) 234 * @return the restored trash entry 235 */ 236 public static com.liferay.portlet.trash.model.TrashEntry restoreEntry( 237 long entryId, long overrideClassPK, java.lang.String name) 238 throws com.liferay.portal.kernel.exception.PortalException { 239 return getService().restoreEntry(entryId, overrideClassPK, name); 240 } 241 242 public static TrashEntryService getService() { 243 if (_service == null) { 244 _service = (TrashEntryService)PortalBeanLocatorUtil.locate(TrashEntryService.class.getName()); 245 246 ReferenceRegistry.registerReference(TrashEntryServiceUtil.class, 247 "_service"); 248 } 249 250 return _service; 251 } 252 253 private static TrashEntryService _service; 254 }