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