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 */ 074 public static void deleteEntries(long groupId) throws RemoteException { 075 try { 076 TrashEntryServiceUtil.deleteEntries(groupId); 077 } 078 catch (Exception e) { 079 _log.error(e, e); 080 081 throw new RemoteException(e.getMessage()); 082 } 083 } 084 085 /** 086 * Deletes the trash entries with the primary keys. 087 * 088 * @param entryIds the primary keys of the trash entries 089 */ 090 public static void deleteEntries(long[] entryIds) throws RemoteException { 091 try { 092 TrashEntryServiceUtil.deleteEntries(entryIds); 093 } 094 catch (Exception e) { 095 _log.error(e, e); 096 097 throw new RemoteException(e.getMessage()); 098 } 099 } 100 101 /** 102 * Deletes the trash entry with the primary key. 103 * 104 * <p> 105 * This method throws a {@link TrashPermissionException} with type {@link 106 * TrashPermissionException#DELETE} if the user did not have permission to 107 * delete the trash entry. 108 * </p> 109 * 110 * @param entryId the primary key of the trash entry 111 */ 112 public static void deleteEntry(long entryId) throws RemoteException { 113 try { 114 TrashEntryServiceUtil.deleteEntry(entryId); 115 } 116 catch (Exception e) { 117 _log.error(e, e); 118 119 throw new RemoteException(e.getMessage()); 120 } 121 } 122 123 /** 124 * Deletes the trash entry with the entity class name and class primary key. 125 * 126 * <p> 127 * This method throws a {@link TrashPermissionException} with type {@link 128 * TrashPermissionException#DELETE} if the user did not have permission to 129 * delete the trash entry. 130 * </p> 131 * 132 * @param className the class name of the entity 133 * @param classPK the primary key of the entity 134 */ 135 public static void deleteEntry(java.lang.String className, long classPK) 136 throws RemoteException { 137 try { 138 TrashEntryServiceUtil.deleteEntry(className, classPK); 139 } 140 catch (Exception e) { 141 _log.error(e, e); 142 143 throw new RemoteException(e.getMessage()); 144 } 145 } 146 147 /** 148 * Returns the trash entries with the matching group ID. 149 * 150 * @param groupId the primary key of the group 151 * @return the matching trash entries 152 */ 153 public static com.liferay.portlet.trash.model.TrashEntryList getEntries( 154 long groupId) throws RemoteException { 155 try { 156 com.liferay.portlet.trash.model.TrashEntryList returnValue = TrashEntryServiceUtil.getEntries(groupId); 157 158 return returnValue; 159 } 160 catch (Exception e) { 161 _log.error(e, e); 162 163 throw new RemoteException(e.getMessage()); 164 } 165 } 166 167 /** 168 * Returns a range of all the trash entries matching the group ID. 169 * 170 * @param groupId the primary key of the group 171 * @param start the lower bound of the range of trash entries to return 172 * @param end the upper bound of the range of trash entries to return (not 173 inclusive) 174 * @param obc the comparator to order the trash entries (optionally 175 <code>null</code>) 176 * @return the range of matching trash entries ordered by comparator 177 <code>obc</code> 178 */ 179 public static com.liferay.portlet.trash.model.TrashEntryList getEntries( 180 long groupId, int start, int end, 181 com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portlet.trash.model.TrashEntry> obc) 182 throws RemoteException { 183 try { 184 com.liferay.portlet.trash.model.TrashEntryList returnValue = TrashEntryServiceUtil.getEntries(groupId, 185 start, end, obc); 186 187 return returnValue; 188 } 189 catch (Exception e) { 190 _log.error(e, e); 191 192 throw new RemoteException(e.getMessage()); 193 } 194 } 195 196 public static com.liferay.portlet.trash.model.TrashEntrySoap[] getEntries( 197 long groupId, java.lang.String className) throws RemoteException { 198 try { 199 java.util.List<com.liferay.portlet.trash.model.TrashEntry> returnValue = 200 TrashEntryServiceUtil.getEntries(groupId, className); 201 202 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModels(returnValue); 203 } 204 catch (Exception e) { 205 _log.error(e, e); 206 207 throw new RemoteException(e.getMessage()); 208 } 209 } 210 211 /** 212 * Moves the trash entry with the entity class name and primary key, 213 * restoring it to a new location identified by the destination container 214 * model ID. 215 * 216 * <p> 217 * This method throws a {@link TrashPermissionException} if the user did not 218 * have the permission to perform one of the necessary operations. The 219 * exception is created with a type specific to the operation: 220 * </p> 221 * 222 * <ul> 223 * <li> 224 * {@link TrashPermissionException#MOVE} - if the user did not have 225 * permission to move the trash entry to the new 226 * destination 227 * </li> 228 * <li> 229 * {@link TrashPermissionException#RESTORE} - if the user did not have 230 * permission to restore the trash entry 231 * </li> 232 * </ul> 233 * 234 * @param className the class name of the entity 235 * @param classPK the primary key of the entity 236 * @param destinationContainerModelId the primary key of the new location 237 * @param serviceContext the service context to be applied (optionally 238 <code>null</code>) 239 */ 240 public static void moveEntry(java.lang.String className, long classPK, 241 long destinationContainerModelId, 242 com.liferay.portal.service.ServiceContext serviceContext) 243 throws RemoteException { 244 try { 245 TrashEntryServiceUtil.moveEntry(className, classPK, 246 destinationContainerModelId, serviceContext); 247 } 248 catch (Exception e) { 249 _log.error(e, e); 250 251 throw new RemoteException(e.getMessage()); 252 } 253 } 254 255 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 256 long entryId) throws RemoteException { 257 try { 258 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(entryId); 259 260 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 261 } 262 catch (Exception e) { 263 _log.error(e, e); 264 265 throw new RemoteException(e.getMessage()); 266 } 267 } 268 269 /** 270 * Restores the trash entry to its original location. In order to handle a 271 * duplicate trash entry already existing at the original location, either 272 * pass in the primary key of the existing trash entry's entity to overwrite 273 * or pass in a new name to give to the trash entry being restored. 274 * 275 * <p> 276 * This method throws a {@link TrashPermissionException} if the user did not 277 * have the permission to perform one of the necessary operations. The 278 * exception is created with a type specific to the operation: 279 * </p> 280 * 281 * <ul> 282 * <li> 283 * {@link TrashPermissionException#RESTORE} - if the user did not have 284 * permission to restore the trash entry 285 * </li> 286 * <li> 287 * {@link TrashPermissionException#RESTORE_OVERWRITE} - if the user did not 288 * have permission to delete the existing trash entry 289 * </li> 290 * <li> 291 * {@link TrashPermissionException#RESTORE_RENAME} - if the user did not 292 * have permission to rename the trash entry 293 * </li> 294 * </ul> 295 * 296 * @param entryId the primary key of the trash entry to restore 297 * @param overrideClassPK the primary key of the entity to overwrite 298 (optionally <code>0</code>) 299 * @param name a new name to give to the trash entry being restored 300 (optionally <code>null</code>) 301 * @return the restored trash entry 302 */ 303 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 304 long entryId, long overrideClassPK, java.lang.String name) 305 throws RemoteException { 306 try { 307 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(entryId, 308 overrideClassPK, name); 309 310 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 311 } 312 catch (Exception e) { 313 _log.error(e, e); 314 315 throw new RemoteException(e.getMessage()); 316 } 317 } 318 319 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 320 java.lang.String className, long classPK) throws RemoteException { 321 try { 322 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(className, 323 classPK); 324 325 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 326 } 327 catch (Exception e) { 328 _log.error(e, e); 329 330 throw new RemoteException(e.getMessage()); 331 } 332 } 333 334 public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry( 335 java.lang.String className, long classPK, long overrideClassPK, 336 java.lang.String name) throws RemoteException { 337 try { 338 com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(className, 339 classPK, overrideClassPK, name); 340 341 return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue); 342 } 343 catch (Exception e) { 344 _log.error(e, e); 345 346 throw new RemoteException(e.getMessage()); 347 } 348 } 349 350 private static Log _log = LogFactoryUtil.getLog(TrashEntryServiceSoap.class); 351 }