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.dao.orm.ActionableDynamicQuery; 020 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 021 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery; 022 import com.liferay.portal.kernel.dao.orm.Projection; 023 import com.liferay.portal.kernel.exception.PortalException; 024 import com.liferay.portal.kernel.exception.SystemException; 025 import com.liferay.portal.kernel.model.PersistedModel; 026 import com.liferay.portal.kernel.search.BaseModelSearchResult; 027 import com.liferay.portal.kernel.search.Hits; 028 import com.liferay.portal.kernel.search.Indexable; 029 import com.liferay.portal.kernel.search.IndexableType; 030 import com.liferay.portal.kernel.search.Sort; 031 import com.liferay.portal.kernel.service.BaseLocalService; 032 import com.liferay.portal.kernel.service.PersistedModelLocalService; 033 import com.liferay.portal.kernel.transaction.Isolation; 034 import com.liferay.portal.kernel.transaction.Propagation; 035 import com.liferay.portal.kernel.transaction.Transactional; 036 import com.liferay.portal.kernel.util.ObjectValuePair; 037 import com.liferay.portal.kernel.util.OrderByComparator; 038 import com.liferay.portal.kernel.util.UnicodeProperties; 039 040 import com.liferay.trash.kernel.model.TrashEntry; 041 042 import java.io.Serializable; 043 044 import java.util.List; 045 046 /** 047 * Provides the local service interface for TrashEntry. Methods of this 048 * service will not have security checks based on the propagated JAAS 049 * credentials because this service can only be accessed from within the same 050 * VM. 051 * 052 * @author Brian Wing Shun Chan 053 * @see TrashEntryLocalServiceUtil 054 * @see com.liferay.portlet.trash.service.base.TrashEntryLocalServiceBaseImpl 055 * @see com.liferay.portlet.trash.service.impl.TrashEntryLocalServiceImpl 056 * @generated 057 */ 058 @ProviderType 059 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 060 PortalException.class, SystemException.class}) 061 public interface TrashEntryLocalService extends BaseLocalService, 062 PersistedModelLocalService { 063 /* 064 * NOTE FOR DEVELOPERS: 065 * 066 * Never modify or reference this interface directly. Always use {@link TrashEntryLocalServiceUtil} to access the trash entry local service. Add custom service methods to {@link com.liferay.portlet.trash.service.impl.TrashEntryLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 067 */ 068 069 /** 070 * Adds the trash entry to the database. Also notifies the appropriate model listeners. 071 * 072 * @param trashEntry the trash entry 073 * @return the trash entry that was added 074 */ 075 @Indexable(type = IndexableType.REINDEX) 076 public TrashEntry addTrashEntry(TrashEntry trashEntry); 077 078 /** 079 * Moves an entry to trash. 080 * 081 * @param userId the primary key of the user removing the entity 082 * @param groupId the primary key of the entry's group 083 * @param className the class name of the entity 084 * @param classPK the primary key of the entity 085 * @param classUuid the UUID of the entity's class 086 * @param referrerClassName the referrer class name used to add a deletion 087 {@link SystemEvent} 088 * @param status the status of the entity prior to being moved to trash 089 * @param statusOVPs the primary keys and statuses of any of the entry's 090 versions (e.g., {@link 091 com.liferay.portlet.documentlibrary.model.DLFileVersion}) 092 * @param typeSettingsProperties the type settings properties 093 * @return the trashEntry 094 */ 095 public TrashEntry addTrashEntry(long userId, long groupId, 096 java.lang.String className, long classPK, java.lang.String classUuid, 097 java.lang.String referrerClassName, int status, 098 List<ObjectValuePair<java.lang.Long, java.lang.Integer>> statusOVPs, 099 UnicodeProperties typeSettingsProperties) throws PortalException; 100 101 public void checkEntries() throws PortalException; 102 103 /** 104 * Creates a new trash entry with the primary key. Does not add the trash entry to the database. 105 * 106 * @param entryId the primary key for the new trash entry 107 * @return the new trash entry 108 */ 109 public TrashEntry createTrashEntry(long entryId); 110 111 public void deleteEntries(long groupId); 112 113 /** 114 * Deletes the trash entry with the entity class name and primary key. 115 * 116 * @param className the class name of entity 117 * @param classPK the primary key of the entry 118 * @return the trash entry with the entity class name and primary key 119 */ 120 public TrashEntry deleteEntry(java.lang.String className, long classPK); 121 122 /** 123 * Deletes the trash entry with the primary key. 124 * 125 * @param entryId the primary key of the trash entry 126 * @return the trash entry with the primary key 127 */ 128 public TrashEntry deleteEntry(long entryId); 129 130 @Indexable(type = IndexableType.DELETE) 131 public TrashEntry deleteEntry(TrashEntry trashEntry); 132 133 /** 134 * @throws PortalException 135 */ 136 @Override 137 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 138 throws PortalException; 139 140 /** 141 * Deletes the trash entry with the primary key from the database. Also notifies the appropriate model listeners. 142 * 143 * @param entryId the primary key of the trash entry 144 * @return the trash entry that was removed 145 * @throws PortalException if a trash entry with the primary key could not be found 146 */ 147 @Indexable(type = IndexableType.DELETE) 148 public TrashEntry deleteTrashEntry(long entryId) throws PortalException; 149 150 /** 151 * Deletes the trash entry from the database. Also notifies the appropriate model listeners. 152 * 153 * @param trashEntry the trash entry 154 * @return the trash entry that was removed 155 */ 156 @Indexable(type = IndexableType.DELETE) 157 public TrashEntry deleteTrashEntry(TrashEntry trashEntry); 158 159 public DynamicQuery dynamicQuery(); 160 161 /** 162 * Performs a dynamic query on the database and returns the matching rows. 163 * 164 * @param dynamicQuery the dynamic query 165 * @return the matching rows 166 */ 167 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 168 169 /** 170 * Performs a dynamic query on the database and returns a range of the matching rows. 171 * 172 * <p> 173 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.trash.model.impl.TrashEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 174 * </p> 175 * 176 * @param dynamicQuery the dynamic query 177 * @param start the lower bound of the range of model instances 178 * @param end the upper bound of the range of model instances (not inclusive) 179 * @return the range of matching rows 180 */ 181 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 182 int end); 183 184 /** 185 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 186 * 187 * <p> 188 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.trash.model.impl.TrashEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 189 * </p> 190 * 191 * @param dynamicQuery the dynamic query 192 * @param start the lower bound of the range of model instances 193 * @param end the upper bound of the range of model instances (not inclusive) 194 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 195 * @return the ordered range of matching rows 196 */ 197 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 198 int end, OrderByComparator<T> orderByComparator); 199 200 /** 201 * Returns the number of rows matching the dynamic query. 202 * 203 * @param dynamicQuery the dynamic query 204 * @return the number of rows matching the dynamic query 205 */ 206 public long dynamicQueryCount(DynamicQuery dynamicQuery); 207 208 /** 209 * Returns the number of rows matching the dynamic query. 210 * 211 * @param dynamicQuery the dynamic query 212 * @param projection the projection to apply to the query 213 * @return the number of rows matching the dynamic query 214 */ 215 public long dynamicQueryCount(DynamicQuery dynamicQuery, 216 Projection projection); 217 218 /** 219 * Returns the trash entry with the entity class name and primary key. 220 * 221 * @param className the class name of the entity 222 * @param classPK the primary key of the entity 223 * @return the trash entry with the entity class name and primary key 224 */ 225 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 226 public TrashEntry fetchEntry(java.lang.String className, long classPK); 227 228 /** 229 * Returns the trash entry with the primary key. 230 * 231 * @param entryId the primary key of the entry 232 * @return the trash entry with the primary key 233 */ 234 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 235 public TrashEntry fetchEntry(long entryId); 236 237 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 238 public TrashEntry fetchTrashEntry(long entryId); 239 240 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 241 public ActionableDynamicQuery getActionableDynamicQuery(); 242 243 /** 244 * Returns the trash entries with the matching group ID. 245 * 246 * @param groupId the primary key of the group 247 * @return the trash entries with the group ID 248 */ 249 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 250 public List<TrashEntry> getEntries(long groupId); 251 252 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 253 public List<TrashEntry> getEntries(long groupId, java.lang.String className); 254 255 /** 256 * Returns a range of all the trash entries matching the group ID. 257 * 258 * @param groupId the primary key of the group 259 * @param start the lower bound of the range of trash entries to return 260 * @param end the upper bound of the range of trash entries to return (not 261 inclusive) 262 * @return the range of matching trash entries 263 */ 264 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 265 public List<TrashEntry> getEntries(long groupId, int start, int end); 266 267 /** 268 * Returns a range of all the trash entries matching the group ID. 269 * 270 * @param groupId the primary key of the group 271 * @param start the lower bound of the range of trash entries to return 272 * @param end the upper bound of the range of trash entries to return (not 273 inclusive) 274 * @param obc the comparator to order the trash entries (optionally 275 <code>null</code>) 276 * @return the range of matching trash entries ordered by comparator 277 <code>obc</code> 278 */ 279 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 280 public List<TrashEntry> getEntries(long groupId, int start, int end, 281 OrderByComparator<TrashEntry> obc); 282 283 /** 284 * Returns the number of trash entries with the group ID. 285 * 286 * @param groupId the primary key of the group 287 * @return the number of matching trash entries 288 */ 289 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 290 public int getEntriesCount(long groupId); 291 292 /** 293 * Returns the entry with the entity class name and primary key. 294 * 295 * @param className the class name of the entity 296 * @param classPK the primary key of the entity 297 * @return the trash entry with the entity class name and primary key 298 */ 299 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 300 public TrashEntry getEntry(java.lang.String className, long classPK) 301 throws PortalException; 302 303 /** 304 * Returns the trash entry with the primary key. 305 * 306 * @param entryId the primary key of the trash entry 307 * @return the trash entry with the primary key 308 */ 309 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 310 public TrashEntry getEntry(long entryId) throws PortalException; 311 312 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 313 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 314 315 /** 316 * Returns the OSGi service identifier. 317 * 318 * @return the OSGi service identifier 319 */ 320 public java.lang.String getOSGiServiceIdentifier(); 321 322 @Override 323 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 324 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 325 throws PortalException; 326 327 /** 328 * Returns a range of all the trash entries. 329 * 330 * <p> 331 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.trash.model.impl.TrashEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 332 * </p> 333 * 334 * @param start the lower bound of the range of trash entries 335 * @param end the upper bound of the range of trash entries (not inclusive) 336 * @return the range of trash entries 337 */ 338 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 339 public List<TrashEntry> getTrashEntries(int start, int end); 340 341 /** 342 * Returns the number of trash entries. 343 * 344 * @return the number of trash entries 345 */ 346 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 347 public int getTrashEntriesCount(); 348 349 /** 350 * Returns the trash entry with the primary key. 351 * 352 * @param entryId the primary key of the trash entry 353 * @return the trash entry 354 * @throws PortalException if a trash entry with the primary key could not be found 355 */ 356 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 357 public TrashEntry getTrashEntry(long entryId) throws PortalException; 358 359 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 360 public Hits search(long companyId, long groupId, long userId, 361 java.lang.String keywords, int start, int end, Sort sort); 362 363 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 364 public BaseModelSearchResult<TrashEntry> searchTrashEntries( 365 long companyId, long groupId, long userId, java.lang.String keywords, 366 int start, int end, Sort sort); 367 368 /** 369 * Updates the trash entry in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 370 * 371 * @param trashEntry the trash entry 372 * @return the trash entry that was updated 373 */ 374 @Indexable(type = IndexableType.REINDEX) 375 public TrashEntry updateTrashEntry(TrashEntry trashEntry); 376 }