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.http; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.log.Log; 020 import com.liferay.portal.kernel.log.LogFactoryUtil; 021 022 import com.liferay.portlet.trash.service.TrashEntryServiceUtil; 023 024 import java.rmi.RemoteException; 025 026 /** 027 * Provides the SOAP utility for the 028 * {@link TrashEntryServiceUtil} service utility. The 029 * static methods of this class calls the same methods of the service utility. 030 * However, the signatures are different because it is difficult for SOAP to 031 * support certain types. 032 * 033 * <p> 034 * ServiceBuilder follows certain rules in translating the methods. For example, 035 * if the method in the service utility returns a {@link java.util.List}, that 036 * is translated to an array of {@link com.liferay.portlet.trash.model.TrashEntrySoap}. 037 * If the method in the service utility returns a 038 * {@link com.liferay.portlet.trash.model.TrashEntry}, that is translated to a 039 * {@link com.liferay.portlet.trash.model.TrashEntrySoap}. Methods that SOAP cannot 040 * safely wire are skipped. 041 * </p> 042 * 043 * <p> 044 * The benefits of using the SOAP utility is that it is cross platform 045 * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and 046 * even Perl, to call the generated services. One drawback of SOAP is that it is 047 * slow because it needs to serialize all calls into a text format (XML). 048 * </p> 049 * 050 * <p> 051 * You can see a list of services at http://localhost:8080/api/axis. Set the 052 * property <b>axis.servlet.hosts.allowed</b> in portal.properties to configure 053 * security. 054 * </p> 055 * 056 * <p> 057 * The SOAP utility is only generated for remote services. 058 * </p> 059 * 060 * @author Brian Wing Shun Chan 061 * @see TrashEntryServiceHttp 062 * @see com.liferay.portlet.trash.model.TrashEntrySoap 063 * @see TrashEntryServiceUtil 064 * @generated 065 */ 066 @ProviderType 067 public class TrashEntryServiceSoap { 068 /** 069 * Deletes the trash entries with the matching group ID considering 070 * permissions. 071 * 072 * @param groupId the primary key of the group 073 * @throws PortalException if a portal exception occurred 074 */ 075 public static void deleteEntries(long groupId) throws RemoteException { 076 try { 077 TrashEntryServiceUtil.deleteEntries(groupId); 078 } 079 catch (Exception e) { 080 _log.error(e, e); 081 082 throw new RemoteException(e.getMessage()); 083 } 084 } 085 086 /** 087 * Deletes the trash entries with the primary keys. 088 * 089 * @param entryIds the primary keys of the trash entries 090 * @throws PortalException if a trash entry with the primary key could not 091 be found or if the user did not have permission to delete any one 092 of the trash entries 093 */ 094 public static void deleteEntries(long[] entryIds) throws RemoteException { 095 try { 096 TrashEntryServiceUtil.deleteEntries(entryIds); 097 } 098 catch (Exception e) { 099 _log.error(e, e); 100 101 throw new RemoteException(e.getMessage()); 102 } 103 } 104 105 /** 106 * Deletes the trash entry with the primary key. 107 * 108 * <p> 109 * This method throws a {@link TrashPermissionException} with type {@link 110 * TrashPermissionException#DELETE} if the user did not have permission to 111 * delete the trash entry. 112 * </p> 113 * 114 * @param entryId the primary key of the trash entry 115 * @throws PortalException if a trash entry with the primary key could not 116 be found or if the user did not have permission to delete the 117 trash entry 118 */ 119 public static void deleteEntry(long entryId) throws RemoteException { 120 try { 121 TrashEntryServiceUtil.deleteEntry(entryId); 122 } 123 catch (Exception e) { 124 _log.error(e, e); 125 126 throw new RemoteException(e.getMessage()); 127 } 128 } 129 130 /** 131 * Deletes the trash entry with the entity class name and class primary key. 132 * 133 * <p> 134 * This method throws a {@link TrashPermissionException} with type {@link 135 * TrashPermissionException#DELETE} if the user did not have permission to 136 * delete the trash entry. 137 * </p> 138 * 139 * @param className the class name of the entity 140 * @param classPK the primary key of the entity 141 * @throws PortalException if a trash entry with the entity class name and 142 primary key could not be found or if the user did not have 143 permission to delete the entry 144 */ 145 public static void deleteEntry(java.lang.String className, long classPK) 146 throws RemoteException { 147 try { 148 TrashEntryServiceUtil.deleteEntry(className, classPK); 149 } 150 catch (Exception e) { 151 _log.error(e, e); 152 153 throw new RemoteException(e.getMessage()); 154 } 155 } 156 157 /** 158 * Returns the trash entries with the matching group ID. 159 * 160 * @param groupId the primary key of the group 161 * @return the matching trash entries 162 * @throws PrincipalException if a principal exception occurred 163 */ 164 public static com.liferay.portlet.trash.model.TrashEntryList getEntries( 165 long groupId) throws RemoteException { 166 try { 167 com.liferay.portlet.trash.model.TrashEntryList returnValue = TrashEntryServiceUtil.getEntries(groupId); 168 169 return returnValue; 170 } 171 catch (Exception e) { 172 _log.error(e, e); 173 174 throw new RemoteException(e.getMessage()); 175 } 176 } 177 178 /** 179 * Returns a range of all the trash entries matching the group ID. 180 * 181 * @param groupId the primary key of the group 182 * @param start the lower bound of the range of trash entries to return 183 * @param end the upper bound of the range of trash entries to return (not 184 inclusive) 185 * @param obc the comparator to order the trash entries (optionally 186 <code>null</code>) 187 * @return the range of matching trash entries ordered by comparator 188 <code>obc</code> 189 * @throws PrincipalException if a system exception occurred 190 */ 191 public static com.liferay.portlet.trash.model.TrashEntryList getEntries( 192 long groupId, int start, int end, 193 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.trash.model.TrashEntry> obc) 194 throws RemoteException { 195 try { 196 com.liferay.portlet.trash.model.TrashEntryList returnValue = TrashEntryServiceUtil.getEntries(groupId, 197 start, end, obc); 198 199 return returnValue; 200 } 201 catch (Exception e) { 202 _log.error(e, e); 203 204 throw new RemoteException(e.getMessage()); 205 } 206 } 207 208 public static com.liferay.portlet.trash.model.TrashEntrySoap[] getEntries( 209 long groupId, java.lang.String className) throws RemoteException { 210 try { 211 java.util.List<com.liferay.portlet.trash.model.TrashEntry> returnValue = 212 TrashEntryServiceUtil.getEntries(groupId, className); 213 214 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModels(returnValue); 215 } 216 catch (Exception e) { 217 _log.error(e, e); 218 219 throw new RemoteException(e.getMessage()); 220 } 221 } 222 223 /** 224 * Moves the trash entry with the entity class name and primary key, 225 * restoring it to a new location identified by the destination container 226 * model ID. 227 * 228 * <p> 229 * This method throws a {@link TrashPermissionException} if the user did not 230 * have the permission to perform one of the necessary operations. The 231 * exception is created with a type specific to the operation: 232 * </p> 233 * 234 * <ul> 235 * <li> 236 * {@link TrashPermissionException#MOVE} - if the user did not have 237 * permission to move the trash entry to the new 238 * destination 239 * </li> 240 * <li> 241 * {@link TrashPermissionException#RESTORE} - if the user did not have 242 * permission to restore the trash entry 243 * </li> 244 * </ul> 245 * 246 * @param className the class name of the entity 247 * @param classPK the primary key of the entity 248 * @param destinationContainerModelId the primary key of the new location 249 * @param serviceContext the service context to be applied (optionally 250 <code>null</code>) 251 * @throws PortalException if a matching trash entry could not be found, if 252 the user did not have permission to move the trash entry to the 253 new location, if the user did not have permission to restore the 254 trash entry, if a duplicate trash entry exists at the new 255 location, or if a portal exception occurred 256 */ 257 public static void moveEntry(java.lang.String className, long classPK, 258 long destinationContainerModelId, 259 com.liferay.portal.service.ServiceContext serviceContext) 260 throws RemoteException { 261 try { 262 TrashEntryServiceUtil.moveEntry(className, classPK, 263 destinationContainerModelId, serviceContext); 264 } 265 catch (Exception e) { 266 _log.error(e, e); 267 268 throw new RemoteException(e.getMessage()); 269 } 270 } 271 272 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 273 long entryId) throws RemoteException { 274 try { 275 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(entryId); 276 277 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 278 } 279 catch (Exception e) { 280 _log.error(e, e); 281 282 throw new RemoteException(e.getMessage()); 283 } 284 } 285 286 /** 287 * Restores the trash entry to its original location. In order to handle a 288 * duplicate trash entry already existing at the original location, either 289 * pass in the primary key of the existing trash entry's entity to overwrite 290 * or pass in a new name to give to the trash entry being restored. 291 * 292 * <p> 293 * This method throws a {@link TrashPermissionException} if the user did not 294 * have the permission to perform one of the necessary operations. The 295 * exception is created with a type specific to the operation: 296 * </p> 297 * 298 * <ul> 299 * <li> 300 * {@link TrashPermissionException#RESTORE} - if the user did not have 301 * permission to restore the trash entry 302 * </li> 303 * <li> 304 * {@link TrashPermissionException#RESTORE_OVERWRITE} - if the user did not 305 * have permission to delete the existing trash entry 306 * </li> 307 * <li> 308 * {@link TrashPermissionException#RESTORE_RENAME} - if the user did not 309 * have permission to rename the trash entry 310 * </li> 311 * </ul> 312 * 313 * @param entryId the primary key of the trash entry to restore 314 * @param overrideClassPK the primary key of the entity to overwrite 315 (optionally <code>0</code>) 316 * @param name a new name to give to the trash entry being restored 317 (optionally <code>null</code>) 318 * @return the restored trash entry 319 * @throws PortalException if a matching trash entry could not be found, if 320 the user did not have permission to overwrite an existing trash 321 entry, to rename the trash entry being restored, or to restore 322 the trash entry in general 323 */ 324 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 325 long entryId, long overrideClassPK, java.lang.String name) 326 throws RemoteException { 327 try { 328 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(entryId, 329 overrideClassPK, name); 330 331 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 332 } 333 catch (Exception e) { 334 _log.error(e, e); 335 336 throw new RemoteException(e.getMessage()); 337 } 338 } 339 340 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 341 java.lang.String className, long classPK) throws RemoteException { 342 try { 343 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(className, 344 classPK); 345 346 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 347 } 348 catch (Exception e) { 349 _log.error(e, e); 350 351 throw new RemoteException(e.getMessage()); 352 } 353 } 354 355 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 356 java.lang.String className, long classPK, long overrideClassPK, 357 java.lang.String name) throws RemoteException { 358 try { 359 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(className, 360 classPK, overrideClassPK, name); 361 362 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 363 } 364 catch (Exception e) { 365 _log.error(e, e); 366 367 throw new RemoteException(e.getMessage()); 368 } 369 } 370 371 private static Log _log = LogFactoryUtil.getLog(TrashEntryServiceSoap.class); 372 }