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