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
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
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
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            * Returns 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
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            * Returns 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
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            * Returns the shard where name = &#63; or throws a {@link com.liferay.portal.NoSuchShardException} if it could not be found.
195            *
196            * @param name the name
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            * Returns the shard where name = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
210            *
211            * @param name the name
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            * Returns the shard where name = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
223            *
224            * @param name the name
225            * @param retrieveFromCache whether to use the finder cache
226            * @return the matching shard, or <code>null</code> if a matching shard could not be found
227            * @throws SystemException if a system exception occurred
228            */
229            public static com.liferay.portal.model.Shard fetchByName(
230                    java.lang.String name, boolean retrieveFromCache)
231                    throws com.liferay.portal.kernel.exception.SystemException {
232                    return getPersistence().fetchByName(name, retrieveFromCache);
233            }
234    
235            /**
236            * Returns the shard where classNameId = &#63; and classPK = &#63; or throws a {@link com.liferay.portal.NoSuchShardException} if it could not be found.
237            *
238            * @param classNameId the class name ID
239            * @param classPK the class p k
240            * @return the matching shard
241            * @throws com.liferay.portal.NoSuchShardException if a matching shard could not be found
242            * @throws SystemException if a system exception occurred
243            */
244            public static com.liferay.portal.model.Shard findByC_C(long classNameId,
245                    long classPK)
246                    throws com.liferay.portal.NoSuchShardException,
247                            com.liferay.portal.kernel.exception.SystemException {
248                    return getPersistence().findByC_C(classNameId, classPK);
249            }
250    
251            /**
252            * Returns the shard where classNameId = &#63; and classPK = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
253            *
254            * @param classNameId the class name ID
255            * @param classPK the class p k
256            * @return the matching shard, or <code>null</code> if a matching shard could not be found
257            * @throws SystemException if a system exception occurred
258            */
259            public static com.liferay.portal.model.Shard fetchByC_C(long classNameId,
260                    long classPK)
261                    throws com.liferay.portal.kernel.exception.SystemException {
262                    return getPersistence().fetchByC_C(classNameId, classPK);
263            }
264    
265            /**
266            * Returns the shard where classNameId = &#63; and classPK = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
267            *
268            * @param classNameId the class name ID
269            * @param classPK the class p k
270            * @param retrieveFromCache whether to use the finder cache
271            * @return the matching shard, or <code>null</code> if a matching shard could not be found
272            * @throws SystemException if a system exception occurred
273            */
274            public static com.liferay.portal.model.Shard fetchByC_C(long classNameId,
275                    long classPK, boolean retrieveFromCache)
276                    throws com.liferay.portal.kernel.exception.SystemException {
277                    return getPersistence()
278                                       .fetchByC_C(classNameId, classPK, retrieveFromCache);
279            }
280    
281            /**
282            * Returns all the shards.
283            *
284            * @return the shards
285            * @throws SystemException if a system exception occurred
286            */
287            public static java.util.List<com.liferay.portal.model.Shard> findAll()
288                    throws com.liferay.portal.kernel.exception.SystemException {
289                    return getPersistence().findAll();
290            }
291    
292            /**
293            * Returns a range of all the shards.
294            *
295            * <p>
296            * 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.
297            * </p>
298            *
299            * @param start the lower bound of the range of shards
300            * @param end the upper bound of the range of shards (not inclusive)
301            * @return the range of shards
302            * @throws SystemException if a system exception occurred
303            */
304            public static java.util.List<com.liferay.portal.model.Shard> findAll(
305                    int start, int end)
306                    throws com.liferay.portal.kernel.exception.SystemException {
307                    return getPersistence().findAll(start, end);
308            }
309    
310            /**
311            * Returns an ordered range of all the shards.
312            *
313            * <p>
314            * 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.
315            * </p>
316            *
317            * @param start the lower bound of the range of shards
318            * @param end the upper bound of the range of shards (not inclusive)
319            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
320            * @return the ordered range of shards
321            * @throws SystemException if a system exception occurred
322            */
323            public static java.util.List<com.liferay.portal.model.Shard> findAll(
324                    int start, int end,
325                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
326                    throws com.liferay.portal.kernel.exception.SystemException {
327                    return getPersistence().findAll(start, end, orderByComparator);
328            }
329    
330            /**
331            * Removes the shard where name = &#63; from the database.
332            *
333            * @param name the name
334            * @throws SystemException if a system exception occurred
335            */
336            public static void removeByName(java.lang.String name)
337                    throws com.liferay.portal.NoSuchShardException,
338                            com.liferay.portal.kernel.exception.SystemException {
339                    getPersistence().removeByName(name);
340            }
341    
342            /**
343            * Removes the shard where classNameId = &#63; and classPK = &#63; from the database.
344            *
345            * @param classNameId the class name ID
346            * @param classPK the class p k
347            * @throws SystemException if a system exception occurred
348            */
349            public static void removeByC_C(long classNameId, long classPK)
350                    throws com.liferay.portal.NoSuchShardException,
351                            com.liferay.portal.kernel.exception.SystemException {
352                    getPersistence().removeByC_C(classNameId, classPK);
353            }
354    
355            /**
356            * Removes all the shards from the database.
357            *
358            * @throws SystemException if a system exception occurred
359            */
360            public static void removeAll()
361                    throws com.liferay.portal.kernel.exception.SystemException {
362                    getPersistence().removeAll();
363            }
364    
365            /**
366            * Returns the number of shards where name = &#63;.
367            *
368            * @param name the name
369            * @return the number of matching shards
370            * @throws SystemException if a system exception occurred
371            */
372            public static int countByName(java.lang.String name)
373                    throws com.liferay.portal.kernel.exception.SystemException {
374                    return getPersistence().countByName(name);
375            }
376    
377            /**
378            * Returns the number of shards where classNameId = &#63; and classPK = &#63;.
379            *
380            * @param classNameId the class name ID
381            * @param classPK the class p k
382            * @return the number of matching shards
383            * @throws SystemException if a system exception occurred
384            */
385            public static int countByC_C(long classNameId, long classPK)
386                    throws com.liferay.portal.kernel.exception.SystemException {
387                    return getPersistence().countByC_C(classNameId, classPK);
388            }
389    
390            /**
391            * Returns the number of shards.
392            *
393            * @return the number of shards
394            * @throws SystemException if a system exception occurred
395            */
396            public static int countAll()
397                    throws com.liferay.portal.kernel.exception.SystemException {
398                    return getPersistence().countAll();
399            }
400    
401            public static ShardPersistence getPersistence() {
402                    if (_persistence == null) {
403                            _persistence = (ShardPersistence)PortalBeanLocatorUtil.locate(ShardPersistence.class.getName());
404    
405                            ReferenceRegistry.registerReference(ShardUtil.class, "_persistence");
406                    }
407    
408                    return _persistence;
409            }
410    
411            public void setPersistence(ShardPersistence persistence) {
412                    _persistence = persistence;
413    
414                    ReferenceRegistry.registerReference(ShardUtil.class, "_persistence");
415            }
416    
417            private static ShardPersistence _persistence;
418    }