001    /**
002     * Copyright (c) 2000-2012 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.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                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DP, args);
370    
371                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
372                                            new Object[] {
373                                                    Long.valueOf(passwordPolicy.getCompanyId()),
374                                                    Boolean.valueOf(passwordPolicy.getDefaultPolicy())
375                                            }, passwordPolicy);
376                            }
377    
378                            if ((passwordPolicyModelImpl.getColumnBitmask() &
379                                            FINDER_PATH_FETCH_BY_C_N.getColumnBitmask()) != 0) {
380                                    Object[] args = new Object[] {
381                                                    Long.valueOf(passwordPolicyModelImpl.getOriginalCompanyId()),
382                                                    
383                                                    passwordPolicyModelImpl.getOriginalName()
384                                            };
385    
386                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_N, args);
387                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N, args);
388    
389                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
390                                            new Object[] {
391                                                    Long.valueOf(passwordPolicy.getCompanyId()),
392                                                    
393                                            passwordPolicy.getName()
394                                            }, passwordPolicy);
395                            }
396                    }
397    
398                    return passwordPolicy;
399            }
400    
401            protected PasswordPolicy toUnwrappedModel(PasswordPolicy passwordPolicy) {
402                    if (passwordPolicy instanceof PasswordPolicyImpl) {
403                            return passwordPolicy;
404                    }
405    
406                    PasswordPolicyImpl passwordPolicyImpl = new PasswordPolicyImpl();
407    
408                    passwordPolicyImpl.setNew(passwordPolicy.isNew());
409                    passwordPolicyImpl.setPrimaryKey(passwordPolicy.getPrimaryKey());
410    
411                    passwordPolicyImpl.setPasswordPolicyId(passwordPolicy.getPasswordPolicyId());
412                    passwordPolicyImpl.setCompanyId(passwordPolicy.getCompanyId());
413                    passwordPolicyImpl.setUserId(passwordPolicy.getUserId());
414                    passwordPolicyImpl.setUserName(passwordPolicy.getUserName());
415                    passwordPolicyImpl.setCreateDate(passwordPolicy.getCreateDate());
416                    passwordPolicyImpl.setModifiedDate(passwordPolicy.getModifiedDate());
417                    passwordPolicyImpl.setDefaultPolicy(passwordPolicy.isDefaultPolicy());
418                    passwordPolicyImpl.setName(passwordPolicy.getName());
419                    passwordPolicyImpl.setDescription(passwordPolicy.getDescription());
420                    passwordPolicyImpl.setChangeable(passwordPolicy.isChangeable());
421                    passwordPolicyImpl.setChangeRequired(passwordPolicy.isChangeRequired());
422                    passwordPolicyImpl.setMinAge(passwordPolicy.getMinAge());
423                    passwordPolicyImpl.setCheckSyntax(passwordPolicy.isCheckSyntax());
424                    passwordPolicyImpl.setAllowDictionaryWords(passwordPolicy.isAllowDictionaryWords());
425                    passwordPolicyImpl.setMinAlphanumeric(passwordPolicy.getMinAlphanumeric());
426                    passwordPolicyImpl.setMinLength(passwordPolicy.getMinLength());
427                    passwordPolicyImpl.setMinLowerCase(passwordPolicy.getMinLowerCase());
428                    passwordPolicyImpl.setMinNumbers(passwordPolicy.getMinNumbers());
429                    passwordPolicyImpl.setMinSymbols(passwordPolicy.getMinSymbols());
430                    passwordPolicyImpl.setMinUpperCase(passwordPolicy.getMinUpperCase());
431                    passwordPolicyImpl.setHistory(passwordPolicy.isHistory());
432                    passwordPolicyImpl.setHistoryCount(passwordPolicy.getHistoryCount());
433                    passwordPolicyImpl.setExpireable(passwordPolicy.isExpireable());
434                    passwordPolicyImpl.setMaxAge(passwordPolicy.getMaxAge());
435                    passwordPolicyImpl.setWarningTime(passwordPolicy.getWarningTime());
436                    passwordPolicyImpl.setGraceLimit(passwordPolicy.getGraceLimit());
437                    passwordPolicyImpl.setLockout(passwordPolicy.isLockout());
438                    passwordPolicyImpl.setMaxFailure(passwordPolicy.getMaxFailure());
439                    passwordPolicyImpl.setLockoutDuration(passwordPolicy.getLockoutDuration());
440                    passwordPolicyImpl.setRequireUnlock(passwordPolicy.isRequireUnlock());
441                    passwordPolicyImpl.setResetFailureCount(passwordPolicy.getResetFailureCount());
442                    passwordPolicyImpl.setResetTicketMaxAge(passwordPolicy.getResetTicketMaxAge());
443    
444                    return passwordPolicyImpl;
445            }
446    
447            /**
448             * Returns the password policy with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
449             *
450             * @param primaryKey the primary key of the password policy
451             * @return the password policy
452             * @throws com.liferay.portal.NoSuchModelException if a password policy with the primary key could not be found
453             * @throws SystemException if a system exception occurred
454             */
455            @Override
456            public PasswordPolicy findByPrimaryKey(Serializable primaryKey)
457                    throws NoSuchModelException, SystemException {
458                    return findByPrimaryKey(((Long)primaryKey).longValue());
459            }
460    
461            /**
462             * Returns the password policy with the primary key or throws a {@link com.liferay.portal.NoSuchPasswordPolicyException} if it could not be found.
463             *
464             * @param passwordPolicyId the primary key of the password policy
465             * @return the password policy
466             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a password policy with the primary key could not be found
467             * @throws SystemException if a system exception occurred
468             */
469            public PasswordPolicy findByPrimaryKey(long passwordPolicyId)
470                    throws NoSuchPasswordPolicyException, SystemException {
471                    PasswordPolicy passwordPolicy = fetchByPrimaryKey(passwordPolicyId);
472    
473                    if (passwordPolicy == null) {
474                            if (_log.isWarnEnabled()) {
475                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + passwordPolicyId);
476                            }
477    
478                            throw new NoSuchPasswordPolicyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
479                                    passwordPolicyId);
480                    }
481    
482                    return passwordPolicy;
483            }
484    
485            /**
486             * Returns the password policy with the primary key or returns <code>null</code> if it could not be found.
487             *
488             * @param primaryKey the primary key of the password policy
489             * @return the password policy, or <code>null</code> if a password policy with the primary key could not be found
490             * @throws SystemException if a system exception occurred
491             */
492            @Override
493            public PasswordPolicy fetchByPrimaryKey(Serializable primaryKey)
494                    throws SystemException {
495                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
496            }
497    
498            /**
499             * Returns the password policy with the primary key or returns <code>null</code> if it could not be found.
500             *
501             * @param passwordPolicyId the primary key of the password policy
502             * @return the password policy, or <code>null</code> if a password policy with the primary key could not be found
503             * @throws SystemException if a system exception occurred
504             */
505            public PasswordPolicy fetchByPrimaryKey(long passwordPolicyId)
506                    throws SystemException {
507                    PasswordPolicy passwordPolicy = (PasswordPolicy)EntityCacheUtil.getResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
508                                    PasswordPolicyImpl.class, passwordPolicyId);
509    
510                    if (passwordPolicy == _nullPasswordPolicy) {
511                            return null;
512                    }
513    
514                    if (passwordPolicy == null) {
515                            Session session = null;
516    
517                            boolean hasException = false;
518    
519                            try {
520                                    session = openSession();
521    
522                                    passwordPolicy = (PasswordPolicy)session.get(PasswordPolicyImpl.class,
523                                                    Long.valueOf(passwordPolicyId));
524                            }
525                            catch (Exception e) {
526                                    hasException = true;
527    
528                                    throw processException(e);
529                            }
530                            finally {
531                                    if (passwordPolicy != null) {
532                                            cacheResult(passwordPolicy);
533                                    }
534                                    else if (!hasException) {
535                                            EntityCacheUtil.putResult(PasswordPolicyModelImpl.ENTITY_CACHE_ENABLED,
536                                                    PasswordPolicyImpl.class, passwordPolicyId,
537                                                    _nullPasswordPolicy);
538                                    }
539    
540                                    closeSession(session);
541                            }
542                    }
543    
544                    return passwordPolicy;
545            }
546    
547            /**
548             * Returns the password policy where companyId = &#63; and defaultPolicy = &#63; or throws a {@link com.liferay.portal.NoSuchPasswordPolicyException} if it could not be found.
549             *
550             * @param companyId the company ID
551             * @param defaultPolicy the default policy
552             * @return the matching password policy
553             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a matching password policy could not be found
554             * @throws SystemException if a system exception occurred
555             */
556            public PasswordPolicy findByC_DP(long companyId, boolean defaultPolicy)
557                    throws NoSuchPasswordPolicyException, SystemException {
558                    PasswordPolicy passwordPolicy = fetchByC_DP(companyId, defaultPolicy);
559    
560                    if (passwordPolicy == null) {
561                            StringBundler msg = new StringBundler(6);
562    
563                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
564    
565                            msg.append("companyId=");
566                            msg.append(companyId);
567    
568                            msg.append(", defaultPolicy=");
569                            msg.append(defaultPolicy);
570    
571                            msg.append(StringPool.CLOSE_CURLY_BRACE);
572    
573                            if (_log.isWarnEnabled()) {
574                                    _log.warn(msg.toString());
575                            }
576    
577                            throw new NoSuchPasswordPolicyException(msg.toString());
578                    }
579    
580                    return passwordPolicy;
581            }
582    
583            /**
584             * 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.
585             *
586             * @param companyId the company ID
587             * @param defaultPolicy the default policy
588             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
589             * @throws SystemException if a system exception occurred
590             */
591            public PasswordPolicy fetchByC_DP(long companyId, boolean defaultPolicy)
592                    throws SystemException {
593                    return fetchByC_DP(companyId, defaultPolicy, true);
594            }
595    
596            /**
597             * 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.
598             *
599             * @param companyId the company ID
600             * @param defaultPolicy the default policy
601             * @param retrieveFromCache whether to use the finder cache
602             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
603             * @throws SystemException if a system exception occurred
604             */
605            public PasswordPolicy fetchByC_DP(long companyId, boolean defaultPolicy,
606                    boolean retrieveFromCache) throws SystemException {
607                    Object[] finderArgs = new Object[] { companyId, defaultPolicy };
608    
609                    Object result = null;
610    
611                    if (retrieveFromCache) {
612                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_DP,
613                                            finderArgs, this);
614                    }
615    
616                    if (result instanceof PasswordPolicy) {
617                            PasswordPolicy passwordPolicy = (PasswordPolicy)result;
618    
619                            if ((companyId != passwordPolicy.getCompanyId()) ||
620                                            (defaultPolicy != passwordPolicy.getDefaultPolicy())) {
621                                    result = null;
622                            }
623                    }
624    
625                    if (result == null) {
626                            StringBundler query = new StringBundler(3);
627    
628                            query.append(_SQL_SELECT_PASSWORDPOLICY_WHERE);
629    
630                            query.append(_FINDER_COLUMN_C_DP_COMPANYID_2);
631    
632                            query.append(_FINDER_COLUMN_C_DP_DEFAULTPOLICY_2);
633    
634                            String sql = query.toString();
635    
636                            Session session = null;
637    
638                            try {
639                                    session = openSession();
640    
641                                    Query q = session.createQuery(sql);
642    
643                                    QueryPos qPos = QueryPos.getInstance(q);
644    
645                                    qPos.add(companyId);
646    
647                                    qPos.add(defaultPolicy);
648    
649                                    List<PasswordPolicy> list = q.list();
650    
651                                    result = list;
652    
653                                    PasswordPolicy passwordPolicy = null;
654    
655                                    if (list.isEmpty()) {
656                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
657                                                    finderArgs, list);
658                                    }
659                                    else {
660                                            passwordPolicy = list.get(0);
661    
662                                            cacheResult(passwordPolicy);
663    
664                                            if ((passwordPolicy.getCompanyId() != companyId) ||
665                                                            (passwordPolicy.getDefaultPolicy() != defaultPolicy)) {
666                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_DP,
667                                                            finderArgs, passwordPolicy);
668                                            }
669                                    }
670    
671                                    return passwordPolicy;
672                            }
673                            catch (Exception e) {
674                                    throw processException(e);
675                            }
676                            finally {
677                                    if (result == null) {
678                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_DP,
679                                                    finderArgs);
680                                    }
681    
682                                    closeSession(session);
683                            }
684                    }
685                    else {
686                            if (result instanceof List<?>) {
687                                    return null;
688                            }
689                            else {
690                                    return (PasswordPolicy)result;
691                            }
692                    }
693            }
694    
695            /**
696             * Returns the password policy where companyId = &#63; and name = &#63; or throws a {@link com.liferay.portal.NoSuchPasswordPolicyException} if it could not be found.
697             *
698             * @param companyId the company ID
699             * @param name the name
700             * @return the matching password policy
701             * @throws com.liferay.portal.NoSuchPasswordPolicyException if a matching password policy could not be found
702             * @throws SystemException if a system exception occurred
703             */
704            public PasswordPolicy findByC_N(long companyId, String name)
705                    throws NoSuchPasswordPolicyException, SystemException {
706                    PasswordPolicy passwordPolicy = fetchByC_N(companyId, name);
707    
708                    if (passwordPolicy == null) {
709                            StringBundler msg = new StringBundler(6);
710    
711                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
712    
713                            msg.append("companyId=");
714                            msg.append(companyId);
715    
716                            msg.append(", name=");
717                            msg.append(name);
718    
719                            msg.append(StringPool.CLOSE_CURLY_BRACE);
720    
721                            if (_log.isWarnEnabled()) {
722                                    _log.warn(msg.toString());
723                            }
724    
725                            throw new NoSuchPasswordPolicyException(msg.toString());
726                    }
727    
728                    return passwordPolicy;
729            }
730    
731            /**
732             * 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.
733             *
734             * @param companyId the company ID
735             * @param name the name
736             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
737             * @throws SystemException if a system exception occurred
738             */
739            public PasswordPolicy fetchByC_N(long companyId, String name)
740                    throws SystemException {
741                    return fetchByC_N(companyId, name, true);
742            }
743    
744            /**
745             * 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.
746             *
747             * @param companyId the company ID
748             * @param name the name
749             * @param retrieveFromCache whether to use the finder cache
750             * @return the matching password policy, or <code>null</code> if a matching password policy could not be found
751             * @throws SystemException if a system exception occurred
752             */
753            public PasswordPolicy fetchByC_N(long companyId, String name,
754                    boolean retrieveFromCache) throws SystemException {
755                    Object[] finderArgs = new Object[] { companyId, name };
756    
757                    Object result = null;
758    
759                    if (retrieveFromCache) {
760                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_N,
761                                            finderArgs, this);
762                    }
763    
764                    if (result instanceof PasswordPolicy) {
765                            PasswordPolicy passwordPolicy = (PasswordPolicy)result;
766    
767                            if ((companyId != passwordPolicy.getCompanyId()) ||
768                                            !Validator.equals(name, passwordPolicy.getName())) {
769                                    result = null;
770                            }
771                    }
772    
773                    if (result == null) {
774                            StringBundler query = new StringBundler(3);
775    
776                            query.append(_SQL_SELECT_PASSWORDPOLICY_WHERE);
777    
778                            query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
779    
780                            if (name == null) {
781                                    query.append(_FINDER_COLUMN_C_N_NAME_1);
782                            }
783                            else {
784                                    if (name.equals(StringPool.BLANK)) {
785                                            query.append(_FINDER_COLUMN_C_N_NAME_3);
786                                    }
787                                    else {
788                                            query.append(_FINDER_COLUMN_C_N_NAME_2);
789                                    }
790                            }
791    
792                            String sql = query.toString();
793    
794                            Session session = null;
795    
796                            try {
797                                    session = openSession();
798    
799                                    Query q = session.createQuery(sql);
800    
801                                    QueryPos qPos = QueryPos.getInstance(q);
802    
803                                    qPos.add(companyId);
804    
805                                    if (name != null) {
806                                            qPos.add(name);
807                                    }
808    
809                                    List<PasswordPolicy> list = q.list();
810    
811                                    result = list;
812    
813                                    PasswordPolicy passwordPolicy = null;
814    
815                                    if (list.isEmpty()) {
816                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
817                                                    finderArgs, list);
818                                    }
819                                    else {
820                                            passwordPolicy = list.get(0);
821    
822                                            cacheResult(passwordPolicy);
823    
824                                            if ((passwordPolicy.getCompanyId() != companyId) ||
825                                                            (passwordPolicy.getName() == null) ||
826                                                            !passwordPolicy.getName().equals(name)) {
827                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_N,
828                                                            finderArgs, passwordPolicy);
829                                            }
830                                    }
831    
832                                    return passwordPolicy;
833                            }
834                            catch (Exception e) {
835                                    throw processException(e);
836                            }
837                            finally {
838                                    if (result == null) {
839                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_N,
840                                                    finderArgs);
841                                    }
842    
843                                    closeSession(session);
844                            }
845                    }
846                    else {
847                            if (result instanceof List<?>) {
848                                    return null;
849                            }
850                            else {
851                                    return (PasswordPolicy)result;
852                            }
853                    }
854            }
855    
856            /**
857             * Returns all the password policies.
858             *
859             * @return the password policies
860             * @throws SystemException if a system exception occurred
861             */
862            public List<PasswordPolicy> findAll() throws SystemException {
863                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
864            }
865    
866            /**
867             * Returns a range of all the password policies.
868             *
869             * <p>
870             * 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.
871             * </p>
872             *
873             * @param start the lower bound of the range of password policies
874             * @param end the upper bound of the range of password policies (not inclusive)
875             * @return the range of password policies
876             * @throws SystemException if a system exception occurred
877             */
878            public List<PasswordPolicy> findAll(int start, int end)
879                    throws SystemException {
880                    return findAll(start, end, null);
881            }
882    
883            /**
884             * Returns an ordered range of all the password policies.
885             *
886             * <p>
887             * 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.
888             * </p>
889             *
890             * @param start the lower bound of the range of password policies
891             * @param end the upper bound of the range of password policies (not inclusive)
892             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
893             * @return the ordered range of password policies
894             * @throws SystemException if a system exception occurred
895             */
896            public List<PasswordPolicy> findAll(int start, int end,
897                    OrderByComparator orderByComparator) throws SystemException {
898                    FinderPath finderPath = null;
899                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
900    
901                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
902                                    (orderByComparator == null)) {
903                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
904                            finderArgs = FINDER_ARGS_EMPTY;
905                    }
906                    else {
907                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
908                            finderArgs = new Object[] { start, end, orderByComparator };
909                    }
910    
911                    List<PasswordPolicy> list = (List<PasswordPolicy>)FinderCacheUtil.getResult(finderPath,
912                                    finderArgs, this);
913    
914                    if (list == null) {
915                            StringBundler query = null;
916                            String sql = null;
917    
918                            if (orderByComparator != null) {
919                                    query = new StringBundler(2 +
920                                                    (orderByComparator.getOrderByFields().length * 3));
921    
922                                    query.append(_SQL_SELECT_PASSWORDPOLICY);
923    
924                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
925                                            orderByComparator);
926    
927                                    sql = query.toString();
928                            }
929                            else {
930                                    sql = _SQL_SELECT_PASSWORDPOLICY;
931                            }
932    
933                            Session session = null;
934    
935                            try {
936                                    session = openSession();
937    
938                                    Query q = session.createQuery(sql);
939    
940                                    if (orderByComparator == null) {
941                                            list = (List<PasswordPolicy>)QueryUtil.list(q,
942                                                            getDialect(), start, end, false);
943    
944                                            Collections.sort(list);
945                                    }
946                                    else {
947                                            list = (List<PasswordPolicy>)QueryUtil.list(q,
948                                                            getDialect(), start, end);
949                                    }
950                            }
951                            catch (Exception e) {
952                                    throw processException(e);
953                            }
954                            finally {
955                                    if (list == null) {
956                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
957                                    }
958                                    else {
959                                            cacheResult(list);
960    
961                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
962                                    }
963    
964                                    closeSession(session);
965                            }
966                    }
967    
968                    return list;
969            }
970    
971            /**
972             * Removes the password policy where companyId = &#63; and defaultPolicy = &#63; from the database.
973             *
974             * @param companyId the company ID
975             * @param defaultPolicy the default policy
976             * @throws SystemException if a system exception occurred
977             */
978            public void removeByC_DP(long companyId, boolean defaultPolicy)
979                    throws NoSuchPasswordPolicyException, SystemException {
980                    PasswordPolicy passwordPolicy = findByC_DP(companyId, defaultPolicy);
981    
982                    remove(passwordPolicy);
983            }
984    
985            /**
986             * Removes the password policy where companyId = &#63; and name = &#63; from the database.
987             *
988             * @param companyId the company ID
989             * @param name the name
990             * @throws SystemException if a system exception occurred
991             */
992            public void removeByC_N(long companyId, String name)
993                    throws NoSuchPasswordPolicyException, SystemException {
994                    PasswordPolicy passwordPolicy = findByC_N(companyId, name);
995    
996                    remove(passwordPolicy);
997            }
998    
999            /**
1000             * Removes all the password policies from the database.
1001             *
1002             * @throws SystemException if a system exception occurred
1003             */
1004            public void removeAll() throws SystemException {
1005                    for (PasswordPolicy passwordPolicy : findAll()) {
1006                            remove(passwordPolicy);
1007                    }
1008            }
1009    
1010            /**
1011             * Returns the number of password policies where companyId = &#63; and defaultPolicy = &#63;.
1012             *
1013             * @param companyId the company ID
1014             * @param defaultPolicy the default policy
1015             * @return the number of matching password policies
1016             * @throws SystemException if a system exception occurred
1017             */
1018            public int countByC_DP(long companyId, boolean defaultPolicy)
1019                    throws SystemException {
1020                    Object[] finderArgs = new Object[] { companyId, defaultPolicy };
1021    
1022                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_DP,
1023                                    finderArgs, this);
1024    
1025                    if (count == null) {
1026                            StringBundler query = new StringBundler(3);
1027    
1028                            query.append(_SQL_COUNT_PASSWORDPOLICY_WHERE);
1029    
1030                            query.append(_FINDER_COLUMN_C_DP_COMPANYID_2);
1031    
1032                            query.append(_FINDER_COLUMN_C_DP_DEFAULTPOLICY_2);
1033    
1034                            String sql = query.toString();
1035    
1036                            Session session = null;
1037    
1038                            try {
1039                                    session = openSession();
1040    
1041                                    Query q = session.createQuery(sql);
1042    
1043                                    QueryPos qPos = QueryPos.getInstance(q);
1044    
1045                                    qPos.add(companyId);
1046    
1047                                    qPos.add(defaultPolicy);
1048    
1049                                    count = (Long)q.uniqueResult();
1050                            }
1051                            catch (Exception e) {
1052                                    throw processException(e);
1053                            }
1054                            finally {
1055                                    if (count == null) {
1056                                            count = Long.valueOf(0);
1057                                    }
1058    
1059                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_DP,
1060                                            finderArgs, count);
1061    
1062                                    closeSession(session);
1063                            }
1064                    }
1065    
1066                    return count.intValue();
1067            }
1068    
1069            /**
1070             * Returns the number of password policies where companyId = &#63; and name = &#63;.
1071             *
1072             * @param companyId the company ID
1073             * @param name the name
1074             * @return the number of matching password policies
1075             * @throws SystemException if a system exception occurred
1076             */
1077            public int countByC_N(long companyId, String name)
1078                    throws SystemException {
1079                    Object[] finderArgs = new Object[] { companyId, name };
1080    
1081                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_N,
1082                                    finderArgs, this);
1083    
1084                    if (count == null) {
1085                            StringBundler query = new StringBundler(3);
1086    
1087                            query.append(_SQL_COUNT_PASSWORDPOLICY_WHERE);
1088    
1089                            query.append(_FINDER_COLUMN_C_N_COMPANYID_2);
1090    
1091                            if (name == null) {
1092                                    query.append(_FINDER_COLUMN_C_N_NAME_1);
1093                            }
1094                            else {
1095                                    if (name.equals(StringPool.BLANK)) {
1096                                            query.append(_FINDER_COLUMN_C_N_NAME_3);
1097                                    }
1098                                    else {
1099                                            query.append(_FINDER_COLUMN_C_N_NAME_2);
1100                                    }
1101                            }
1102    
1103                            String sql = query.toString();
1104    
1105                            Session session = null;
1106    
1107                            try {
1108                                    session = openSession();
1109    
1110                                    Query q = session.createQuery(sql);
1111    
1112                                    QueryPos qPos = QueryPos.getInstance(q);
1113    
1114                                    qPos.add(companyId);
1115    
1116                                    if (name != null) {
1117                                            qPos.add(name);
1118                                    }
1119    
1120                                    count = (Long)q.uniqueResult();
1121                            }
1122                            catch (Exception e) {
1123                                    throw processException(e);
1124                            }
1125                            finally {
1126                                    if (count == null) {
1127                                            count = Long.valueOf(0);
1128                                    }
1129    
1130                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_N, finderArgs,
1131                                            count);
1132    
1133                                    closeSession(session);
1134                            }
1135                    }
1136    
1137                    return count.intValue();
1138            }
1139    
1140            /**
1141             * Returns the number of password policies.
1142             *
1143             * @return the number of password policies
1144             * @throws SystemException if a system exception occurred
1145             */
1146            public int countAll() throws SystemException {
1147                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1148                                    FINDER_ARGS_EMPTY, this);
1149    
1150                    if (count == null) {
1151                            Session session = null;
1152    
1153                            try {
1154                                    session = openSession();
1155    
1156                                    Query q = session.createQuery(_SQL_COUNT_PASSWORDPOLICY);
1157    
1158                                    count = (Long)q.uniqueResult();
1159                            }
1160                            catch (Exception e) {
1161                                    throw processException(e);
1162                            }
1163                            finally {
1164                                    if (count == null) {
1165                                            count = Long.valueOf(0);
1166                                    }
1167    
1168                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1169                                            FINDER_ARGS_EMPTY, count);
1170    
1171                                    closeSession(session);
1172                            }
1173                    }
1174    
1175                    return count.intValue();
1176            }
1177    
1178            /**
1179             * Initializes the password policy persistence.
1180             */
1181            public void afterPropertiesSet() {
1182                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1183                                            com.liferay.portal.util.PropsUtil.get(
1184                                                    "value.object.listener.com.liferay.portal.model.PasswordPolicy")));
1185    
1186                    if (listenerClassNames.length > 0) {
1187                            try {
1188                                    List<ModelListener<PasswordPolicy>> listenersList = new ArrayList<ModelListener<PasswordPolicy>>();
1189    
1190                                    for (String listenerClassName : listenerClassNames) {
1191                                            listenersList.add((ModelListener<PasswordPolicy>)InstanceFactory.newInstance(
1192                                                            listenerClassName));
1193                                    }
1194    
1195                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1196                            }
1197                            catch (Exception e) {
1198                                    _log.error(e);
1199                            }
1200                    }
1201            }
1202    
1203            public void destroy() {
1204                    EntityCacheUtil.removeCache(PasswordPolicyImpl.class.getName());
1205                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1206                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1207            }
1208    
1209            @BeanReference(type = AccountPersistence.class)
1210            protected AccountPersistence accountPersistence;
1211            @BeanReference(type = AddressPersistence.class)
1212            protected AddressPersistence addressPersistence;
1213            @BeanReference(type = BrowserTrackerPersistence.class)
1214            protected BrowserTrackerPersistence browserTrackerPersistence;
1215            @BeanReference(type = ClassNamePersistence.class)
1216            protected ClassNamePersistence classNamePersistence;
1217            @BeanReference(type = ClusterGroupPersistence.class)
1218            protected ClusterGroupPersistence clusterGroupPersistence;
1219            @BeanReference(type = CompanyPersistence.class)
1220            protected CompanyPersistence companyPersistence;
1221            @BeanReference(type = ContactPersistence.class)
1222            protected ContactPersistence contactPersistence;
1223            @BeanReference(type = CountryPersistence.class)
1224            protected CountryPersistence countryPersistence;
1225            @BeanReference(type = EmailAddressPersistence.class)
1226            protected EmailAddressPersistence emailAddressPersistence;
1227            @BeanReference(type = GroupPersistence.class)
1228            protected GroupPersistence groupPersistence;
1229            @BeanReference(type = ImagePersistence.class)
1230            protected ImagePersistence imagePersistence;
1231            @BeanReference(type = LayoutPersistence.class)
1232            protected LayoutPersistence layoutPersistence;
1233            @BeanReference(type = LayoutBranchPersistence.class)
1234            protected LayoutBranchPersistence layoutBranchPersistence;
1235            @BeanReference(type = LayoutPrototypePersistence.class)
1236            protected LayoutPrototypePersistence layoutPrototypePersistence;
1237            @BeanReference(type = LayoutRevisionPersistence.class)
1238            protected LayoutRevisionPersistence layoutRevisionPersistence;
1239            @BeanReference(type = LayoutSetPersistence.class)
1240            protected LayoutSetPersistence layoutSetPersistence;
1241            @BeanReference(type = LayoutSetBranchPersistence.class)
1242            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1243            @BeanReference(type = LayoutSetPrototypePersistence.class)
1244            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1245            @BeanReference(type = ListTypePersistence.class)
1246            protected ListTypePersistence listTypePersistence;
1247            @BeanReference(type = LockPersistence.class)
1248            protected LockPersistence lockPersistence;
1249            @BeanReference(type = MembershipRequestPersistence.class)
1250            protected MembershipRequestPersistence membershipRequestPersistence;
1251            @BeanReference(type = OrganizationPersistence.class)
1252            protected OrganizationPersistence organizationPersistence;
1253            @BeanReference(type = OrgGroupPermissionPersistence.class)
1254            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1255            @BeanReference(type = OrgGroupRolePersistence.class)
1256            protected OrgGroupRolePersistence orgGroupRolePersistence;
1257            @BeanReference(type = OrgLaborPersistence.class)
1258            protected OrgLaborPersistence orgLaborPersistence;
1259            @BeanReference(type = PasswordPolicyPersistence.class)
1260            protected PasswordPolicyPersistence passwordPolicyPersistence;
1261            @BeanReference(type = PasswordPolicyRelPersistence.class)
1262            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1263            @BeanReference(type = PasswordTrackerPersistence.class)
1264            protected PasswordTrackerPersistence passwordTrackerPersistence;
1265            @BeanReference(type = PermissionPersistence.class)
1266            protected PermissionPersistence permissionPersistence;
1267            @BeanReference(type = PhonePersistence.class)
1268            protected PhonePersistence phonePersistence;
1269            @BeanReference(type = PluginSettingPersistence.class)
1270            protected PluginSettingPersistence pluginSettingPersistence;
1271            @BeanReference(type = PortalPreferencesPersistence.class)
1272            protected PortalPreferencesPersistence portalPreferencesPersistence;
1273            @BeanReference(type = PortletPersistence.class)
1274            protected PortletPersistence portletPersistence;
1275            @BeanReference(type = PortletItemPersistence.class)
1276            protected PortletItemPersistence portletItemPersistence;
1277            @BeanReference(type = PortletPreferencesPersistence.class)
1278            protected PortletPreferencesPersistence portletPreferencesPersistence;
1279            @BeanReference(type = RegionPersistence.class)
1280            protected RegionPersistence regionPersistence;
1281            @BeanReference(type = ReleasePersistence.class)
1282            protected ReleasePersistence releasePersistence;
1283            @BeanReference(type = RepositoryPersistence.class)
1284            protected RepositoryPersistence repositoryPersistence;
1285            @BeanReference(type = RepositoryEntryPersistence.class)
1286            protected RepositoryEntryPersistence repositoryEntryPersistence;
1287            @BeanReference(type = ResourcePersistence.class)
1288            protected ResourcePersistence resourcePersistence;
1289            @BeanReference(type = ResourceActionPersistence.class)
1290            protected ResourceActionPersistence resourceActionPersistence;
1291            @BeanReference(type = ResourceBlockPersistence.class)
1292            protected ResourceBlockPersistence resourceBlockPersistence;
1293            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1294            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1295            @BeanReference(type = ResourceCodePersistence.class)
1296            protected ResourceCodePersistence resourceCodePersistence;
1297            @BeanReference(type = ResourcePermissionPersistence.class)
1298            protected ResourcePermissionPersistence resourcePermissionPersistence;
1299            @BeanReference(type = ResourceTypePermissionPersistence.class)
1300            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1301            @BeanReference(type = RolePersistence.class)
1302            protected RolePersistence rolePersistence;
1303            @BeanReference(type = ServiceComponentPersistence.class)
1304            protected ServiceComponentPersistence serviceComponentPersistence;
1305            @BeanReference(type = ShardPersistence.class)
1306            protected ShardPersistence shardPersistence;
1307            @BeanReference(type = SubscriptionPersistence.class)
1308            protected SubscriptionPersistence subscriptionPersistence;
1309            @BeanReference(type = TeamPersistence.class)
1310            protected TeamPersistence teamPersistence;
1311            @BeanReference(type = TicketPersistence.class)
1312            protected TicketPersistence ticketPersistence;
1313            @BeanReference(type = UserPersistence.class)
1314            protected UserPersistence userPersistence;
1315            @BeanReference(type = UserGroupPersistence.class)
1316            protected UserGroupPersistence userGroupPersistence;
1317            @BeanReference(type = UserGroupGroupRolePersistence.class)
1318            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1319            @BeanReference(type = UserGroupRolePersistence.class)
1320            protected UserGroupRolePersistence userGroupRolePersistence;
1321            @BeanReference(type = UserIdMapperPersistence.class)
1322            protected UserIdMapperPersistence userIdMapperPersistence;
1323            @BeanReference(type = UserNotificationEventPersistence.class)
1324            protected UserNotificationEventPersistence userNotificationEventPersistence;
1325            @BeanReference(type = UserTrackerPersistence.class)
1326            protected UserTrackerPersistence userTrackerPersistence;
1327            @BeanReference(type = UserTrackerPathPersistence.class)
1328            protected UserTrackerPathPersistence userTrackerPathPersistence;
1329            @BeanReference(type = VirtualHostPersistence.class)
1330            protected VirtualHostPersistence virtualHostPersistence;
1331            @BeanReference(type = WebDAVPropsPersistence.class)
1332            protected WebDAVPropsPersistence webDAVPropsPersistence;
1333            @BeanReference(type = WebsitePersistence.class)
1334            protected WebsitePersistence websitePersistence;
1335            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1336            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1337            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1338            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1339            private static final String _SQL_SELECT_PASSWORDPOLICY = "SELECT passwordPolicy FROM PasswordPolicy passwordPolicy";
1340            private static final String _SQL_SELECT_PASSWORDPOLICY_WHERE = "SELECT passwordPolicy FROM PasswordPolicy passwordPolicy WHERE ";
1341            private static final String _SQL_COUNT_PASSWORDPOLICY = "SELECT COUNT(passwordPolicy) FROM PasswordPolicy passwordPolicy";
1342            private static final String _SQL_COUNT_PASSWORDPOLICY_WHERE = "SELECT COUNT(passwordPolicy) FROM PasswordPolicy passwordPolicy WHERE ";
1343            private static final String _FINDER_COLUMN_C_DP_COMPANYID_2 = "passwordPolicy.companyId = ? AND ";
1344            private static final String _FINDER_COLUMN_C_DP_DEFAULTPOLICY_2 = "passwordPolicy.defaultPolicy = ?";
1345            private static final String _FINDER_COLUMN_C_N_COMPANYID_2 = "passwordPolicy.companyId = ? AND ";
1346            private static final String _FINDER_COLUMN_C_N_NAME_1 = "passwordPolicy.name IS NULL";
1347            private static final String _FINDER_COLUMN_C_N_NAME_2 = "passwordPolicy.name = ?";
1348            private static final String _FINDER_COLUMN_C_N_NAME_3 = "(passwordPolicy.name IS NULL OR passwordPolicy.name = ?)";
1349            private static final String _ORDER_BY_ENTITY_ALIAS = "passwordPolicy.";
1350            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PasswordPolicy exists with the primary key ";
1351            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PasswordPolicy exists with the key {";
1352            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1353            private static Log _log = LogFactoryUtil.getLog(PasswordPolicyPersistenceImpl.class);
1354            private static PasswordPolicy _nullPasswordPolicy = new PasswordPolicyImpl() {
1355                            @Override
1356                            public Object clone() {
1357                                    return this;
1358                            }
1359    
1360                            @Override
1361                            public CacheModel<PasswordPolicy> toCacheModel() {
1362                                    return _nullPasswordPolicyCacheModel;
1363                            }
1364                    };
1365    
1366            private static CacheModel<PasswordPolicy> _nullPasswordPolicyCacheModel = new CacheModel<PasswordPolicy>() {
1367                            public PasswordPolicy toEntityModel() {
1368                                    return _nullPasswordPolicy;
1369                            }
1370                    };
1371    }