001    /**
002     * Copyright (c) 2000-2012 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.NoSuchModelException;
018    import com.liferay.portal.NoSuchPasswordPolicyException;
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.model.CacheModel;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.model.PasswordPolicy;
041    import com.liferay.portal.model.impl.PasswordPolicyImpl;
042    import com.liferay.portal.model.impl.PasswordPolicyModelImpl;
043    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
044    
045    import java.io.Serializable;
046    
047    import java.util.ArrayList;
048    import java.util.Collections;
049    import java.util.List;
050    
051    /**
052     * The persistence implementation for the password policy service.
053     *
054     * <p>
055     * Caching information and settings can be found in <code>portal.properties</code>
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see PasswordPolicyPersistence
060     * @see PasswordPolicyUtil
061     * @generated
062     */
063    public class PasswordPolicyPersistenceImpl extends BasePersistenceImpl<PasswordPolicy>
064            implements PasswordPolicyPersistence {
065            /*
066             * NOTE FOR DEVELOPERS:
067             *
068             * Never modify or reference this class directly. Always use {@link PasswordPolicyUtil} to access the password policy persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
069             */
070            public static final String FINDER_CLASS_NAME_ENTITY = PasswordPolicyImpl.class.getName();
071            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
072                    ".List1";
073            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074                    ".List2";
075            public static final FinderPath FINDER_PATH_FETCH_BY_C_DP = new FinderPath(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
076                            PasswordPolicyModelImpl.FINDER_CACHE_ENABLED,
077                            PasswordPolicyImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByC_DP",
078                            new String[] { Long.class.getName(), Boolean.class.getName() },
079                            PasswordPolicyModelImpl.COMPANYID_COLUMN_BITMASK |
080                            PasswordPolicyModelImpl.DEFAULTPOLICY_COLUMN_BITMASK);
081            public static final FinderPath FINDER_PATH_COUNT_BY_C_DP = new FinderPath(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
082                            PasswordPolicyModelImpl.FINDER_CACHE_ENABLED, Long.class,
083                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_DP",
084                            new String[] { Long.class.getName(), Boolean.class.getName() });
085            public static final FinderPath FINDER_PATH_FETCH_BY_C_N = new FinderPath(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
086                            PasswordPolicyModelImpl.FINDER_CACHE_ENABLED,
087                            PasswordPolicyImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByC_N",
088                            new String[] { Long.class.getName(), String.class.getName() },
089                            PasswordPolicyModelImpl.COMPANYID_COLUMN_BITMASK |
090                            PasswordPolicyModelImpl.NAME_COLUMN_BITMASK);
091            public static final FinderPath FINDER_PATH_COUNT_BY_C_N = new FinderPath(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
092                            PasswordPolicyModelImpl.FINDER_CACHE_ENABLED, Long.class,
093                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_N",
094                            new String[] { Long.class.getName(), String.class.getName() });
095            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
096                            PasswordPolicyModelImpl.FINDER_CACHE_ENABLED,
097                            PasswordPolicyImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
098                            "findAll", new String[0]);
099            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
100                            PasswordPolicyModelImpl.FINDER_CACHE_ENABLED,
101                            PasswordPolicyImpl.class,
102                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
103            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
104                            PasswordPolicyModelImpl.FINDER_CACHE_ENABLED, Long.class,
105                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
106    
107            /**
108             * Caches the password policy in the entity cache if it is enabled.
109             *
110             * @param passwordPolicy the password policy
111             */
112            public void cacheResult(PasswordPolicy passwordPolicy) {
113                    EntityCacheUtil.putResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
114                            PasswordPolicyImpl.class, passwordPolicy.getPrimaryKey(),
115                            passwordPolicy);
116    
117                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
118                            new Object[] {
119                                    Long.valueOf(passwordPolicy.getCompanyId()),
120                                    Boolean.valueOf(passwordPolicy.getDefaultPolicy())
121                            }, passwordPolicy);
122    
123                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
124                            new Object[] {
125                                    Long.valueOf(passwordPolicy.getCompanyId()),
126                                    
127                            passwordPolicy.getName()
128                            }, passwordPolicy);
129    
130                    passwordPolicy.resetOriginalValues();
131            }
132    
133            /**
134             * Caches the password policies in the entity cache if it is enabled.
135             *
136             * @param passwordPolicies the password policies
137             */
138            public void cacheResult(List<PasswordPolicy> passwordPolicies) {
139                    for (PasswordPolicy passwordPolicy : passwordPolicies) {
140                            if (EntityCacheUtil.getResult(
141                                                    PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
142                                                    PasswordPolicyImpl.class, passwordPolicy.getPrimaryKey()) == null) {
143                                    cacheResult(passwordPolicy);
144                            }
145                            else {
146                                    passwordPolicy.resetOriginalValues();
147                            }
148                    }
149            }
150    
151            /**
152             * Clears the cache for all password policies.
153             *
154             * <p>
155             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
156             * </p>
157             */
158            @Override
159            public void clearCache() {
160                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
161                            CacheRegistryUtil.clear(PasswordPolicyImpl.class.getName());
162                    }
163    
164                    EntityCacheUtil.clearCache(PasswordPolicyImpl.class.getName());
165    
166                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
167                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
168                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
169            }
170    
171            /**
172             * Clears the cache for the password policy.
173             *
174             * <p>
175             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
176             * </p>
177             */
178            @Override
179            public void clearCache(PasswordPolicy passwordPolicy) {
180                    EntityCacheUtil.removeResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
181                            PasswordPolicyImpl.class, passwordPolicy.getPrimaryKey());
182    
183                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
184                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
185    
186                    clearUniqueFindersCache(passwordPolicy);
187            }
188    
189            @Override
190            public void clearCache(List<PasswordPolicy> passwordPolicies) {
191                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
192                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
193    
194                    for (PasswordPolicy passwordPolicy : passwordPolicies) {
195                            EntityCacheUtil.removeResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
196                                    PasswordPolicyImpl.class, passwordPolicy.getPrimaryKey());
197    
198                            clearUniqueFindersCache(passwordPolicy);
199                    }
200            }
201    
202            protected void clearUniqueFindersCache(PasswordPolicy passwordPolicy) {
203                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DP,
204                            new Object[] {
205                                    Long.valueOf(passwordPolicy.getCompanyId()),
206                                    Boolean.valueOf(passwordPolicy.getDefaultPolicy())
207                            });
208    
209                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
210                            new Object[] {
211                                    Long.valueOf(passwordPolicy.getCompanyId()),
212                                    
213                            passwordPolicy.getName()
214                            });
215            }
216    
217            /**
218             * Creates a new password policy with the primary key. Does not add the password policy to the database.
219             *
220             * @param passwordPolicyId the primary key for the new password policy
221             * @return the new password policy
222             */
223            public PasswordPolicy create(long passwordPolicyId) {
224                    PasswordPolicy passwordPolicy = new PasswordPolicyImpl();
225    
226                    passwordPolicy.setNew(true);
227                    passwordPolicy.setPrimaryKey(passwordPolicyId);
228    
229                    return passwordPolicy;
230            }
231    
232            /**
233             * Removes the password policy with the primary key from the database. Also notifies the appropriate model listeners.
234             *
235             * @param passwordPolicyId the primary key of the password policy
236             * @return the password policy that was removed
237             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a password policy with the primary key could not be found
238             * @throws SystemException if a system exception occurred
239             */
240            public PasswordPolicy remove(long passwordPolicyId)
241                    throws NoSuchPasswordPolicyException, SystemException {
242                    return remove(Long.valueOf(passwordPolicyId));
243            }
244    
245            /**
246             * Removes the password policy with the primary key from the database. Also notifies the appropriate model listeners.
247             *
248             * @param primaryKey the primary key of the password policy
249             * @return the password policy that was removed
250             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a password policy with the primary key could not be found
251             * @throws SystemException if a system exception occurred
252             */
253            @Override
254            public PasswordPolicy remove(Serializable primaryKey)
255                    throws NoSuchPasswordPolicyException, SystemException {
256                    Session session = null;
257    
258                    try {
259                            session = openSession();
260    
261                            PasswordPolicy passwordPolicy = (PasswordPolicy)session.get(PasswordPolicyImpl.class,
262                                            primaryKey);
263    
264                            if (passwordPolicy == null) {
265                                    if (_log.isWarnEnabled()) {
266                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
267                                    }
268    
269                                    throw new NoSuchPasswordPolicyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
270                                            primaryKey);
271                            }
272    
273                            return remove(passwordPolicy);
274                    }
275                    catch (NoSuchPasswordPolicyException nsee) {
276                            throw nsee;
277                    }
278                    catch (Exception e) {
279                            throw processException(e);
280                    }
281                    finally {
282                            closeSession(session);
283                    }
284            }
285    
286            @Override
287            protected PasswordPolicy removeImpl(PasswordPolicy passwordPolicy)
288                    throws SystemException {
289                    passwordPolicy = toUnwrappedModel(passwordPolicy);
290    
291                    Session session = null;
292    
293                    try {
294                            session = openSession();
295    
296                            BatchSessionUtil.delete(session, passwordPolicy);
297                    }
298                    catch (Exception e) {
299                            throw processException(e);
300                    }
301                    finally {
302                            closeSession(session);
303                    }
304    
305                    clearCache(passwordPolicy);
306    
307                    return passwordPolicy;
308            }
309    
310            @Override
311            public PasswordPolicy updateImpl(
312                    com.liferay.portal.model.PasswordPolicy passwordPolicy, boolean merge)
313                    throws SystemException {
314                    passwordPolicy = toUnwrappedModel(passwordPolicy);
315    
316                    boolean isNew = passwordPolicy.isNew();
317    
318                    PasswordPolicyModelImpl passwordPolicyModelImpl = (PasswordPolicyModelImpl)passwordPolicy;
319    
320                    Session session = null;
321    
322                    try {
323                            session = openSession();
324    
325                            BatchSessionUtil.update(session, passwordPolicy, merge);
326    
327                            passwordPolicy.setNew(false);
328                    }
329                    catch (Exception e) {
330                            throw processException(e);
331                    }
332                    finally {
333                            closeSession(session);
334                    }
335    
336                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
337    
338                    if (isNew || !PasswordPolicyModelImpl.COLUMN_BITMASK_ENABLED) {
339                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
340                    }
341    
342                    EntityCacheUtil.putResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
343                            PasswordPolicyImpl.class, passwordPolicy.getPrimaryKey(),
344                            passwordPolicy);
345    
346                    if (isNew) {
347                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
348                                    new Object[] {
349                                            Long.valueOf(passwordPolicy.getCompanyId()),
350                                            Boolean.valueOf(passwordPolicy.getDefaultPolicy())
351                                    }, passwordPolicy);
352    
353                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
354                                    new Object[] {
355                                            Long.valueOf(passwordPolicy.getCompanyId()),
356                                            
357                                    passwordPolicy.getName()
358                                    }, passwordPolicy);
359                    }
360                    else {
361                            if ((passwordPolicyModelImpl.getColumnBitmask() &
362                                            FINDER_PATH_FETCH_BY_C_DP.getColumnBitmask()) != 0) {
363                                    Object[] args = new Object[] {
364                                                    Long.valueOf(passwordPolicyModelImpl.getOriginalCompanyId()),
365                                                    Boolean.valueOf(passwordPolicyModelImpl.getOriginalDefaultPolicy())
366                                            };
367    
368                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_DP, args);
369    
370                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DP, args);
371    
372                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
373                                            new Object[] {
374                                                    Long.valueOf(passwordPolicy.getCompanyId()),
375                                                    Boolean.valueOf(passwordPolicy.getDefaultPolicy())
376                                            }, passwordPolicy);
377                            }
378    
379                            if ((passwordPolicyModelImpl.getColumnBitmask() &
380                                            FINDER_PATH_FETCH_BY_C_N.getColumnBitmask()) != 0) {
381                                    Object[] args = new Object[] {
382                                                    Long.valueOf(passwordPolicyModelImpl.getOriginalCompanyId()),
383                                                    
384                                                    passwordPolicyModelImpl.getOriginalName()
385                                            };
386    
387                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_N, args);
388    
389                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N, args);
390    
391                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
392                                            new Object[] {
393                                                    Long.valueOf(passwordPolicy.getCompanyId()),
394                                                    
395                                            passwordPolicy.getName()
396                                            }, passwordPolicy);
397                            }
398                    }
399    
400                    return passwordPolicy;
401            }
402    
403            protected PasswordPolicy toUnwrappedModel(PasswordPolicy passwordPolicy) {
404                    if (passwordPolicy instanceof PasswordPolicyImpl) {
405                            return passwordPolicy;
406                    }
407    
408                    PasswordPolicyImpl passwordPolicyImpl = new PasswordPolicyImpl();
409    
410                    passwordPolicyImpl.setNew(passwordPolicy.isNew());
411                    passwordPolicyImpl.setPrimaryKey(passwordPolicy.getPrimaryKey());
412    
413                    passwordPolicyImpl.setPasswordPolicyId(passwordPolicy.getPasswordPolicyId());
414                    passwordPolicyImpl.setCompanyId(passwordPolicy.getCompanyId());
415                    passwordPolicyImpl.setUserId(passwordPolicy.getUserId());
416                    passwordPolicyImpl.setUserName(passwordPolicy.getUserName());
417                    passwordPolicyImpl.setCreateDate(passwordPolicy.getCreateDate());
418                    passwordPolicyImpl.setModifiedDate(passwordPolicy.getModifiedDate());
419                    passwordPolicyImpl.setDefaultPolicy(passwordPolicy.isDefaultPolicy());
420                    passwordPolicyImpl.setName(passwordPolicy.getName());
421                    passwordPolicyImpl.setDescription(passwordPolicy.getDescription());
422                    passwordPolicyImpl.setChangeable(passwordPolicy.isChangeable());
423                    passwordPolicyImpl.setChangeRequired(passwordPolicy.isChangeRequired());
424                    passwordPolicyImpl.setMinAge(passwordPolicy.getMinAge());
425                    passwordPolicyImpl.setCheckSyntax(passwordPolicy.isCheckSyntax());
426                    passwordPolicyImpl.setAllowDictionaryWords(passwordPolicy.isAllowDictionaryWords());
427                    passwordPolicyImpl.setMinAlphanumeric(passwordPolicy.getMinAlphanumeric());
428                    passwordPolicyImpl.setMinLength(passwordPolicy.getMinLength());
429                    passwordPolicyImpl.setMinLowerCase(passwordPolicy.getMinLowerCase());
430                    passwordPolicyImpl.setMinNumbers(passwordPolicy.getMinNumbers());
431                    passwordPolicyImpl.setMinSymbols(passwordPolicy.getMinSymbols());
432                    passwordPolicyImpl.setMinUpperCase(passwordPolicy.getMinUpperCase());
433                    passwordPolicyImpl.setHistory(passwordPolicy.isHistory());
434                    passwordPolicyImpl.setHistoryCount(passwordPolicy.getHistoryCount());
435                    passwordPolicyImpl.setExpireable(passwordPolicy.isExpireable());
436                    passwordPolicyImpl.setMaxAge(passwordPolicy.getMaxAge());
437                    passwordPolicyImpl.setWarningTime(passwordPolicy.getWarningTime());
438                    passwordPolicyImpl.setGraceLimit(passwordPolicy.getGraceLimit());
439                    passwordPolicyImpl.setLockout(passwordPolicy.isLockout());
440                    passwordPolicyImpl.setMaxFailure(passwordPolicy.getMaxFailure());
441                    passwordPolicyImpl.setLockoutDuration(passwordPolicy.getLockoutDuration());
442                    passwordPolicyImpl.setRequireUnlock(passwordPolicy.isRequireUnlock());
443                    passwordPolicyImpl.setResetFailureCount(passwordPolicy.getResetFailureCount());
444                    passwordPolicyImpl.setResetTicketMaxAge(passwordPolicy.getResetTicketMaxAge());
445    
446                    return passwordPolicyImpl;
447            }
448    
449            /**
450             * Returns the password policy with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
451             *
452             * @param primaryKey the primary key of the password policy
453             * @return the password policy
454             * @throws com.liferay.portal.NoSuchModelException if a password policy with the primary key could not be found
455             * @throws SystemException if a system exception occurred
456             */
457            @Override
458            public PasswordPolicy findByPrimaryKey(Serializable primaryKey)
459                    throws NoSuchModelException, SystemException {
460                    return findByPrimaryKey(((Long)primaryKey).longValue());
461            }
462    
463            /**
464             * Returns the password policy with the primary key or throws a {@link com.liferay.portal.NoSuchPasswordPolicyException} if it could not be found.
465             *
466             * @param passwordPolicyId the primary key of the password policy
467             * @return the password policy
468             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a password policy with the primary key could not be found
469             * @throws SystemException if a system exception occurred
470             */
471            public PasswordPolicy findByPrimaryKey(long passwordPolicyId)
472                    throws NoSuchPasswordPolicyException, SystemException {
473                    PasswordPolicy passwordPolicy = fetchByPrimaryKey(passwordPolicyId);
474    
475                    if (passwordPolicy == null) {
476                            if (_log.isWarnEnabled()) {
477                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + passwordPolicyId);
478                            }
479    
480                            throw new NoSuchPasswordPolicyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
481                                    passwordPolicyId);
482                    }
483    
484                    return passwordPolicy;
485            }
486    
487            /**
488             * Returns the password policy with the primary key or returns <code>null</code> if it could not be found.
489             *
490             * @param primaryKey the primary key of the password policy
491             * @return the password policy, or <code>null</code> if a password policy with the primary key could not be found
492             * @throws SystemException if a system exception occurred
493             */
494            @Override
495            public PasswordPolicy fetchByPrimaryKey(Serializable primaryKey)
496                    throws SystemException {
497                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
498            }
499    
500            /**
501             * Returns the password policy with the primary key or returns <code>null</code> if it could not be found.
502             *
503             * @param passwordPolicyId the primary key of the password policy
504             * @return the password policy, or <code>null</code> if a password policy with the primary key could not be found
505             * @throws SystemException if a system exception occurred
506             */
507            public PasswordPolicy fetchByPrimaryKey(long passwordPolicyId)
508                    throws SystemException {
509                    PasswordPolicy passwordPolicy = (PasswordPolicy)EntityCacheUtil.getResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
510                                    PasswordPolicyImpl.class, passwordPolicyId);
511    
512                    if (passwordPolicy == _nullPasswordPolicy) {
513                            return null;
514                    }
515    
516                    if (passwordPolicy == null) {
517                            Session session = null;
518    
519                            boolean hasException = false;
520    
521                            try {
522                                    session = openSession();
523    
524                                    passwordPolicy = (PasswordPolicy)session.get(PasswordPolicyImpl.class,
525                                                    Long.valueOf(passwordPolicyId));
526                            }
527                            catch (Exception e) {
528                                    hasException = true;
529    
530                                    throw processException(e);
531                            }
532                            finally {
533                                    if (passwordPolicy != null) {
534                                            cacheResult(passwordPolicy);
535                                    }
536                                    else if (!hasException) {
537                                            EntityCacheUtil.putResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
538                                                    PasswordPolicyImpl.class, passwordPolicyId,
539                                                    _nullPasswordPolicy);
540                                    }
541    
542                                    closeSession(session);
543                            }
544                    }
545    
546                    return passwordPolicy;
547            }
548    
549            /**
550             * Returns the password policy where companyId = &#63; and defaultPolicy = &#63; or throws a {@link com.liferay.portal.NoSuchPasswordPolicyException} if it could not be found.
551             *
552             * @param companyId the company ID
553             * @param defaultPolicy the default policy
554             * @return the matching password policy
555             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a matching password policy could not be found
556             * @throws SystemException if a system exception occurred
557             */
558            public PasswordPolicy findByC_DP(long companyId, boolean defaultPolicy)
559                    throws NoSuchPasswordPolicyException, SystemException {
560                    PasswordPolicy passwordPolicy = fetchByC_DP(companyId, defaultPolicy);
561    
562                    if (passwordPolicy == null) {
563                            StringBundler msg = new StringBundler(6);
564    
565                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
566    
567                            msg.append("companyId=");
568                            msg.append(companyId);
569    
570                            msg.append(", defaultPolicy=");
571                            msg.append(defaultPolicy);
572    
573                            msg.append(StringPool.CLOSE_CURLY_BRACE);
574    
575                            if (_log.isWarnEnabled()) {
576                                    _log.warn(msg.toString());
577                            }
578    
579                            throw new NoSuchPasswordPolicyException(msg.toString());
580                    }
581    
582                    return passwordPolicy;
583            }
584    
585            /**
586             * 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.
587             *
588             * @param companyId the company ID
589             * @param defaultPolicy the default policy
590             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
591             * @throws SystemException if a system exception occurred
592             */
593            public PasswordPolicy fetchByC_DP(long companyId, boolean defaultPolicy)
594                    throws SystemException {
595                    return fetchByC_DP(companyId, defaultPolicy, true);
596            }
597    
598            /**
599             * 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.
600             *
601             * @param companyId the company ID
602             * @param defaultPolicy the default policy
603             * @param retrieveFromCache whether to use the finder cache
604             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
605             * @throws SystemException if a system exception occurred
606             */
607            public PasswordPolicy fetchByC_DP(long companyId, boolean defaultPolicy,
608                    boolean retrieveFromCache) throws SystemException {
609                    Object[] finderArgs = new Object[] { companyId, defaultPolicy };
610    
611                    Object result = null;
612    
613                    if (retrieveFromCache) {
614                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_DP,
615                                            finderArgs, this);
616                    }
617    
618                    if (result instanceof PasswordPolicy) {
619                            PasswordPolicy passwordPolicy = (PasswordPolicy)result;
620    
621                            if ((companyId != passwordPolicy.getCompanyId()) ||
622                                            (defaultPolicy != passwordPolicy.getDefaultPolicy())) {
623                                    result = null;
624                            }
625                    }
626    
627                    if (result == null) {
628                            StringBundler query = new StringBundler(3);
629    
630                            query.append(_SQL_SELECT_PASSWORDPOLICY_WHERE);
631    
632                            query.append(_FINDER_COLUMN_C_DP_COMPANYID_2);
633    
634                            query.append(_FINDER_COLUMN_C_DP_DEFAULTPOLICY_2);
635    
636                            String sql = query.toString();
637    
638                            Session session = null;
639    
640                            try {
641                                    session = openSession();
642    
643                                    Query q = session.createQuery(sql);
644    
645                                    QueryPos qPos = QueryPos.getInstance(q);
646    
647                                    qPos.add(companyId);
648    
649                                    qPos.add(defaultPolicy);
650    
651                                    List<PasswordPolicy> list = q.list();
652    
653                                    result = list;
654    
655                                    PasswordPolicy passwordPolicy = null;
656    
657                                    if (list.isEmpty()) {
658                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
659                                                    finderArgs, list);
660                                    }
661                                    else {
662                                            passwordPolicy = list.get(0);
663    
664                                            cacheResult(passwordPolicy);
665    
666                                            if ((passwordPolicy.getCompanyId() != companyId) ||
667                                                            (passwordPolicy.getDefaultPolicy() != defaultPolicy)) {
668                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
669                                                            finderArgs, passwordPolicy);
670                                            }
671                                    }
672    
673                                    return passwordPolicy;
674                            }
675                            catch (Exception e) {
676                                    throw processException(e);
677                            }
678                            finally {
679                                    if (result == null) {
680                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DP,
681                                                    finderArgs);
682                                    }
683    
684                                    closeSession(session);
685                            }
686                    }
687                    else {
688                            if (result instanceof List<?>) {
689                                    return null;
690                            }
691                            else {
692                                    return (PasswordPolicy)result;
693                            }
694                    }
695            }
696    
697            /**
698             * Returns the password policy where companyId = &#63; and name = &#63; or throws a {@link com.liferay.portal.NoSuchPasswordPolicyException} if it could not be found.
699             *
700             * @param companyId the company ID
701             * @param name the name
702             * @return the matching password policy
703             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a matching password policy could not be found
704             * @throws SystemException if a system exception occurred
705             */
706            public PasswordPolicy findByC_N(long companyId, String name)
707                    throws NoSuchPasswordPolicyException, SystemException {
708                    PasswordPolicy passwordPolicy = fetchByC_N(companyId, name);
709    
710                    if (passwordPolicy == null) {
711                            StringBundler msg = new StringBundler(6);
712    
713                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
714    
715                            msg.append("companyId=");
716                            msg.append(companyId);
717    
718                            msg.append(", name=");
719                            msg.append(name);
720    
721                            msg.append(StringPool.CLOSE_CURLY_BRACE);
722    
723                            if (_log.isWarnEnabled()) {
724                                    _log.warn(msg.toString());
725                            }
726    
727                            throw new NoSuchPasswordPolicyException(msg.toString());
728                    }
729    
730                    return passwordPolicy;
731            }
732    
733            /**
734             * 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.
735             *
736             * @param companyId the company ID
737             * @param name the name
738             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
739             * @throws SystemException if a system exception occurred
740             */
741            public PasswordPolicy fetchByC_N(long companyId, String name)
742                    throws SystemException {
743                    return fetchByC_N(companyId, name, true);
744            }
745    
746            /**
747             * 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.
748             *
749             * @param companyId the company ID
750             * @param name the name
751             * @param retrieveFromCache whether to use the finder cache
752             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
753             * @throws SystemException if a system exception occurred
754             */
755            public PasswordPolicy fetchByC_N(long companyId, String name,
756                    boolean retrieveFromCache) throws SystemException {
757                    Object[] finderArgs = new Object[] { companyId, name };
758    
759                    Object result = null;
760    
761                    if (retrieveFromCache) {
762                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_N,
763                                            finderArgs, this);
764                    }
765    
766                    if (result instanceof PasswordPolicy) {
767                            PasswordPolicy passwordPolicy = (PasswordPolicy)result;
768    
769                            if ((companyId != passwordPolicy.getCompanyId()) ||
770                                            !Validator.equals(name, passwordPolicy.getName())) {
771                                    result = null;
772                            }
773                    }
774    
775                    if (result == null) {
776                            StringBundler query = new StringBundler(3);
777    
778                            query.append(_SQL_SELECT_PASSWORDPOLICY_WHERE);
779    
780                            query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
781    
782                            if (name == null) {
783                                    query.append(_FINDER_COLUMN_C_N_NAME_1);
784                            }
785                            else {
786                                    if (name.equals(StringPool.BLANK)) {
787                                            query.append(_FINDER_COLUMN_C_N_NAME_3);
788                                    }
789                                    else {
790                                            query.append(_FINDER_COLUMN_C_N_NAME_2);
791                                    }
792                            }
793    
794                            String sql = query.toString();
795    
796                            Session session = null;
797    
798                            try {
799                                    session = openSession();
800    
801                                    Query q = session.createQuery(sql);
802    
803                                    QueryPos qPos = QueryPos.getInstance(q);
804    
805                                    qPos.add(companyId);
806    
807                                    if (name != null) {
808                                            qPos.add(name);
809                                    }
810    
811                                    List<PasswordPolicy> list = q.list();
812    
813                                    result = list;
814    
815                                    PasswordPolicy passwordPolicy = null;
816    
817                                    if (list.isEmpty()) {
818                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
819                                                    finderArgs, list);
820                                    }
821                                    else {
822                                            passwordPolicy = list.get(0);
823    
824                                            cacheResult(passwordPolicy);
825    
826                                            if ((passwordPolicy.getCompanyId() != companyId) ||
827                                                            (passwordPolicy.getName() == null) ||
828                                                            !passwordPolicy.getName().equals(name)) {
829                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
830                                                            finderArgs, passwordPolicy);
831                                            }
832                                    }
833    
834                                    return passwordPolicy;
835                            }
836                            catch (Exception e) {
837                                    throw processException(e);
838                            }
839                            finally {
840                                    if (result == null) {
841                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
842                                                    finderArgs);
843                                    }
844    
845                                    closeSession(session);
846                            }
847                    }
848                    else {
849                            if (result instanceof List<?>) {
850                                    return null;
851                            }
852                            else {
853                                    return (PasswordPolicy)result;
854                            }
855                    }
856            }
857    
858            /**
859             * Returns all the password policies.
860             *
861             * @return the password policies
862             * @throws SystemException if a system exception occurred
863             */
864            public List<PasswordPolicy> findAll() throws SystemException {
865                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
866            }
867    
868            /**
869             * Returns a range of all the password policies.
870             *
871             * <p>
872             * 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.
873             * </p>
874             *
875             * @param start the lower bound of the range of password policies
876             * @param end the upper bound of the range of password policies (not inclusive)
877             * @return the range of password policies
878             * @throws SystemException if a system exception occurred
879             */
880            public List<PasswordPolicy> findAll(int start, int end)
881                    throws SystemException {
882                    return findAll(start, end, null);
883            }
884    
885            /**
886             * Returns an ordered range of all the password policies.
887             *
888             * <p>
889             * 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.
890             * </p>
891             *
892             * @param start the lower bound of the range of password policies
893             * @param end the upper bound of the range of password policies (not inclusive)
894             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
895             * @return the ordered range of password policies
896             * @throws SystemException if a system exception occurred
897             */
898            public List<PasswordPolicy> findAll(int start, int end,
899                    OrderByComparator orderByComparator) throws SystemException {
900                    FinderPath finderPath = null;
901                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
902    
903                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
904                                    (orderByComparator == null)) {
905                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
906                            finderArgs = FINDER_ARGS_EMPTY;
907                    }
908                    else {
909                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
910                            finderArgs = new Object[] { start, end, orderByComparator };
911                    }
912    
913                    List<PasswordPolicy> list = (List<PasswordPolicy>)FinderCacheUtil.getResult(finderPath,
914                                    finderArgs, this);
915    
916                    if (list == null) {
917                            StringBundler query = null;
918                            String sql = null;
919    
920                            if (orderByComparator != null) {
921                                    query = new StringBundler(2 +
922                                                    (orderByComparator.getOrderByFields().length * 3));
923    
924                                    query.append(_SQL_SELECT_PASSWORDPOLICY);
925    
926                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
927                                            orderByComparator);
928    
929                                    sql = query.toString();
930                            }
931                            else {
932                                    sql = _SQL_SELECT_PASSWORDPOLICY;
933                            }
934    
935                            Session session = null;
936    
937                            try {
938                                    session = openSession();
939    
940                                    Query q = session.createQuery(sql);
941    
942                                    if (orderByComparator == null) {
943                                            list = (List<PasswordPolicy>)QueryUtil.list(q,
944                                                            getDialect(), start, end, false);
945    
946                                            Collections.sort(list);
947                                    }
948                                    else {
949                                            list = (List<PasswordPolicy>)QueryUtil.list(q,
950                                                            getDialect(), start, end);
951                                    }
952                            }
953                            catch (Exception e) {
954                                    throw processException(e);
955                            }
956                            finally {
957                                    if (list == null) {
958                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
959                                    }
960                                    else {
961                                            cacheResult(list);
962    
963                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
964                                    }
965    
966                                    closeSession(session);
967                            }
968                    }
969    
970                    return list;
971            }
972    
973            /**
974             * Removes the password policy where companyId = &#63; and defaultPolicy = &#63; from the database.
975             *
976             * @param companyId the company ID
977             * @param defaultPolicy the default policy
978             * @return the password policy that was removed
979             * @throws SystemException if a system exception occurred
980             */
981            public PasswordPolicy removeByC_DP(long companyId, boolean defaultPolicy)
982                    throws NoSuchPasswordPolicyException, SystemException {
983                    PasswordPolicy passwordPolicy = findByC_DP(companyId, defaultPolicy);
984    
985                    return remove(passwordPolicy);
986            }
987    
988            /**
989             * Removes the password policy where companyId = &#63; and name = &#63; from the database.
990             *
991             * @param companyId the company ID
992             * @param name the name
993             * @return the password policy that was removed
994             * @throws SystemException if a system exception occurred
995             */
996            public PasswordPolicy removeByC_N(long companyId, String name)
997                    throws NoSuchPasswordPolicyException, SystemException {
998                    PasswordPolicy passwordPolicy = findByC_N(companyId, name);
999    
1000                    return remove(passwordPolicy);
1001            }
1002    
1003            /**
1004             * Removes all the password policies from the database.
1005             *
1006             * @throws SystemException if a system exception occurred
1007             */
1008            public void removeAll() throws SystemException {
1009                    for (PasswordPolicy passwordPolicy : findAll()) {
1010                            remove(passwordPolicy);
1011                    }
1012            }
1013    
1014            /**
1015             * Returns the number of password policies where companyId = &#63; and defaultPolicy = &#63;.
1016             *
1017             * @param companyId the company ID
1018             * @param defaultPolicy the default policy
1019             * @return the number of matching password policies
1020             * @throws SystemException if a system exception occurred
1021             */
1022            public int countByC_DP(long companyId, boolean defaultPolicy)
1023                    throws SystemException {
1024                    Object[] finderArgs = new Object[] { companyId, defaultPolicy };
1025    
1026                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_DP,
1027                                    finderArgs, this);
1028    
1029                    if (count == null) {
1030                            StringBundler query = new StringBundler(3);
1031    
1032                            query.append(_SQL_COUNT_PASSWORDPOLICY_WHERE);
1033    
1034                            query.append(_FINDER_COLUMN_C_DP_COMPANYID_2);
1035    
1036                            query.append(_FINDER_COLUMN_C_DP_DEFAULTPOLICY_2);
1037    
1038                            String sql = query.toString();
1039    
1040                            Session session = null;
1041    
1042                            try {
1043                                    session = openSession();
1044    
1045                                    Query q = session.createQuery(sql);
1046    
1047                                    QueryPos qPos = QueryPos.getInstance(q);
1048    
1049                                    qPos.add(companyId);
1050    
1051                                    qPos.add(defaultPolicy);
1052    
1053                                    count = (Long)q.uniqueResult();
1054                            }
1055                            catch (Exception e) {
1056                                    throw processException(e);
1057                            }
1058                            finally {
1059                                    if (count == null) {
1060                                            count = Long.valueOf(0);
1061                                    }
1062    
1063                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_DP,
1064                                            finderArgs, count);
1065    
1066                                    closeSession(session);
1067                            }
1068                    }
1069    
1070                    return count.intValue();
1071            }
1072    
1073            /**
1074             * Returns the number of password policies where companyId = &#63; and name = &#63;.
1075             *
1076             * @param companyId the company ID
1077             * @param name the name
1078             * @return the number of matching password policies
1079             * @throws SystemException if a system exception occurred
1080             */
1081            public int countByC_N(long companyId, String name)
1082                    throws SystemException {
1083                    Object[] finderArgs = new Object[] { companyId, name };
1084    
1085                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N,
1086                                    finderArgs, this);
1087    
1088                    if (count == null) {
1089                            StringBundler query = new StringBundler(3);
1090    
1091                            query.append(_SQL_COUNT_PASSWORDPOLICY_WHERE);
1092    
1093                            query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
1094    
1095                            if (name == null) {
1096                                    query.append(_FINDER_COLUMN_C_N_NAME_1);
1097                            }
1098                            else {
1099                                    if (name.equals(StringPool.BLANK)) {
1100                                            query.append(_FINDER_COLUMN_C_N_NAME_3);
1101                                    }
1102                                    else {
1103                                            query.append(_FINDER_COLUMN_C_N_NAME_2);
1104                                    }
1105                            }
1106    
1107                            String sql = query.toString();
1108    
1109                            Session session = null;
1110    
1111                            try {
1112                                    session = openSession();
1113    
1114                                    Query q = session.createQuery(sql);
1115    
1116                                    QueryPos qPos = QueryPos.getInstance(q);
1117    
1118                                    qPos.add(companyId);
1119    
1120                                    if (name != null) {
1121                                            qPos.add(name);
1122                                    }
1123    
1124                                    count = (Long)q.uniqueResult();
1125                            }
1126                            catch (Exception e) {
1127                                    throw processException(e);
1128                            }
1129                            finally {
1130                                    if (count == null) {
1131                                            count = Long.valueOf(0);
1132                                    }
1133    
1134                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N, finderArgs,
1135                                            count);
1136    
1137                                    closeSession(session);
1138                            }
1139                    }
1140    
1141                    return count.intValue();
1142            }
1143    
1144            /**
1145             * Returns the number of password policies.
1146             *
1147             * @return the number of password policies
1148             * @throws SystemException if a system exception occurred
1149             */
1150            public int countAll() throws SystemException {
1151                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1152                                    FINDER_ARGS_EMPTY, this);
1153    
1154                    if (count == null) {
1155                            Session session = null;
1156    
1157                            try {
1158                                    session = openSession();
1159    
1160                                    Query q = session.createQuery(_SQL_COUNT_PASSWORDPOLICY);
1161    
1162                                    count = (Long)q.uniqueResult();
1163                            }
1164                            catch (Exception e) {
1165                                    throw processException(e);
1166                            }
1167                            finally {
1168                                    if (count == null) {
1169                                            count = Long.valueOf(0);
1170                                    }
1171    
1172                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1173                                            FINDER_ARGS_EMPTY, count);
1174    
1175                                    closeSession(session);
1176                            }
1177                    }
1178    
1179                    return count.intValue();
1180            }
1181    
1182            /**
1183             * Initializes the password policy persistence.
1184             */
1185            public void afterPropertiesSet() {
1186                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1187                                            com.liferay.portal.util.PropsUtil.get(
1188                                                    "value.object.listener.com.liferay.portal.model.PasswordPolicy")));
1189    
1190                    if (listenerClassNames.length > 0) {
1191                            try {
1192                                    List<ModelListener<PasswordPolicy>> listenersList = new ArrayList<ModelListener<PasswordPolicy>>();
1193    
1194                                    for (String listenerClassName : listenerClassNames) {
1195                                            listenersList.add((ModelListener<PasswordPolicy>)InstanceFactory.newInstance(
1196                                                            listenerClassName));
1197                                    }
1198    
1199                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1200                            }
1201                            catch (Exception e) {
1202                                    _log.error(e);
1203                            }
1204                    }
1205            }
1206    
1207            public void destroy() {
1208                    EntityCacheUtil.removeCache(PasswordPolicyImpl.class.getName());
1209                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1210                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1211            }
1212    
1213            @BeanReference(type = AccountPersistence.class)
1214            protected AccountPersistence accountPersistence;
1215            @BeanReference(type = AddressPersistence.class)
1216            protected AddressPersistence addressPersistence;
1217            @BeanReference(type = BrowserTrackerPersistence.class)
1218            protected BrowserTrackerPersistence browserTrackerPersistence;
1219            @BeanReference(type = ClassNamePersistence.class)
1220            protected ClassNamePersistence classNamePersistence;
1221            @BeanReference(type = ClusterGroupPersistence.class)
1222            protected ClusterGroupPersistence clusterGroupPersistence;
1223            @BeanReference(type = CompanyPersistence.class)
1224            protected CompanyPersistence companyPersistence;
1225            @BeanReference(type = ContactPersistence.class)
1226            protected ContactPersistence contactPersistence;
1227            @BeanReference(type = CountryPersistence.class)
1228            protected CountryPersistence countryPersistence;
1229            @BeanReference(type = EmailAddressPersistence.class)
1230            protected EmailAddressPersistence emailAddressPersistence;
1231            @BeanReference(type = GroupPersistence.class)
1232            protected GroupPersistence groupPersistence;
1233            @BeanReference(type = ImagePersistence.class)
1234            protected ImagePersistence imagePersistence;
1235            @BeanReference(type = LayoutPersistence.class)
1236            protected LayoutPersistence layoutPersistence;
1237            @BeanReference(type = LayoutBranchPersistence.class)
1238            protected LayoutBranchPersistence layoutBranchPersistence;
1239            @BeanReference(type = LayoutPrototypePersistence.class)
1240            protected LayoutPrototypePersistence layoutPrototypePersistence;
1241            @BeanReference(type = LayoutRevisionPersistence.class)
1242            protected LayoutRevisionPersistence layoutRevisionPersistence;
1243            @BeanReference(type = LayoutSetPersistence.class)
1244            protected LayoutSetPersistence layoutSetPersistence;
1245            @BeanReference(type = LayoutSetBranchPersistence.class)
1246            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1247            @BeanReference(type = LayoutSetPrototypePersistence.class)
1248            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1249            @BeanReference(type = ListTypePersistence.class)
1250            protected ListTypePersistence listTypePersistence;
1251            @BeanReference(type = LockPersistence.class)
1252            protected LockPersistence lockPersistence;
1253            @BeanReference(type = MembershipRequestPersistence.class)
1254            protected MembershipRequestPersistence membershipRequestPersistence;
1255            @BeanReference(type = OrganizationPersistence.class)
1256            protected OrganizationPersistence organizationPersistence;
1257            @BeanReference(type = OrgGroupPermissionPersistence.class)
1258            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1259            @BeanReference(type = OrgGroupRolePersistence.class)
1260            protected OrgGroupRolePersistence orgGroupRolePersistence;
1261            @BeanReference(type = OrgLaborPersistence.class)
1262            protected OrgLaborPersistence orgLaborPersistence;
1263            @BeanReference(type = PasswordPolicyPersistence.class)
1264            protected PasswordPolicyPersistence passwordPolicyPersistence;
1265            @BeanReference(type = PasswordPolicyRelPersistence.class)
1266            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1267            @BeanReference(type = PasswordTrackerPersistence.class)
1268            protected PasswordTrackerPersistence passwordTrackerPersistence;
1269            @BeanReference(type = PermissionPersistence.class)
1270            protected PermissionPersistence permissionPersistence;
1271            @BeanReference(type = PhonePersistence.class)
1272            protected PhonePersistence phonePersistence;
1273            @BeanReference(type = PluginSettingPersistence.class)
1274            protected PluginSettingPersistence pluginSettingPersistence;
1275            @BeanReference(type = PortalPreferencesPersistence.class)
1276            protected PortalPreferencesPersistence portalPreferencesPersistence;
1277            @BeanReference(type = PortletPersistence.class)
1278            protected PortletPersistence portletPersistence;
1279            @BeanReference(type = PortletItemPersistence.class)
1280            protected PortletItemPersistence portletItemPersistence;
1281            @BeanReference(type = PortletPreferencesPersistence.class)
1282            protected PortletPreferencesPersistence portletPreferencesPersistence;
1283            @BeanReference(type = RegionPersistence.class)
1284            protected RegionPersistence regionPersistence;
1285            @BeanReference(type = ReleasePersistence.class)
1286            protected ReleasePersistence releasePersistence;
1287            @BeanReference(type = RepositoryPersistence.class)
1288            protected RepositoryPersistence repositoryPersistence;
1289            @BeanReference(type = RepositoryEntryPersistence.class)
1290            protected RepositoryEntryPersistence repositoryEntryPersistence;
1291            @BeanReference(type = ResourcePersistence.class)
1292            protected ResourcePersistence resourcePersistence;
1293            @BeanReference(type = ResourceActionPersistence.class)
1294            protected ResourceActionPersistence resourceActionPersistence;
1295            @BeanReference(type = ResourceBlockPersistence.class)
1296            protected ResourceBlockPersistence resourceBlockPersistence;
1297            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1298            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1299            @BeanReference(type = ResourceCodePersistence.class)
1300            protected ResourceCodePersistence resourceCodePersistence;
1301            @BeanReference(type = ResourcePermissionPersistence.class)
1302            protected ResourcePermissionPersistence resourcePermissionPersistence;
1303            @BeanReference(type = ResourceTypePermissionPersistence.class)
1304            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1305            @BeanReference(type = RolePersistence.class)
1306            protected RolePersistence rolePersistence;
1307            @BeanReference(type = ServiceComponentPersistence.class)
1308            protected ServiceComponentPersistence serviceComponentPersistence;
1309            @BeanReference(type = ShardPersistence.class)
1310            protected ShardPersistence shardPersistence;
1311            @BeanReference(type = SubscriptionPersistence.class)
1312            protected SubscriptionPersistence subscriptionPersistence;
1313            @BeanReference(type = TeamPersistence.class)
1314            protected TeamPersistence teamPersistence;
1315            @BeanReference(type = TicketPersistence.class)
1316            protected TicketPersistence ticketPersistence;
1317            @BeanReference(type = UserPersistence.class)
1318            protected UserPersistence userPersistence;
1319            @BeanReference(type = UserGroupPersistence.class)
1320            protected UserGroupPersistence userGroupPersistence;
1321            @BeanReference(type = UserGroupGroupRolePersistence.class)
1322            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1323            @BeanReference(type = UserGroupRolePersistence.class)
1324            protected UserGroupRolePersistence userGroupRolePersistence;
1325            @BeanReference(type = UserIdMapperPersistence.class)
1326            protected UserIdMapperPersistence userIdMapperPersistence;
1327            @BeanReference(type = UserNotificationEventPersistence.class)
1328            protected UserNotificationEventPersistence userNotificationEventPersistence;
1329            @BeanReference(type = UserTrackerPersistence.class)
1330            protected UserTrackerPersistence userTrackerPersistence;
1331            @BeanReference(type = UserTrackerPathPersistence.class)
1332            protected UserTrackerPathPersistence userTrackerPathPersistence;
1333            @BeanReference(type = VirtualHostPersistence.class)
1334            protected VirtualHostPersistence virtualHostPersistence;
1335            @BeanReference(type = WebDAVPropsPersistence.class)
1336            protected WebDAVPropsPersistence webDAVPropsPersistence;
1337            @BeanReference(type = WebsitePersistence.class)
1338            protected WebsitePersistence websitePersistence;
1339            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1340            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1341            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1342            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1343            private static final String _SQL_SELECT_PASSWORDPOLICY = "SELECT passwordPolicy FROM PasswordPolicy passwordPolicy";
1344            private static final String _SQL_SELECT_PASSWORDPOLICY_WHERE = "SELECT passwordPolicy FROM PasswordPolicy passwordPolicy WHERE ";
1345            private static final String _SQL_COUNT_PASSWORDPOLICY = "SELECT COUNT(passwordPolicy) FROM PasswordPolicy passwordPolicy";
1346            private static final String _SQL_COUNT_PASSWORDPOLICY_WHERE = "SELECT COUNT(passwordPolicy) FROM PasswordPolicy passwordPolicy WHERE ";
1347            private static final String _FINDER_COLUMN_C_DP_COMPANYID_2 = "passwordPolicy.companyId = ? AND ";
1348            private static final String _FINDER_COLUMN_C_DP_DEFAULTPOLICY_2 = "passwordPolicy.defaultPolicy = ?";
1349            private static final String _FINDER_COLUMN_C_N_COMPANYID_2 = "passwordPolicy.companyId = ? AND ";
1350            private static final String _FINDER_COLUMN_C_N_NAME_1 = "passwordPolicy.name IS NULL";
1351            private static final String _FINDER_COLUMN_C_N_NAME_2 = "passwordPolicy.name = ?";
1352            private static final String _FINDER_COLUMN_C_N_NAME_3 = "(passwordPolicy.name IS NULL OR passwordPolicy.name = ?)";
1353            private static final String _ORDER_BY_ENTITY_ALIAS = "passwordPolicy.";
1354            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordPolicy exists with the primary key ";
1355            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordPolicy exists with the key {";
1356            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1357            private static Log _log = LogFactoryUtil.getLog(PasswordPolicyPersistenceImpl.class);
1358            private static PasswordPolicy _nullPasswordPolicy = new PasswordPolicyImpl() {
1359                            @Override
1360                            public Object clone() {
1361                                    return this;
1362                            }
1363    
1364                            @Override
1365                            public CacheModel<PasswordPolicy> toCacheModel() {
1366                                    return _nullPasswordPolicyCacheModel;
1367                            }
1368                    };
1369    
1370            private static CacheModel<PasswordPolicy> _nullPasswordPolicyCacheModel = new CacheModel<PasswordPolicy>() {
1371                            public PasswordPolicy toEntityModel() {
1372                                    return _nullPasswordPolicy;
1373                            }
1374                    };
1375    }