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