001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
021    import com.liferay.portal.kernel.util.OrderByComparator;
022    import com.liferay.portal.kernel.util.ReferenceRegistry;
023    import com.liferay.portal.model.Account;
024    import com.liferay.portal.service.ServiceContext;
025    
026    import java.util.List;
027    
028    /**
029     * The persistence utility for the account service. This utility wraps {@link AccountPersistenceImpl} 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.
030     *
031     * <p>
032     * Caching information and settings can be found in <code>portal.properties</code>
033     * </p>
034     *
035     * @author Brian Wing Shun Chan
036     * @see AccountPersistence
037     * @see AccountPersistenceImpl
038     * @generated
039     */
040    @ProviderType
041    public class AccountUtil {
042            /*
043             * NOTE FOR DEVELOPERS:
044             *
045             * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
046             */
047    
048            /**
049             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
050             */
051            public static void clearCache() {
052                    getPersistence().clearCache();
053            }
054    
055            /**
056             * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
057             */
058            public static void clearCache(Account account) {
059                    getPersistence().clearCache(account);
060            }
061    
062            /**
063             * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
064             */
065            public static long countWithDynamicQuery(DynamicQuery dynamicQuery) {
066                    return getPersistence().countWithDynamicQuery(dynamicQuery);
067            }
068    
069            /**
070             * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
071             */
072            public static List<Account> findWithDynamicQuery(DynamicQuery dynamicQuery) {
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<Account> findWithDynamicQuery(
080                    DynamicQuery dynamicQuery, int start, int end) {
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<Account> findWithDynamicQuery(
088                    DynamicQuery dynamicQuery, int start, int end,
089                    OrderByComparator<Account> orderByComparator) {
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)
097             */
098            public static Account update(Account account) {
099                    return getPersistence().update(account);
100            }
101    
102            /**
103             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext)
104             */
105            public static Account update(Account account, ServiceContext serviceContext) {
106                    return getPersistence().update(account, serviceContext);
107            }
108    
109            /**
110            * Caches the account in the entity cache if it is enabled.
111            *
112            * @param account the account
113            */
114            public static void cacheResult(com.liferay.portal.model.Account account) {
115                    getPersistence().cacheResult(account);
116            }
117    
118            /**
119            * Caches the accounts in the entity cache if it is enabled.
120            *
121            * @param accounts the accounts
122            */
123            public static void cacheResult(
124                    java.util.List<com.liferay.portal.model.Account> accounts) {
125                    getPersistence().cacheResult(accounts);
126            }
127    
128            /**
129            * Creates a new account with the primary key. Does not add the account to the database.
130            *
131            * @param accountId the primary key for the new account
132            * @return the new account
133            */
134            public static com.liferay.portal.model.Account create(long accountId) {
135                    return getPersistence().create(accountId);
136            }
137    
138            /**
139            * Removes the account with the primary key from the database. Also notifies the appropriate model listeners.
140            *
141            * @param accountId the primary key of the account
142            * @return the account that was removed
143            * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
144            */
145            public static com.liferay.portal.model.Account remove(long accountId)
146                    throws com.liferay.portal.NoSuchAccountException {
147                    return getPersistence().remove(accountId);
148            }
149    
150            public static com.liferay.portal.model.Account updateImpl(
151                    com.liferay.portal.model.Account account) {
152                    return getPersistence().updateImpl(account);
153            }
154    
155            /**
156            * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found.
157            *
158            * @param accountId the primary key of the account
159            * @return the account
160            * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found
161            */
162            public static com.liferay.portal.model.Account findByPrimaryKey(
163                    long accountId) throws com.liferay.portal.NoSuchAccountException {
164                    return getPersistence().findByPrimaryKey(accountId);
165            }
166    
167            /**
168            * Returns the account with the primary key or returns <code>null</code> if it could not be found.
169            *
170            * @param accountId the primary key of the account
171            * @return the account, or <code>null</code> if a account with the primary key could not be found
172            */
173            public static com.liferay.portal.model.Account fetchByPrimaryKey(
174                    long accountId) {
175                    return getPersistence().fetchByPrimaryKey(accountId);
176            }
177    
178            public static java.util.Map<java.io.Serializable, com.liferay.portal.model.Account> fetchByPrimaryKeys(
179                    java.util.Set<java.io.Serializable> primaryKeys) {
180                    return getPersistence().fetchByPrimaryKeys(primaryKeys);
181            }
182    
183            /**
184            * Returns all the accounts.
185            *
186            * @return the accounts
187            */
188            public static java.util.List<com.liferay.portal.model.Account> findAll() {
189                    return getPersistence().findAll();
190            }
191    
192            /**
193            * Returns a range of all the accounts.
194            *
195            * <p>
196            * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.AccountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
197            * </p>
198            *
199            * @param start the lower bound of the range of accounts
200            * @param end the upper bound of the range of accounts (not inclusive)
201            * @return the range of accounts
202            */
203            public static java.util.List<com.liferay.portal.model.Account> findAll(
204                    int start, int end) {
205                    return getPersistence().findAll(start, end);
206            }
207    
208            /**
209            * Returns an ordered range of all the accounts.
210            *
211            * <p>
212            * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.AccountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
213            * </p>
214            *
215            * @param start the lower bound of the range of accounts
216            * @param end the upper bound of the range of accounts (not inclusive)
217            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
218            * @return the ordered range of accounts
219            */
220            public static java.util.List<com.liferay.portal.model.Account> findAll(
221                    int start, int end,
222                    com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.model.Account> orderByComparator) {
223                    return getPersistence().findAll(start, end, orderByComparator);
224            }
225    
226            /**
227            * Removes all the accounts from the database.
228            */
229            public static void removeAll() {
230                    getPersistence().removeAll();
231            }
232    
233            /**
234            * Returns the number of accounts.
235            *
236            * @return the number of accounts
237            */
238            public static int countAll() {
239                    return getPersistence().countAll();
240            }
241    
242            public static AccountPersistence getPersistence() {
243                    if (_persistence == null) {
244                            _persistence = (AccountPersistence)PortalBeanLocatorUtil.locate(AccountPersistence.class.getName());
245    
246                            ReferenceRegistry.registerReference(AccountUtil.class,
247                                    "_persistence");
248                    }
249    
250                    return _persistence;
251            }
252    
253            /**
254             * @deprecated As of 6.2.0
255             */
256            @Deprecated
257            public void setPersistence(AccountPersistence persistence) {
258            }
259    
260            private static AccountPersistence _persistence;
261    }