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