001    /**
002     * Copyright (c) 2000-2010 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.model.Account;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import java.util.List;
025    
026    /**
027     * The persistence utility for the account service.
028     *
029     * <p>
030     * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regnerate this class.
031     * </p>
032     *
033     * @author Brian Wing Shun Chan
034     * @see AccountPersistence
035     * @see AccountPersistenceImpl
036     * @generated
037     */
038    public class AccountUtil {
039            /**
040             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
041             */
042            public static void clearCache() {
043                    getPersistence().clearCache();
044            }
045    
046            /**
047             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
048             */
049            public static void clearCache(Account account) {
050                    getPersistence().clearCache(account);
051            }
052    
053            /**
054             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
055             */
056            public long countWithDynamicQuery(DynamicQuery dynamicQuery)
057                    throws SystemException {
058                    return getPersistence().countWithDynamicQuery(dynamicQuery);
059            }
060    
061            /**
062             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
063             */
064            public static List<Account> findWithDynamicQuery(DynamicQuery dynamicQuery)
065                    throws SystemException {
066                    return getPersistence().findWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
071             */
072            public static List<Account> findWithDynamicQuery(
073                    DynamicQuery dynamicQuery, int start, int end)
074                    throws SystemException {
075                    return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
076            }
077    
078            /**
079             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
080             */
081            public static List<Account> findWithDynamicQuery(
082                    DynamicQuery dynamicQuery, int start, int end,
083                    OrderByComparator orderByComparator) throws SystemException {
084                    return getPersistence()
085                                       .findWithDynamicQuery(dynamicQuery, start, end,
086                            orderByComparator);
087            }
088    
089            /**
090             * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
091             */
092            public static Account remove(Account account) throws SystemException {
093                    return getPersistence().remove(account);
094            }
095    
096            /**
097             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
098             */
099            public static Account update(Account account, boolean merge)
100                    throws SystemException {
101                    return getPersistence().update(account, merge);
102            }
103    
104            /**
105             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
106             */
107            public static Account update(Account account, boolean merge,
108                    ServiceContext serviceContext) throws SystemException {
109                    return getPersistence().update(account, merge, serviceContext);
110            }
111    
112            /**
113            * Caches the account in the entity cache if it is enabled.
114            *
115            * @param account the account to cache
116            */
117            public static void cacheResult(com.liferay.portal.model.Account account) {
118                    getPersistence().cacheResult(account);
119            }
120    
121            /**
122            * Caches the accounts in the entity cache if it is enabled.
123            *
124            * @param accounts the accounts to cache
125            */
126            public static void cacheResult(
127                    java.util.List<com.liferay.portal.model.Account> accounts) {
128                    getPersistence().cacheResult(accounts);
129            }
130    
131            /**
132            * Creates a new account with the primary key.
133            *
134            * @param accountId the primary key for the new account
135            * @return the new account
136            */
137            public static com.liferay.portal.model.Account create(long accountId) {
138                    return getPersistence().create(accountId);
139            }
140    
141            /**
142            * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
143            *
144            * @param accountId the primary key of the account to remove
145            * @return the account that was removed
146            * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
147            * @throws SystemException if a system exception occurred
148            */
149            public static com.liferay.portal.model.Account remove(long accountId)
150                    throws com.liferay.portal.NoSuchAccountException,
151                            com.liferay.portal.kernel.exception.SystemException {
152                    return getPersistence().remove(accountId);
153            }
154    
155            public static com.liferay.portal.model.Account updateImpl(
156                    com.liferay.portal.model.Account account, boolean merge)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getPersistence().updateImpl(account, merge);
159            }
160    
161            /**
162            * Finds the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found.
163            *
164            * @param accountId the primary key of the account to find
165            * @return the account
166            * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
167            * @throws SystemException if a system exception occurred
168            */
169            public static com.liferay.portal.model.Account findByPrimaryKey(
170                    long accountId)
171                    throws com.liferay.portal.NoSuchAccountException,
172                            com.liferay.portal.kernel.exception.SystemException {
173                    return getPersistence().findByPrimaryKey(accountId);
174            }
175    
176            /**
177            * Finds the account with the primary key or returns <code>null</code> if it could not be found.
178            *
179            * @param accountId the primary key of the account to find
180            * @return the account, or <code>null</code> if a account with the primary key could not be found
181            * @throws SystemException if a system exception occurred
182            */
183            public static com.liferay.portal.model.Account fetchByPrimaryKey(
184                    long accountId)
185                    throws com.liferay.portal.kernel.exception.SystemException {
186                    return getPersistence().fetchByPrimaryKey(accountId);
187            }
188    
189            /**
190            * Finds all the accounts.
191            *
192            * @return the accounts
193            * @throws SystemException if a system exception occurred
194            */
195            public static java.util.List<com.liferay.portal.model.Account> findAll()
196                    throws com.liferay.portal.kernel.exception.SystemException {
197                    return getPersistence().findAll();
198            }
199    
200            /**
201            * Finds a range of all the accounts.
202            *
203            * <p>
204            * 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.
205            * </p>
206            *
207            * @param start the lower bound of the range of accounts to return
208            * @param end the upper bound of the range of accounts to return (not inclusive)
209            * @return the range of accounts
210            * @throws SystemException if a system exception occurred
211            */
212            public static java.util.List<com.liferay.portal.model.Account> findAll(
213                    int start, int end)
214                    throws com.liferay.portal.kernel.exception.SystemException {
215                    return getPersistence().findAll(start, end);
216            }
217    
218            /**
219            * Finds an ordered range of all the accounts.
220            *
221            * <p>
222            * 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.
223            * </p>
224            *
225            * @param start the lower bound of the range of accounts to return
226            * @param end the upper bound of the range of accounts to return (not inclusive)
227            * @param orderByComparator the comparator to order the results by
228            * @return the ordered range of accounts
229            * @throws SystemException if a system exception occurred
230            */
231            public static java.util.List<com.liferay.portal.model.Account> findAll(
232                    int start, int end,
233                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
234                    throws com.liferay.portal.kernel.exception.SystemException {
235                    return getPersistence().findAll(start, end, orderByComparator);
236            }
237    
238            /**
239            * Removes all the accounts from the database.
240            *
241            * @throws SystemException if a system exception occurred
242            */
243            public static void removeAll()
244                    throws com.liferay.portal.kernel.exception.SystemException {
245                    getPersistence().removeAll();
246            }
247    
248            /**
249            * Counts all the accounts.
250            *
251            * @return the number of accounts
252            * @throws SystemException if a system exception occurred
253            */
254            public static int countAll()
255                    throws com.liferay.portal.kernel.exception.SystemException {
256                    return getPersistence().countAll();
257            }
258    
259            public static AccountPersistence getPersistence() {
260                    if (_persistence == null) {
261                            _persistence = (AccountPersistence)PortalBeanLocatorUtil.locate(AccountPersistence.class.getName());
262                    }
263    
264                    return _persistence;
265            }
266    
267            public void setPersistence(AccountPersistence persistence) {
268                    _persistence = persistence;
269            }
270    
271            private static AccountPersistence _persistence;
272    }