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