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