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.exception.PortalException;
020    import com.liferay.portal.kernel.exception.SystemException;
021    import com.liferay.portal.kernel.jsonwebservice.JSONWebService;
022    import com.liferay.portal.kernel.security.access.control.AccessControlled;
023    import com.liferay.portal.kernel.security.auth.PrincipalException;
024    import com.liferay.portal.kernel.service.BaseService;
025    import com.liferay.portal.kernel.service.ServiceContext;
026    import com.liferay.portal.kernel.transaction.Isolation;
027    import com.liferay.portal.kernel.transaction.Propagation;
028    import com.liferay.portal.kernel.transaction.Transactional;
029    import com.liferay.portal.kernel.util.OrderByComparator;
030    
031    import com.liferay.trash.kernel.model.TrashEntry;
032    import com.liferay.trash.kernel.model.TrashEntryList;
033    
034    import java.util.List;
035    
036    /**
037     * Provides the remote service interface for TrashEntry. Methods of this
038     * service are expected to have security checks based on the propagated JAAS
039     * credentials because this service can be accessed remotely.
040     *
041     * @author Brian Wing Shun Chan
042     * @see TrashEntryServiceUtil
043     * @see com.liferay.portlet.trash.service.base.TrashEntryServiceBaseImpl
044     * @see com.liferay.portlet.trash.service.impl.TrashEntryServiceImpl
045     * @generated
046     */
047    @AccessControlled
048    @JSONWebService
049    @ProviderType
050    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
051            PortalException.class, SystemException.class})
052    public interface TrashEntryService extends BaseService {
053            /*
054             * NOTE FOR DEVELOPERS:
055             *
056             * Never modify or reference this interface directly. Always use {@link TrashEntryServiceUtil} to access the trash entry remote service. Add custom service methods to {@link com.liferay.portlet.trash.service.impl.TrashEntryServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
057             */
058            public TrashEntry restoreEntry(java.lang.String className, long classPK)
059                    throws PortalException;
060    
061            public TrashEntry restoreEntry(java.lang.String className, long classPK,
062                    long overrideClassPK, java.lang.String name) throws PortalException;
063    
064            public TrashEntry restoreEntry(long entryId) throws PortalException;
065    
066            /**
067            * Restores the trash entry to its original location. In order to handle a
068            * duplicate trash entry already existing at the original location, either
069            * pass in the primary key of the existing trash entry's entity to overwrite
070            * or pass in a new name to give to the trash entry being restored.
071            *
072            * <p>
073            * This method throws a {@link TrashPermissionException} if the user did not
074            * have the permission to perform one of the necessary operations. The
075            * exception is created with a type specific to the operation:
076            * </p>
077            *
078            * <ul>
079            * <li>
080            * {@link TrashPermissionException#RESTORE} - if the user did not have
081            * permission to restore the trash entry
082            * </li>
083            * <li>
084            * {@link TrashPermissionException#RESTORE_OVERWRITE} - if the user did not
085            * have permission to delete the existing trash entry
086            * </li>
087            * <li>
088            * {@link TrashPermissionException#RESTORE_RENAME} - if the user did not
089            * have permission to rename the trash entry
090            * </li>
091            * </ul>
092            *
093            * @param entryId the primary key of the trash entry to restore
094            * @param overrideClassPK the primary key of the entity to overwrite
095            (optionally <code>0</code>)
096            * @param name a new name to give to the trash entry being restored
097            (optionally <code>null</code>)
098            * @return the restored trash entry
099            */
100            public TrashEntry restoreEntry(long entryId, long overrideClassPK,
101                    java.lang.String name) throws PortalException;
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            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
110            public TrashEntryList getEntries(long groupId) throws PrincipalException;
111    
112            /**
113            * Returns a range of all the trash entries matching the group ID.
114            *
115            * @param groupId the primary key of the group
116            * @param start the lower bound of the range of trash entries to return
117            * @param end the upper bound of the range of trash entries to return (not
118            inclusive)
119            * @param obc the comparator to order the trash entries (optionally
120            <code>null</code>)
121            * @return the range of matching trash entries ordered by comparator
122            <code>obc</code>
123            */
124            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
125            public TrashEntryList getEntries(long groupId, int start, int end,
126                    OrderByComparator<TrashEntry> obc) throws PrincipalException;
127    
128            /**
129            * Returns the OSGi service identifier.
130            *
131            * @return the OSGi service identifier
132            */
133            public java.lang.String getOSGiServiceIdentifier();
134    
135            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
136            public List<TrashEntry> getEntries(long groupId, java.lang.String className)
137                    throws PrincipalException;
138    
139            /**
140            * Deletes the trash entries with the matching group ID considering
141            * permissions.
142            *
143            * @param groupId the primary key of the group
144            */
145            @Transactional(noRollbackFor =  {
146                    com.liferay.portal.kernel.exception.TrashPermissionException.class}
147            )
148            public void deleteEntries(long groupId) throws PortalException;
149    
150            /**
151            * Deletes the trash entries with the primary keys.
152            *
153            * @param entryIds the primary keys of the trash entries
154            */
155            @Transactional(noRollbackFor =  {
156                    com.liferay.portal.kernel.exception.TrashPermissionException.class}
157            )
158            public void deleteEntries(long[] entryIds) throws PortalException;
159    
160            /**
161            * Deletes the trash entry with the entity class name and class primary key.
162            *
163            * <p>
164            * This method throws a {@link TrashPermissionException} with type {@link
165            * TrashPermissionException#DELETE} if the user did not have permission to
166            * delete the trash entry.
167            * </p>
168            *
169            * @param className the class name of the entity
170            * @param classPK the primary key of the entity
171            */
172            public void deleteEntry(java.lang.String className, long classPK)
173                    throws PortalException;
174    
175            /**
176            * Deletes the trash entry with the primary key.
177            *
178            * <p>
179            * This method throws a {@link TrashPermissionException} with type {@link
180            * TrashPermissionException#DELETE} if the user did not have permission to
181            * delete the trash entry.
182            * </p>
183            *
184            * @param entryId the primary key of the trash entry
185            */
186            public void deleteEntry(long entryId) throws PortalException;
187    
188            /**
189            * Moves the trash entry with the entity class name and primary key,
190            * restoring it to a new location identified by the destination container
191            * model ID.
192            *
193            * <p>
194            * This method throws a {@link TrashPermissionException} if the user did not
195            * have the permission to perform one of the necessary operations. The
196            * exception is created with a type specific to the operation:
197            * </p>
198            *
199            * <ul>
200            * <li>
201            * {@link TrashPermissionException#MOVE} - if the user did not have
202            * permission to move the trash entry to the new
203            * destination
204            * </li>
205            * <li>
206            * {@link TrashPermissionException#RESTORE} - if the user did not have
207            * permission to restore the trash entry
208            * </li>
209            * </ul>
210            *
211            * @param className the class name of the entity
212            * @param classPK the primary key of the entity
213            * @param destinationContainerModelId the primary key of the new location
214            * @param serviceContext the service context to be applied (optionally
215            <code>null</code>)
216            */
217            public void moveEntry(java.lang.String className, long classPK,
218                    long destinationContainerModelId, ServiceContext serviceContext)
219                    throws PortalException;
220    }