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