001 /** 002 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 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#remove(com.liferay.portal.model.BaseModel) 097 */ 098 public static Shard remove(Shard shard) throws SystemException { 099 return getPersistence().remove(shard); 100 } 101 102 /** 103 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean) 104 */ 105 public static Shard update(Shard shard, boolean merge) 106 throws SystemException { 107 return getPersistence().update(shard, merge); 108 } 109 110 /** 111 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext) 112 */ 113 public static Shard update(Shard shard, boolean merge, 114 ServiceContext serviceContext) throws SystemException { 115 return getPersistence().update(shard, merge, serviceContext); 116 } 117 118 /** 119 * Caches the shard in the entity cache if it is enabled. 120 * 121 * @param shard the shard to cache 122 */ 123 public static void cacheResult(com.liferay.portal.model.Shard shard) { 124 getPersistence().cacheResult(shard); 125 } 126 127 /** 128 * Caches the shards in the entity cache if it is enabled. 129 * 130 * @param shards the shards to cache 131 */ 132 public static void cacheResult( 133 java.util.List<com.liferay.portal.model.Shard> shards) { 134 getPersistence().cacheResult(shards); 135 } 136 137 /** 138 * Creates a new shard with the primary key. Does not add the shard to the database. 139 * 140 * @param shardId the primary key for the new shard 141 * @return the new shard 142 */ 143 public static com.liferay.portal.model.Shard create(long shardId) { 144 return getPersistence().create(shardId); 145 } 146 147 /** 148 * Removes the shard with the primary key from the database. Also notifies the appropriate model listeners. 149 * 150 * @param shardId the primary key of the shard to remove 151 * @return the shard that was removed 152 * @throws com.liferay.portal.NoSuchShardException if a shard with the primary key could not be found 153 * @throws SystemException if a system exception occurred 154 */ 155 public static com.liferay.portal.model.Shard remove(long shardId) 156 throws com.liferay.portal.NoSuchShardException, 157 com.liferay.portal.kernel.exception.SystemException { 158 return getPersistence().remove(shardId); 159 } 160 161 public static com.liferay.portal.model.Shard updateImpl( 162 com.liferay.portal.model.Shard shard, boolean merge) 163 throws com.liferay.portal.kernel.exception.SystemException { 164 return getPersistence().updateImpl(shard, merge); 165 } 166 167 /** 168 * Finds the shard with the primary key or throws a {@link com.liferay.portal.NoSuchShardException} if it could not be found. 169 * 170 * @param shardId the primary key of the shard to find 171 * @return the shard 172 * @throws com.liferay.portal.NoSuchShardException if a shard with the primary key could not be found 173 * @throws SystemException if a system exception occurred 174 */ 175 public static com.liferay.portal.model.Shard findByPrimaryKey(long shardId) 176 throws com.liferay.portal.NoSuchShardException, 177 com.liferay.portal.kernel.exception.SystemException { 178 return getPersistence().findByPrimaryKey(shardId); 179 } 180 181 /** 182 * Finds the shard with the primary key or returns <code>null</code> if it could not be found. 183 * 184 * @param shardId the primary key of the shard to find 185 * @return the shard, or <code>null</code> if a shard with the primary key could not be found 186 * @throws SystemException if a system exception occurred 187 */ 188 public static com.liferay.portal.model.Shard fetchByPrimaryKey(long shardId) 189 throws com.liferay.portal.kernel.exception.SystemException { 190 return getPersistence().fetchByPrimaryKey(shardId); 191 } 192 193 /** 194 * Finds the shard where name = ? or throws a {@link com.liferay.portal.NoSuchShardException} if it could not be found. 195 * 196 * @param name the name to search with 197 * @return the matching shard 198 * @throws com.liferay.portal.NoSuchShardException if a matching shard could not be found 199 * @throws SystemException if a system exception occurred 200 */ 201 public static com.liferay.portal.model.Shard findByName( 202 java.lang.String name) 203 throws com.liferay.portal.NoSuchShardException, 204 com.liferay.portal.kernel.exception.SystemException { 205 return getPersistence().findByName(name); 206 } 207 208 /** 209 * Finds the shard where name = ? or returns <code>null</code> if it could not be found. Uses the finder cache. 210 * 211 * @param name the name to search with 212 * @return the matching shard, or <code>null</code> if a matching shard could not be found 213 * @throws SystemException if a system exception occurred 214 */ 215 public static com.liferay.portal.model.Shard fetchByName( 216 java.lang.String name) 217 throws com.liferay.portal.kernel.exception.SystemException { 218 return getPersistence().fetchByName(name); 219 } 220 221 /** 222 * Finds the shard where name = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. 223 * 224 * @param name the name to search with 225 * @return the matching shard, or <code>null</code> if a matching shard could not be found 226 * @throws SystemException if a system exception occurred 227 */ 228 public static com.liferay.portal.model.Shard fetchByName( 229 java.lang.String name, boolean retrieveFromCache) 230 throws com.liferay.portal.kernel.exception.SystemException { 231 return getPersistence().fetchByName(name, retrieveFromCache); 232 } 233 234 /** 235 * Finds the shard where classNameId = ? and classPK = ? or throws a {@link com.liferay.portal.NoSuchShardException} if it could not be found. 236 * 237 * @param classNameId the class name ID to search with 238 * @param classPK the class p k to search with 239 * @return the matching shard 240 * @throws com.liferay.portal.NoSuchShardException if a matching shard could not be found 241 * @throws SystemException if a system exception occurred 242 */ 243 public static com.liferay.portal.model.Shard findByC_C(long classNameId, 244 long classPK) 245 throws com.liferay.portal.NoSuchShardException, 246 com.liferay.portal.kernel.exception.SystemException { 247 return getPersistence().findByC_C(classNameId, classPK); 248 } 249 250 /** 251 * Finds the shard where classNameId = ? and classPK = ? or returns <code>null</code> if it could not be found. Uses the finder cache. 252 * 253 * @param classNameId the class name ID to search with 254 * @param classPK the class p k to search with 255 * @return the matching shard, or <code>null</code> if a matching shard could not be found 256 * @throws SystemException if a system exception occurred 257 */ 258 public static com.liferay.portal.model.Shard fetchByC_C(long classNameId, 259 long classPK) 260 throws com.liferay.portal.kernel.exception.SystemException { 261 return getPersistence().fetchByC_C(classNameId, classPK); 262 } 263 264 /** 265 * Finds the shard where classNameId = ? and classPK = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. 266 * 267 * @param classNameId the class name ID to search with 268 * @param classPK the class p k to search with 269 * @return the matching shard, or <code>null</code> if a matching shard could not be found 270 * @throws SystemException if a system exception occurred 271 */ 272 public static com.liferay.portal.model.Shard fetchByC_C(long classNameId, 273 long classPK, boolean retrieveFromCache) 274 throws com.liferay.portal.kernel.exception.SystemException { 275 return getPersistence() 276 .fetchByC_C(classNameId, classPK, retrieveFromCache); 277 } 278 279 /** 280 * Finds all the shards. 281 * 282 * @return the shards 283 * @throws SystemException if a system exception occurred 284 */ 285 public static java.util.List<com.liferay.portal.model.Shard> findAll() 286 throws com.liferay.portal.kernel.exception.SystemException { 287 return getPersistence().findAll(); 288 } 289 290 /** 291 * Finds a range of all the shards. 292 * 293 * <p> 294 * 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. 295 * </p> 296 * 297 * @param start the lower bound of the range of shards to return 298 * @param end the upper bound of the range of shards to return (not inclusive) 299 * @return the range of shards 300 * @throws SystemException if a system exception occurred 301 */ 302 public static java.util.List<com.liferay.portal.model.Shard> findAll( 303 int start, int end) 304 throws com.liferay.portal.kernel.exception.SystemException { 305 return getPersistence().findAll(start, end); 306 } 307 308 /** 309 * Finds an ordered range of all the shards. 310 * 311 * <p> 312 * 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. 313 * </p> 314 * 315 * @param start the lower bound of the range of shards to return 316 * @param end the upper bound of the range of shards to return (not inclusive) 317 * @param orderByComparator the comparator to order the results by 318 * @return the ordered range of shards 319 * @throws SystemException if a system exception occurred 320 */ 321 public static java.util.List<com.liferay.portal.model.Shard> findAll( 322 int start, int end, 323 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 324 throws com.liferay.portal.kernel.exception.SystemException { 325 return getPersistence().findAll(start, end, orderByComparator); 326 } 327 328 /** 329 * Removes the shard where name = ? from the database. 330 * 331 * @param name the name to search with 332 * @throws SystemException if a system exception occurred 333 */ 334 public static void removeByName(java.lang.String name) 335 throws com.liferay.portal.NoSuchShardException, 336 com.liferay.portal.kernel.exception.SystemException { 337 getPersistence().removeByName(name); 338 } 339 340 /** 341 * Removes the shard where classNameId = ? and classPK = ? from the database. 342 * 343 * @param classNameId the class name ID to search with 344 * @param classPK the class p k to search with 345 * @throws SystemException if a system exception occurred 346 */ 347 public static void removeByC_C(long classNameId, long classPK) 348 throws com.liferay.portal.NoSuchShardException, 349 com.liferay.portal.kernel.exception.SystemException { 350 getPersistence().removeByC_C(classNameId, classPK); 351 } 352 353 /** 354 * Removes all the shards from the database. 355 * 356 * @throws SystemException if a system exception occurred 357 */ 358 public static void removeAll() 359 throws com.liferay.portal.kernel.exception.SystemException { 360 getPersistence().removeAll(); 361 } 362 363 /** 364 * Counts all the shards where name = ?. 365 * 366 * @param name the name to search with 367 * @return the number of matching shards 368 * @throws SystemException if a system exception occurred 369 */ 370 public static int countByName(java.lang.String name) 371 throws com.liferay.portal.kernel.exception.SystemException { 372 return getPersistence().countByName(name); 373 } 374 375 /** 376 * Counts all the shards where classNameId = ? and classPK = ?. 377 * 378 * @param classNameId the class name ID to search with 379 * @param classPK the class p k to search with 380 * @return the number of matching shards 381 * @throws SystemException if a system exception occurred 382 */ 383 public static int countByC_C(long classNameId, long classPK) 384 throws com.liferay.portal.kernel.exception.SystemException { 385 return getPersistence().countByC_C(classNameId, classPK); 386 } 387 388 /** 389 * Counts all the shards. 390 * 391 * @return the number of shards 392 * @throws SystemException if a system exception occurred 393 */ 394 public static int countAll() 395 throws com.liferay.portal.kernel.exception.SystemException { 396 return getPersistence().countAll(); 397 } 398 399 public static ShardPersistence getPersistence() { 400 if (_persistence == null) { 401 _persistence = (ShardPersistence)PortalBeanLocatorUtil.locate(ShardPersistence.class.getName()); 402 403 ReferenceRegistry.registerReference(ShardUtil.class, "_persistence"); 404 } 405 406 return _persistence; 407 } 408 409 public void setPersistence(ShardPersistence persistence) { 410 _persistence = persistence; 411 412 ReferenceRegistry.registerReference(ShardUtil.class, "_persistence"); 413 } 414 415 private static ShardPersistence _persistence; 416 }