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