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.shopping.service.persistence; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 020 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 021 import com.liferay.portal.kernel.util.OrderByComparator; 022 import com.liferay.portal.kernel.util.ReferenceRegistry; 023 import com.liferay.portal.service.ServiceContext; 024 025 import com.liferay.portlet.shopping.model.ShoppingCoupon; 026 027 import java.util.List; 028 029 /** 030 * The persistence utility for the shopping coupon service. This utility wraps {@link com.liferay.portlet.shopping.service.persistence.impl.ShoppingCouponPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class. 031 * 032 * <p> 033 * Caching information and settings can be found in <code>portal.properties</code> 034 * </p> 035 * 036 * @author Brian Wing Shun Chan 037 * @see ShoppingCouponPersistence 038 * @see com.liferay.portlet.shopping.service.persistence.impl.ShoppingCouponPersistenceImpl 039 * @generated 040 */ 041 @ProviderType 042 public class ShoppingCouponUtil { 043 /* 044 * NOTE FOR DEVELOPERS: 045 * 046 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class. 047 */ 048 049 /** 050 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache() 051 */ 052 public static void clearCache() { 053 getPersistence().clearCache(); 054 } 055 056 /** 057 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel) 058 */ 059 public static void clearCache(ShoppingCoupon shoppingCoupon) { 060 getPersistence().clearCache(shoppingCoupon); 061 } 062 063 /** 064 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery) 065 */ 066 public static long countWithDynamicQuery(DynamicQuery dynamicQuery) { 067 return getPersistence().countWithDynamicQuery(dynamicQuery); 068 } 069 070 /** 071 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery) 072 */ 073 public static List<ShoppingCoupon> findWithDynamicQuery( 074 DynamicQuery dynamicQuery) { 075 return getPersistence().findWithDynamicQuery(dynamicQuery); 076 } 077 078 /** 079 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int) 080 */ 081 public static List<ShoppingCoupon> findWithDynamicQuery( 082 DynamicQuery dynamicQuery, int start, int end) { 083 return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); 084 } 085 086 /** 087 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) 088 */ 089 public static List<ShoppingCoupon> findWithDynamicQuery( 090 DynamicQuery dynamicQuery, int start, int end, 091 OrderByComparator<ShoppingCoupon> orderByComparator) { 092 return getPersistence() 093 .findWithDynamicQuery(dynamicQuery, start, end, 094 orderByComparator); 095 } 096 097 /** 098 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel) 099 */ 100 public static ShoppingCoupon update(ShoppingCoupon shoppingCoupon) { 101 return getPersistence().update(shoppingCoupon); 102 } 103 104 /** 105 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext) 106 */ 107 public static ShoppingCoupon update(ShoppingCoupon shoppingCoupon, 108 ServiceContext serviceContext) { 109 return getPersistence().update(shoppingCoupon, serviceContext); 110 } 111 112 /** 113 * Returns all the shopping coupons where groupId = ?. 114 * 115 * @param groupId the group ID 116 * @return the matching shopping coupons 117 */ 118 public static List<ShoppingCoupon> findByGroupId(long groupId) { 119 return getPersistence().findByGroupId(groupId); 120 } 121 122 /** 123 * Returns a range of all the shopping coupons where groupId = ?. 124 * 125 * <p> 126 * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ShoppingCouponModelImpl}. 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. 127 * </p> 128 * 129 * @param groupId the group ID 130 * @param start the lower bound of the range of shopping coupons 131 * @param end the upper bound of the range of shopping coupons (not inclusive) 132 * @return the range of matching shopping coupons 133 */ 134 public static List<ShoppingCoupon> findByGroupId(long groupId, int start, 135 int end) { 136 return getPersistence().findByGroupId(groupId, start, end); 137 } 138 139 /** 140 * Returns an ordered range of all the shopping coupons where groupId = ?. 141 * 142 * <p> 143 * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ShoppingCouponModelImpl}. 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. 144 * </p> 145 * 146 * @param groupId the group ID 147 * @param start the lower bound of the range of shopping coupons 148 * @param end the upper bound of the range of shopping coupons (not inclusive) 149 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 150 * @return the ordered range of matching shopping coupons 151 */ 152 public static List<ShoppingCoupon> findByGroupId(long groupId, int start, 153 int end, OrderByComparator<ShoppingCoupon> orderByComparator) { 154 return getPersistence() 155 .findByGroupId(groupId, start, end, orderByComparator); 156 } 157 158 /** 159 * Returns the first shopping coupon in the ordered set where groupId = ?. 160 * 161 * @param groupId the group ID 162 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 163 * @return the first matching shopping coupon 164 * @throws NoSuchCouponException if a matching shopping coupon could not be found 165 */ 166 public static ShoppingCoupon findByGroupId_First(long groupId, 167 OrderByComparator<ShoppingCoupon> orderByComparator) 168 throws com.liferay.portlet.shopping.NoSuchCouponException { 169 return getPersistence().findByGroupId_First(groupId, orderByComparator); 170 } 171 172 /** 173 * Returns the first shopping coupon in the ordered set where groupId = ?. 174 * 175 * @param groupId the group ID 176 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 177 * @return the first matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found 178 */ 179 public static ShoppingCoupon fetchByGroupId_First(long groupId, 180 OrderByComparator<ShoppingCoupon> orderByComparator) { 181 return getPersistence().fetchByGroupId_First(groupId, orderByComparator); 182 } 183 184 /** 185 * Returns the last shopping coupon in the ordered set where groupId = ?. 186 * 187 * @param groupId the group ID 188 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 189 * @return the last matching shopping coupon 190 * @throws NoSuchCouponException if a matching shopping coupon could not be found 191 */ 192 public static ShoppingCoupon findByGroupId_Last(long groupId, 193 OrderByComparator<ShoppingCoupon> orderByComparator) 194 throws com.liferay.portlet.shopping.NoSuchCouponException { 195 return getPersistence().findByGroupId_Last(groupId, orderByComparator); 196 } 197 198 /** 199 * Returns the last shopping coupon in the ordered set where groupId = ?. 200 * 201 * @param groupId the group ID 202 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 203 * @return the last matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found 204 */ 205 public static ShoppingCoupon fetchByGroupId_Last(long groupId, 206 OrderByComparator<ShoppingCoupon> orderByComparator) { 207 return getPersistence().fetchByGroupId_Last(groupId, orderByComparator); 208 } 209 210 /** 211 * Returns the shopping coupons before and after the current shopping coupon in the ordered set where groupId = ?. 212 * 213 * @param couponId the primary key of the current shopping coupon 214 * @param groupId the group ID 215 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 216 * @return the previous, current, and next shopping coupon 217 * @throws NoSuchCouponException if a shopping coupon with the primary key could not be found 218 */ 219 public static ShoppingCoupon[] findByGroupId_PrevAndNext(long couponId, 220 long groupId, OrderByComparator<ShoppingCoupon> orderByComparator) 221 throws com.liferay.portlet.shopping.NoSuchCouponException { 222 return getPersistence() 223 .findByGroupId_PrevAndNext(couponId, groupId, 224 orderByComparator); 225 } 226 227 /** 228 * Removes all the shopping coupons where groupId = ? from the database. 229 * 230 * @param groupId the group ID 231 */ 232 public static void removeByGroupId(long groupId) { 233 getPersistence().removeByGroupId(groupId); 234 } 235 236 /** 237 * Returns the number of shopping coupons where groupId = ?. 238 * 239 * @param groupId the group ID 240 * @return the number of matching shopping coupons 241 */ 242 public static int countByGroupId(long groupId) { 243 return getPersistence().countByGroupId(groupId); 244 } 245 246 /** 247 * Returns the shopping coupon where code = ? or throws a {@link NoSuchCouponException} if it could not be found. 248 * 249 * @param code the code 250 * @return the matching shopping coupon 251 * @throws NoSuchCouponException if a matching shopping coupon could not be found 252 */ 253 public static ShoppingCoupon findByCode(java.lang.String code) 254 throws com.liferay.portlet.shopping.NoSuchCouponException { 255 return getPersistence().findByCode(code); 256 } 257 258 /** 259 * Returns the shopping coupon where code = ? or returns <code>null</code> if it could not be found. Uses the finder cache. 260 * 261 * @param code the code 262 * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found 263 */ 264 public static ShoppingCoupon fetchByCode(java.lang.String code) { 265 return getPersistence().fetchByCode(code); 266 } 267 268 /** 269 * Returns the shopping coupon where code = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. 270 * 271 * @param code the code 272 * @param retrieveFromCache whether to use the finder cache 273 * @return the matching shopping coupon, or <code>null</code> if a matching shopping coupon could not be found 274 */ 275 public static ShoppingCoupon fetchByCode(java.lang.String code, 276 boolean retrieveFromCache) { 277 return getPersistence().fetchByCode(code, retrieveFromCache); 278 } 279 280 /** 281 * Removes the shopping coupon where code = ? from the database. 282 * 283 * @param code the code 284 * @return the shopping coupon that was removed 285 */ 286 public static ShoppingCoupon removeByCode(java.lang.String code) 287 throws com.liferay.portlet.shopping.NoSuchCouponException { 288 return getPersistence().removeByCode(code); 289 } 290 291 /** 292 * Returns the number of shopping coupons where code = ?. 293 * 294 * @param code the code 295 * @return the number of matching shopping coupons 296 */ 297 public static int countByCode(java.lang.String code) { 298 return getPersistence().countByCode(code); 299 } 300 301 /** 302 * Caches the shopping coupon in the entity cache if it is enabled. 303 * 304 * @param shoppingCoupon the shopping coupon 305 */ 306 public static void cacheResult(ShoppingCoupon shoppingCoupon) { 307 getPersistence().cacheResult(shoppingCoupon); 308 } 309 310 /** 311 * Caches the shopping coupons in the entity cache if it is enabled. 312 * 313 * @param shoppingCoupons the shopping coupons 314 */ 315 public static void cacheResult(List<ShoppingCoupon> shoppingCoupons) { 316 getPersistence().cacheResult(shoppingCoupons); 317 } 318 319 /** 320 * Creates a new shopping coupon with the primary key. Does not add the shopping coupon to the database. 321 * 322 * @param couponId the primary key for the new shopping coupon 323 * @return the new shopping coupon 324 */ 325 public static ShoppingCoupon create(long couponId) { 326 return getPersistence().create(couponId); 327 } 328 329 /** 330 * Removes the shopping coupon with the primary key from the database. Also notifies the appropriate model listeners. 331 * 332 * @param couponId the primary key of the shopping coupon 333 * @return the shopping coupon that was removed 334 * @throws NoSuchCouponException if a shopping coupon with the primary key could not be found 335 */ 336 public static ShoppingCoupon remove(long couponId) 337 throws com.liferay.portlet.shopping.NoSuchCouponException { 338 return getPersistence().remove(couponId); 339 } 340 341 public static ShoppingCoupon updateImpl(ShoppingCoupon shoppingCoupon) { 342 return getPersistence().updateImpl(shoppingCoupon); 343 } 344 345 /** 346 * Returns the shopping coupon with the primary key or throws a {@link NoSuchCouponException} if it could not be found. 347 * 348 * @param couponId the primary key of the shopping coupon 349 * @return the shopping coupon 350 * @throws NoSuchCouponException if a shopping coupon with the primary key could not be found 351 */ 352 public static ShoppingCoupon findByPrimaryKey(long couponId) 353 throws com.liferay.portlet.shopping.NoSuchCouponException { 354 return getPersistence().findByPrimaryKey(couponId); 355 } 356 357 /** 358 * Returns the shopping coupon with the primary key or returns <code>null</code> if it could not be found. 359 * 360 * @param couponId the primary key of the shopping coupon 361 * @return the shopping coupon, or <code>null</code> if a shopping coupon with the primary key could not be found 362 */ 363 public static ShoppingCoupon fetchByPrimaryKey(long couponId) { 364 return getPersistence().fetchByPrimaryKey(couponId); 365 } 366 367 public static java.util.Map<java.io.Serializable, ShoppingCoupon> fetchByPrimaryKeys( 368 java.util.Set<java.io.Serializable> primaryKeys) { 369 return getPersistence().fetchByPrimaryKeys(primaryKeys); 370 } 371 372 /** 373 * Returns all the shopping coupons. 374 * 375 * @return the shopping coupons 376 */ 377 public static List<ShoppingCoupon> findAll() { 378 return getPersistence().findAll(); 379 } 380 381 /** 382 * Returns a range of all the shopping coupons. 383 * 384 * <p> 385 * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ShoppingCouponModelImpl}. 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. 386 * </p> 387 * 388 * @param start the lower bound of the range of shopping coupons 389 * @param end the upper bound of the range of shopping coupons (not inclusive) 390 * @return the range of shopping coupons 391 */ 392 public static List<ShoppingCoupon> findAll(int start, int end) { 393 return getPersistence().findAll(start, end); 394 } 395 396 /** 397 * Returns an ordered range of all the shopping coupons. 398 * 399 * <p> 400 * 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 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 QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ShoppingCouponModelImpl}. 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. 401 * </p> 402 * 403 * @param start the lower bound of the range of shopping coupons 404 * @param end the upper bound of the range of shopping coupons (not inclusive) 405 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 406 * @return the ordered range of shopping coupons 407 */ 408 public static List<ShoppingCoupon> findAll(int start, int end, 409 OrderByComparator<ShoppingCoupon> orderByComparator) { 410 return getPersistence().findAll(start, end, orderByComparator); 411 } 412 413 /** 414 * Removes all the shopping coupons from the database. 415 */ 416 public static void removeAll() { 417 getPersistence().removeAll(); 418 } 419 420 /** 421 * Returns the number of shopping coupons. 422 * 423 * @return the number of shopping coupons 424 */ 425 public static int countAll() { 426 return getPersistence().countAll(); 427 } 428 429 public static ShoppingCouponPersistence getPersistence() { 430 if (_persistence == null) { 431 _persistence = (ShoppingCouponPersistence)PortalBeanLocatorUtil.locate(ShoppingCouponPersistence.class.getName()); 432 433 ReferenceRegistry.registerReference(ShoppingCouponUtil.class, 434 "_persistence"); 435 } 436 437 return _persistence; 438 } 439 440 /** 441 * @deprecated As of 6.2.0 442 */ 443 @Deprecated 444 public void setPersistence(ShoppingCouponPersistence persistence) { 445 } 446 447 private static ShoppingCouponPersistence _persistence; 448 }