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.portal.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 local service utility for Lock. This utility wraps 024 * {@link com.liferay.portal.service.impl.LockLocalServiceImpl} and is the 025 * primary access point for service operations in application layer code running 026 * on the local server. Methods of this service will not have security checks 027 * based on the propagated JAAS credentials because this service can only be 028 * accessed from within the same VM. 029 * 030 * @author Brian Wing Shun Chan 031 * @see LockLocalService 032 * @see com.liferay.portal.service.base.LockLocalServiceBaseImpl 033 * @see com.liferay.portal.service.impl.LockLocalServiceImpl 034 * @generated 035 */ 036 @ProviderType 037 public class LockLocalServiceUtil { 038 /* 039 * NOTE FOR DEVELOPERS: 040 * 041 * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.LockLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. 042 */ 043 044 /** 045 * Adds the lock to the database. Also notifies the appropriate model listeners. 046 * 047 * @param lock the lock 048 * @return the lock that was added 049 */ 050 public static com.liferay.portal.model.Lock addLock( 051 com.liferay.portal.model.Lock lock) { 052 return getService().addLock(lock); 053 } 054 055 public static void clear() { 056 getService().clear(); 057 } 058 059 /** 060 * Creates a new lock with the primary key. Does not add the lock to the database. 061 * 062 * @param lockId the primary key for the new lock 063 * @return the new lock 064 */ 065 public static com.liferay.portal.model.Lock createLock(long lockId) { 066 return getService().createLock(lockId); 067 } 068 069 /** 070 * Deletes the lock from the database. Also notifies the appropriate model listeners. 071 * 072 * @param lock the lock 073 * @return the lock that was removed 074 */ 075 public static com.liferay.portal.model.Lock deleteLock( 076 com.liferay.portal.model.Lock lock) { 077 return getService().deleteLock(lock); 078 } 079 080 /** 081 * Deletes the lock with the primary key from the database. Also notifies the appropriate model listeners. 082 * 083 * @param lockId the primary key of the lock 084 * @return the lock that was removed 085 * @throws PortalException if a lock with the primary key could not be found 086 */ 087 public static com.liferay.portal.model.Lock deleteLock(long lockId) 088 throws com.liferay.portal.kernel.exception.PortalException { 089 return getService().deleteLock(lockId); 090 } 091 092 /** 093 * @throws PortalException 094 */ 095 public static com.liferay.portal.model.PersistedModel deletePersistedModel( 096 com.liferay.portal.model.PersistedModel persistedModel) 097 throws com.liferay.portal.kernel.exception.PortalException { 098 return getService().deletePersistedModel(persistedModel); 099 } 100 101 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 102 return getService().dynamicQuery(); 103 } 104 105 /** 106 * Performs a dynamic query on the database and returns the matching rows. 107 * 108 * @param dynamicQuery the dynamic query 109 * @return the matching rows 110 */ 111 public static <T> java.util.List<T> dynamicQuery( 112 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 113 return getService().dynamicQuery(dynamicQuery); 114 } 115 116 /** 117 * Performs a dynamic query on the database and returns a range of the matching rows. 118 * 119 * <p> 120 * 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.portal.model.impl.LockModelImpl}. 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. 121 * </p> 122 * 123 * @param dynamicQuery the dynamic query 124 * @param start the lower bound of the range of model instances 125 * @param end the upper bound of the range of model instances (not inclusive) 126 * @return the range of matching rows 127 */ 128 public static <T> java.util.List<T> dynamicQuery( 129 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 130 int end) { 131 return getService().dynamicQuery(dynamicQuery, start, end); 132 } 133 134 /** 135 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 136 * 137 * <p> 138 * 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.portal.model.impl.LockModelImpl}. 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. 139 * </p> 140 * 141 * @param dynamicQuery the dynamic query 142 * @param start the lower bound of the range of model instances 143 * @param end the upper bound of the range of model instances (not inclusive) 144 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 145 * @return the ordered range of matching rows 146 */ 147 public static <T> java.util.List<T> dynamicQuery( 148 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 149 int end, 150 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator) { 151 return getService() 152 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 153 } 154 155 /** 156 * Returns the number of rows matching the dynamic query. 157 * 158 * @param dynamicQuery the dynamic query 159 * @return the number of rows matching the dynamic query 160 */ 161 public static long dynamicQueryCount( 162 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) { 163 return getService().dynamicQueryCount(dynamicQuery); 164 } 165 166 /** 167 * Returns the number of rows matching the dynamic query. 168 * 169 * @param dynamicQuery the dynamic query 170 * @param projection the projection to apply to the query 171 * @return the number of rows matching the dynamic query 172 */ 173 public static long dynamicQueryCount( 174 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 175 com.liferay.portal.kernel.dao.orm.Projection projection) { 176 return getService().dynamicQueryCount(dynamicQuery, projection); 177 } 178 179 public static com.liferay.portal.model.Lock fetchLock(long lockId) { 180 return getService().fetchLock(lockId); 181 } 182 183 /** 184 * Returns the lock with the matching UUID and company. 185 * 186 * @param uuid the lock's UUID 187 * @param companyId the primary key of the company 188 * @return the matching lock, or <code>null</code> if a matching lock could not be found 189 */ 190 public static com.liferay.portal.model.Lock fetchLockByUuidAndCompanyId( 191 java.lang.String uuid, long companyId) { 192 return getService().fetchLockByUuidAndCompanyId(uuid, companyId); 193 } 194 195 public static com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery() { 196 return getService().getActionableDynamicQuery(); 197 } 198 199 /** 200 * Returns the Spring bean ID for this bean. 201 * 202 * @return the Spring bean ID for this bean 203 */ 204 public static java.lang.String getBeanIdentifier() { 205 return getService().getBeanIdentifier(); 206 } 207 208 public static com.liferay.portal.model.Lock getLock( 209 java.lang.String className, long key) 210 throws com.liferay.portal.kernel.exception.PortalException { 211 return getService().getLock(className, key); 212 } 213 214 public static com.liferay.portal.model.Lock getLock( 215 java.lang.String className, java.lang.String key) 216 throws com.liferay.portal.kernel.exception.PortalException { 217 return getService().getLock(className, key); 218 } 219 220 /** 221 * Returns the lock with the primary key. 222 * 223 * @param lockId the primary key of the lock 224 * @return the lock 225 * @throws PortalException if a lock with the primary key could not be found 226 */ 227 public static com.liferay.portal.model.Lock getLock(long lockId) 228 throws com.liferay.portal.kernel.exception.PortalException { 229 return getService().getLock(lockId); 230 } 231 232 /** 233 * Returns the lock with the matching UUID and company. 234 * 235 * @param uuid the lock's UUID 236 * @param companyId the primary key of the company 237 * @return the matching lock 238 * @throws PortalException if a matching lock could not be found 239 */ 240 public static com.liferay.portal.model.Lock getLockByUuidAndCompanyId( 241 java.lang.String uuid, long companyId) 242 throws com.liferay.portal.kernel.exception.PortalException { 243 return getService().getLockByUuidAndCompanyId(uuid, companyId); 244 } 245 246 /** 247 * Returns a range of all the locks. 248 * 249 * <p> 250 * 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.portal.model.impl.LockModelImpl}. 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. 251 * </p> 252 * 253 * @param start the lower bound of the range of locks 254 * @param end the upper bound of the range of locks (not inclusive) 255 * @return the range of locks 256 */ 257 public static java.util.List<com.liferay.portal.model.Lock> getLocks( 258 int start, int end) { 259 return getService().getLocks(start, end); 260 } 261 262 /** 263 * Returns the number of locks. 264 * 265 * @return the number of locks 266 */ 267 public static int getLocksCount() { 268 return getService().getLocksCount(); 269 } 270 271 public static com.liferay.portal.model.PersistedModel getPersistedModel( 272 java.io.Serializable primaryKeyObj) 273 throws com.liferay.portal.kernel.exception.PortalException { 274 return getService().getPersistedModel(primaryKeyObj); 275 } 276 277 public static boolean hasLock(long userId, java.lang.String className, 278 java.lang.String key) { 279 return getService().hasLock(userId, className, key); 280 } 281 282 public static boolean hasLock(long userId, java.lang.String className, 283 long key) { 284 return getService().hasLock(userId, className, key); 285 } 286 287 public static boolean isLocked(java.lang.String className, 288 java.lang.String key) { 289 return getService().isLocked(className, key); 290 } 291 292 public static boolean isLocked(java.lang.String className, long key) { 293 return getService().isLocked(className, key); 294 } 295 296 public static com.liferay.portal.model.Lock lock( 297 java.lang.String className, java.lang.String key, 298 java.lang.String expectedOwner, java.lang.String updatedOwner) { 299 return getService().lock(className, key, expectedOwner, updatedOwner); 300 } 301 302 /** 303 * @deprecated As of 6.2.0, replaced by {@link #lock(String, String, String, 304 String)} 305 */ 306 @Deprecated 307 public static com.liferay.portal.model.Lock lock( 308 java.lang.String className, java.lang.String key, 309 java.lang.String expectedOwner, java.lang.String updatedOwner, 310 boolean retrieveFromCache) { 311 return getService() 312 .lock(className, key, expectedOwner, updatedOwner, 313 retrieveFromCache); 314 } 315 316 public static com.liferay.portal.model.Lock lock( 317 java.lang.String className, java.lang.String key, java.lang.String owner) { 318 return getService().lock(className, key, owner); 319 } 320 321 /** 322 * @deprecated As of 6.2.0, replaced by {@link #lock(String, String, 323 String)} 324 */ 325 @Deprecated 326 public static com.liferay.portal.model.Lock lock( 327 java.lang.String className, java.lang.String key, 328 java.lang.String owner, boolean retrieveFromCache) { 329 return getService().lock(className, key, owner, retrieveFromCache); 330 } 331 332 public static com.liferay.portal.model.Lock lock(long userId, 333 java.lang.String className, java.lang.String key, 334 java.lang.String owner, boolean inheritable, long expirationTime) 335 throws com.liferay.portal.kernel.exception.PortalException { 336 return getService() 337 .lock(userId, className, key, owner, inheritable, 338 expirationTime); 339 } 340 341 public static com.liferay.portal.model.Lock lock(long userId, 342 java.lang.String className, long key, java.lang.String owner, 343 boolean inheritable, long expirationTime) 344 throws com.liferay.portal.kernel.exception.PortalException { 345 return getService() 346 .lock(userId, className, key, owner, inheritable, 347 expirationTime); 348 } 349 350 public static com.liferay.portal.model.Lock refresh(java.lang.String uuid, 351 long companyId, long expirationTime) 352 throws com.liferay.portal.kernel.exception.PortalException { 353 return getService().refresh(uuid, companyId, expirationTime); 354 } 355 356 /** 357 * Sets the Spring bean ID for this bean. 358 * 359 * @param beanIdentifier the Spring bean ID for this bean 360 */ 361 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 362 getService().setBeanIdentifier(beanIdentifier); 363 } 364 365 public static void unlock(java.lang.String className, long key) { 366 getService().unlock(className, key); 367 } 368 369 public static void unlock(java.lang.String className, java.lang.String key) { 370 getService().unlock(className, key); 371 } 372 373 public static void unlock(java.lang.String className, java.lang.String key, 374 java.lang.String owner) { 375 getService().unlock(className, key, owner); 376 } 377 378 /** 379 * @deprecated As of 6.2.0, replaced by {@link #unlock(String, String, 380 String)} 381 */ 382 @Deprecated 383 public static void unlock(java.lang.String className, java.lang.String key, 384 java.lang.String owner, boolean retrieveFromCache) { 385 getService().unlock(className, key, owner, retrieveFromCache); 386 } 387 388 /** 389 * Updates the lock in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 390 * 391 * @param lock the lock 392 * @return the lock that was updated 393 */ 394 public static com.liferay.portal.model.Lock updateLock( 395 com.liferay.portal.model.Lock lock) { 396 return getService().updateLock(lock); 397 } 398 399 public static LockLocalService getService() { 400 if (_service == null) { 401 _service = (LockLocalService)PortalBeanLocatorUtil.locate(LockLocalService.class.getName()); 402 403 ReferenceRegistry.registerReference(LockLocalServiceUtil.class, 404 "_service"); 405 } 406 407 return _service; 408 } 409 410 /** 411 * @deprecated As of 6.2.0 412 */ 413 @Deprecated 414 public void setService(LockLocalService service) { 415 } 416 417 private static LockLocalService _service; 418 }