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.Repository;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.util.List;
026    
027    /**
028     * The persistence utility for the repository service. This utility wraps {@link RepositoryPersistenceImpl} 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 RepositoryPersistence
036     * @see RepositoryPersistenceImpl
037     * @generated
038     */
039    public class RepositoryUtil {
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(Repository repository) {
057                    getPersistence().clearCache(repository);
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<Repository> findWithDynamicQuery(
072                    DynamicQuery dynamicQuery) 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<Repository> findWithDynamicQuery(
080                    DynamicQuery dynamicQuery, int start, int end)
081                    throws SystemException {
082                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
083            }
084    
085            /**
086             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
087             */
088            public static List<Repository> findWithDynamicQuery(
089                    DynamicQuery dynamicQuery, int start, int end,
090                    OrderByComparator orderByComparator) throws SystemException {
091                    return getPersistence()
092                                       .findWithDynamicQuery(dynamicQuery, start, end,
093                            orderByComparator);
094            }
095    
096            /**
097             * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
098             */
099            public static Repository remove(Repository repository)
100                    throws SystemException {
101                    return getPersistence().remove(repository);
102            }
103    
104            /**
105             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
106             */
107            public static Repository update(Repository repository, boolean merge)
108                    throws SystemException {
109                    return getPersistence().update(repository, merge);
110            }
111    
112            /**
113             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
114             */
115            public static Repository update(Repository repository, boolean merge,
116                    ServiceContext serviceContext) throws SystemException {
117                    return getPersistence().update(repository, merge, serviceContext);
118            }
119    
120            /**
121            * Caches the repository in the entity cache if it is enabled.
122            *
123            * @param repository the repository
124            */
125            public static void cacheResult(
126                    com.liferay.portal.model.Repository repository) {
127                    getPersistence().cacheResult(repository);
128            }
129    
130            /**
131            * Caches the repositories in the entity cache if it is enabled.
132            *
133            * @param repositories the repositories
134            */
135            public static void cacheResult(
136                    java.util.List<com.liferay.portal.model.Repository> repositories) {
137                    getPersistence().cacheResult(repositories);
138            }
139    
140            /**
141            * Creates a new repository with the primary key. Does not add the repository to the database.
142            *
143            * @param repositoryId the primary key for the new repository
144            * @return the new repository
145            */
146            public static com.liferay.portal.model.Repository create(long repositoryId) {
147                    return getPersistence().create(repositoryId);
148            }
149    
150            /**
151            * Removes the repository with the primary key from the database. Also notifies the appropriate model listeners.
152            *
153            * @param repositoryId the primary key of the repository
154            * @return the repository that was removed
155            * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
156            * @throws SystemException if a system exception occurred
157            */
158            public static com.liferay.portal.model.Repository remove(long repositoryId)
159                    throws com.liferay.portal.NoSuchRepositoryException,
160                            com.liferay.portal.kernel.exception.SystemException {
161                    return getPersistence().remove(repositoryId);
162            }
163    
164            public static com.liferay.portal.model.Repository updateImpl(
165                    com.liferay.portal.model.Repository repository, boolean merge)
166                    throws com.liferay.portal.kernel.exception.SystemException {
167                    return getPersistence().updateImpl(repository, merge);
168            }
169    
170            /**
171            * Returns the repository with the primary key or throws a {@link com.liferay.portal.NoSuchRepositoryException} if it could not be found.
172            *
173            * @param repositoryId the primary key of the repository
174            * @return the repository
175            * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
176            * @throws SystemException if a system exception occurred
177            */
178            public static com.liferay.portal.model.Repository findByPrimaryKey(
179                    long repositoryId)
180                    throws com.liferay.portal.NoSuchRepositoryException,
181                            com.liferay.portal.kernel.exception.SystemException {
182                    return getPersistence().findByPrimaryKey(repositoryId);
183            }
184    
185            /**
186            * Returns the repository with the primary key or returns <code>null</code> if it could not be found.
187            *
188            * @param repositoryId the primary key of the repository
189            * @return the repository, or <code>null</code> if a repository with the primary key could not be found
190            * @throws SystemException if a system exception occurred
191            */
192            public static com.liferay.portal.model.Repository fetchByPrimaryKey(
193                    long repositoryId)
194                    throws com.liferay.portal.kernel.exception.SystemException {
195                    return getPersistence().fetchByPrimaryKey(repositoryId);
196            }
197    
198            /**
199            * Returns all the repositories where groupId = &#63;.
200            *
201            * @param groupId the group ID
202            * @return the matching repositories
203            * @throws SystemException if a system exception occurred
204            */
205            public static java.util.List<com.liferay.portal.model.Repository> findByGroupId(
206                    long groupId)
207                    throws com.liferay.portal.kernel.exception.SystemException {
208                    return getPersistence().findByGroupId(groupId);
209            }
210    
211            /**
212            * Returns a range of all the repositories where groupId = &#63;.
213            *
214            * <p>
215            * 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.
216            * </p>
217            *
218            * @param groupId the group ID
219            * @param start the lower bound of the range of repositories
220            * @param end the upper bound of the range of repositories (not inclusive)
221            * @return the range of matching repositories
222            * @throws SystemException if a system exception occurred
223            */
224            public static java.util.List<com.liferay.portal.model.Repository> findByGroupId(
225                    long groupId, int start, int end)
226                    throws com.liferay.portal.kernel.exception.SystemException {
227                    return getPersistence().findByGroupId(groupId, start, end);
228            }
229    
230            /**
231            * Returns an ordered range of all the repositories where groupId = &#63;.
232            *
233            * <p>
234            * 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.
235            * </p>
236            *
237            * @param groupId the group ID
238            * @param start the lower bound of the range of repositories
239            * @param end the upper bound of the range of repositories (not inclusive)
240            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
241            * @return the ordered range of matching repositories
242            * @throws SystemException if a system exception occurred
243            */
244            public static java.util.List<com.liferay.portal.model.Repository> findByGroupId(
245                    long groupId, int start, int end,
246                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
247                    throws com.liferay.portal.kernel.exception.SystemException {
248                    return getPersistence()
249                                       .findByGroupId(groupId, start, end, orderByComparator);
250            }
251    
252            /**
253            * Returns the first repository in the ordered set where groupId = &#63;.
254            *
255            * <p>
256            * 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.
257            * </p>
258            *
259            * @param groupId the group ID
260            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
261            * @return the first matching repository
262            * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
263            * @throws SystemException if a system exception occurred
264            */
265            public static com.liferay.portal.model.Repository findByGroupId_First(
266                    long groupId,
267                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
268                    throws com.liferay.portal.NoSuchRepositoryException,
269                            com.liferay.portal.kernel.exception.SystemException {
270                    return getPersistence().findByGroupId_First(groupId, orderByComparator);
271            }
272    
273            /**
274            * Returns the last repository in the ordered set where groupId = &#63;.
275            *
276            * <p>
277            * 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.
278            * </p>
279            *
280            * @param groupId the group ID
281            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
282            * @return the last matching repository
283            * @throws com.liferay.portal.NoSuchRepositoryException if a matching repository could not be found
284            * @throws SystemException if a system exception occurred
285            */
286            public static com.liferay.portal.model.Repository findByGroupId_Last(
287                    long groupId,
288                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
289                    throws com.liferay.portal.NoSuchRepositoryException,
290                            com.liferay.portal.kernel.exception.SystemException {
291                    return getPersistence().findByGroupId_Last(groupId, orderByComparator);
292            }
293    
294            /**
295            * Returns the repositories before and after the current repository in the ordered set where groupId = &#63;.
296            *
297            * <p>
298            * 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.
299            * </p>
300            *
301            * @param repositoryId the primary key of the current repository
302            * @param groupId the group ID
303            * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
304            * @return the previous, current, and next repository
305            * @throws com.liferay.portal.NoSuchRepositoryException if a repository with the primary key could not be found
306            * @throws SystemException if a system exception occurred
307            */
308            public static com.liferay.portal.model.Repository[] findByGroupId_PrevAndNext(
309                    long repositoryId, long groupId,
310                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
311                    throws com.liferay.portal.NoSuchRepositoryException,
312                            com.liferay.portal.kernel.exception.SystemException {
313                    return getPersistence()
314                                       .findByGroupId_PrevAndNext(repositoryId, groupId,
315                            orderByComparator);
316            }
317    
318            /**
319            * Returns all the repositories.
320            *
321            * @return the repositories
322            * @throws SystemException if a system exception occurred
323            */
324            public static java.util.List<com.liferay.portal.model.Repository> findAll()
325                    throws com.liferay.portal.kernel.exception.SystemException {
326                    return getPersistence().findAll();
327            }
328    
329            /**
330            * Returns a range of all the repositories.
331            *
332            * <p>
333            * 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.
334            * </p>
335            *
336            * @param start the lower bound of the range of repositories
337            * @param end the upper bound of the range of repositories (not inclusive)
338            * @return the range of repositories
339            * @throws SystemException if a system exception occurred
340            */
341            public static java.util.List<com.liferay.portal.model.Repository> findAll(
342                    int start, int end)
343                    throws com.liferay.portal.kernel.exception.SystemException {
344                    return getPersistence().findAll(start, end);
345            }
346    
347            /**
348            * Returns an ordered range of all the repositories.
349            *
350            * <p>
351            * 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.
352            * </p>
353            *
354            * @param start the lower bound of the range of repositories
355            * @param end the upper bound of the range of repositories (not inclusive)
356            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
357            * @return the ordered range of repositories
358            * @throws SystemException if a system exception occurred
359            */
360            public static java.util.List<com.liferay.portal.model.Repository> findAll(
361                    int start, int end,
362                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
363                    throws com.liferay.portal.kernel.exception.SystemException {
364                    return getPersistence().findAll(start, end, orderByComparator);
365            }
366    
367            /**
368            * Removes all the repositories where groupId = &#63; from the database.
369            *
370            * @param groupId the group ID
371            * @throws SystemException if a system exception occurred
372            */
373            public static void removeByGroupId(long groupId)
374                    throws com.liferay.portal.kernel.exception.SystemException {
375                    getPersistence().removeByGroupId(groupId);
376            }
377    
378            /**
379            * Removes all the repositories from the database.
380            *
381            * @throws SystemException if a system exception occurred
382            */
383            public static void removeAll()
384                    throws com.liferay.portal.kernel.exception.SystemException {
385                    getPersistence().removeAll();
386            }
387    
388            /**
389            * Returns the number of repositories where groupId = &#63;.
390            *
391            * @param groupId the group ID
392            * @return the number of matching repositories
393            * @throws SystemException if a system exception occurred
394            */
395            public static int countByGroupId(long groupId)
396                    throws com.liferay.portal.kernel.exception.SystemException {
397                    return getPersistence().countByGroupId(groupId);
398            }
399    
400            /**
401            * Returns the number of repositories.
402            *
403            * @return the number of repositories
404            * @throws SystemException if a system exception occurred
405            */
406            public static int countAll()
407                    throws com.liferay.portal.kernel.exception.SystemException {
408                    return getPersistence().countAll();
409            }
410    
411            public static RepositoryPersistence getPersistence() {
412                    if (_persistence == null) {
413                            _persistence = (RepositoryPersistence)PortalBeanLocatorUtil.locate(RepositoryPersistence.class.getName());
414    
415                            ReferenceRegistry.registerReference(RepositoryUtil.class,
416                                    "_persistence");
417                    }
418    
419                    return _persistence;
420            }
421    
422            public void setPersistence(RepositoryPersistence persistence) {
423                    _persistence = persistence;
424    
425                    ReferenceRegistry.registerReference(RepositoryUtil.class, "_persistence");
426            }
427    
428            private static RepositoryPersistence _persistence;
429    }