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