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