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            /**
209            * Moves the trash entry with the entity class name and primary key,
210            * restoring it to a new location identified by the destination container
211            * model ID.
212            *
213            * <p>
214            * This method throws a {@link TrashPermissionException} if the user did not
215            * have the permission to perform one of the necessary operations. The
216            * exception is created with a type specific to the operation:
217            * </p>
218            *
219            * <ul>
220            * <li>
221            * {@link TrashPermissionException#MOVE} - if the user did not have
222            * permission to move the trash entry to the new
223            * destination
224            * </li>
225            * <li>
226            * {@link TrashPermissionException#RESTORE} - if the user did not have
227            * permission to restore the trash entry
228            * </li>
229            * </ul>
230            *
231            * @param className the class name of the entity
232            * @param classPK the primary key of the entity
233            * @param destinationContainerModelId the primary key of the new location
234            * @param serviceContext the service context to be applied (optionally
235            <code>null</code>)
236            * @throws PortalException if a matching trash entry could not be found, if
237            the user did not have permission to move the trash entry to the
238            new location, if the user did not have permission to restore the
239            trash entry, if a duplicate trash entry exists at the new
240            location, or if a portal exception occurred
241            */
242            public static void moveEntry(java.lang.String className, long classPK,
243                    long destinationContainerModelId,
244                    com.liferay.portal.service.ServiceContext serviceContext)
245                    throws RemoteException {
246                    try {
247                            TrashEntryServiceUtil.moveEntry(className, classPK,
248                                    destinationContainerModelId, serviceContext);
249                    }
250                    catch (Exception e) {
251                            _log.error(e, e);
252    
253                            throw new RemoteException(e.getMessage());
254                    }
255            }
256    
257            public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry(
258                    long entryId) throws RemoteException {
259                    try {
260                            com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(entryId);
261    
262                            return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue);
263                    }
264                    catch (Exception e) {
265                            _log.error(e, e);
266    
267                            throw new RemoteException(e.getMessage());
268                    }
269            }
270    
271            /**
272            * Restores the trash entry to its original location. In order to handle a
273            * duplicate trash entry already existing at the original location, either
274            * pass in the primary key of the existing trash entry's entity to overwrite
275            * or pass in a new name to give to the trash entry being restored.
276            *
277            * <p>
278            * This method throws a {@link TrashPermissionException} if the user did not
279            * have the permission to perform one of the necessary operations. The
280            * exception is created with a type specific to the operation:
281            * </p>
282            *
283            * <ul>
284            * <li>
285            * {@link TrashPermissionException#RESTORE} - if the user did not have
286            * permission to restore the trash entry
287            * </li>
288            * <li>
289            * {@link TrashPermissionException#RESTORE_OVERWRITE} - if the user did not
290            * have permission to delete the existing trash entry
291            * </li>
292            * <li>
293            * {@link TrashPermissionException#RESTORE_RENAME} - if the user did not
294            * have permission to rename the trash entry
295            * </li>
296            * </ul>
297            *
298            * @param entryId the primary key of the trash entry to restore
299            * @param overrideClassPK the primary key of the entity to overwrite
300            (optionally <code>0</code>)
301            * @param name a new name to give to the trash entry being restored
302            (optionally <code>null</code>)
303            * @return the restored trash entry
304            * @throws PortalException if a matching trash entry could not be found, if
305            the user did not have permission to overwrite an existing trash
306            entry, to rename the trash entry being restored, or to restore
307            the trash entry in general
308            */
309            public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry(
310                    long entryId, long overrideClassPK, java.lang.String name)
311                    throws RemoteException {
312                    try {
313                            com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(entryId,
314                                            overrideClassPK, name);
315    
316                            return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue);
317                    }
318                    catch (Exception e) {
319                            _log.error(e, e);
320    
321                            throw new RemoteException(e.getMessage());
322                    }
323            }
324    
325            public static com.liferay.portlet.trash.model.TrashEntrySoap restoreEntry(
326                    java.lang.String className, long classPK) throws RemoteException {
327                    try {
328                            com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(className,
329                                            classPK);
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, long overrideClassPK,
342                    java.lang.String name) throws RemoteException {
343                    try {
344                            com.liferay.portlet.trash.model.TrashEntry returnValue = TrashEntryServiceUtil.restoreEntry(className,
345                                            classPK, overrideClassPK, name);
346    
347                            return com.liferay.portlet.trash.model.TrashEntrySoap.toSoapModel(returnValue);
348                    }
349                    catch (Exception e) {
350                            _log.error(e, e);
351    
352                            throw new RemoteException(e.getMessage());
353                    }
354            }
355    
356            private static Log _log = LogFactoryUtil.getLog(TrashEntryServiceSoap.class);
357    }