001    /**
002     * Copyright (c) 2000-2011 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.NoSuchCompanyException;
018    import com.liferay.portal.NoSuchModelException;
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.model.Company;
039    import com.liferay.portal.model.ModelListener;
040    import com.liferay.portal.model.impl.CompanyImpl;
041    import com.liferay.portal.model.impl.CompanyModelImpl;
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 company service.
052     *
053     * <p>
054     * Never modify or reference this class directly. Always use {@link CompanyUtil} to access the company persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
055     * </p>
056     *
057     * <p>
058     * Caching information and settings can be found in <code>portal.properties</code>
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see CompanyPersistence
063     * @see CompanyUtil
064     * @generated
065     */
066    public class CompanyPersistenceImpl extends BasePersistenceImpl<Company>
067            implements CompanyPersistence {
068            public static final String FINDER_CLASS_NAME_ENTITY = CompanyImpl.class.getName();
069            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
070                    ".List";
071            public static final FinderPath FINDER_PATH_FETCH_BY_WEBID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
072                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
073                            "fetchByWebId", new String[] { String.class.getName() });
074            public static final FinderPath FINDER_PATH_COUNT_BY_WEBID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
075                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
076                            "countByWebId", new String[] { String.class.getName() });
077            public static final FinderPath FINDER_PATH_FETCH_BY_VIRTUALHOST = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
078                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
079                            "fetchByVirtualHost", new String[] { String.class.getName() });
080            public static final FinderPath FINDER_PATH_COUNT_BY_VIRTUALHOST = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
081                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
082                            "countByVirtualHost", new String[] { String.class.getName() });
083            public static final FinderPath FINDER_PATH_FETCH_BY_MX = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
084                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
085                            "fetchByMx", new String[] { String.class.getName() });
086            public static final FinderPath FINDER_PATH_COUNT_BY_MX = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
087                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
088                            "countByMx", new String[] { String.class.getName() });
089            public static final FinderPath FINDER_PATH_FETCH_BY_LOGOID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
090                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
091                            "fetchByLogoId", new String[] { Long.class.getName() });
092            public static final FinderPath FINDER_PATH_COUNT_BY_LOGOID = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
093                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
094                            "countByLogoId", new String[] { Long.class.getName() });
095            public static final FinderPath FINDER_PATH_FIND_BY_SYSTEM = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
096                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
097                            "findBySystem",
098                            new String[] {
099                                    Boolean.class.getName(),
100                                    
101                            "java.lang.Integer", "java.lang.Integer",
102                                    "com.liferay.portal.kernel.util.OrderByComparator"
103                            });
104            public static final FinderPath FINDER_PATH_COUNT_BY_SYSTEM = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
105                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
106                            "countBySystem", new String[] { Boolean.class.getName() });
107            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
108                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
109                            "findAll", new String[0]);
110            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(CompanyModelImpl.ENTITY_CACHE_ENABLED,
111                            CompanyModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
112                            "countAll", new String[0]);
113    
114            /**
115             * Caches the company in the entity cache if it is enabled.
116             *
117             * @param company the company to cache
118             */
119            public void cacheResult(Company company) {
120                    EntityCacheUtil.putResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
121                            CompanyImpl.class, company.getPrimaryKey(), company);
122    
123                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
124                            new Object[] { company.getWebId() }, company);
125    
126                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
127                            new Object[] { company.getVirtualHost() }, company);
128    
129                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
130                            new Object[] { company.getMx() }, company);
131    
132                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
133                            new Object[] { new Long(company.getLogoId()) }, company);
134            }
135    
136            /**
137             * Caches the companies in the entity cache if it is enabled.
138             *
139             * @param companies the companies to cache
140             */
141            public void cacheResult(List<Company> companies) {
142                    for (Company company : companies) {
143                            if (EntityCacheUtil.getResult(
144                                                    CompanyModelImpl.ENTITY_CACHE_ENABLED,
145                                                    CompanyImpl.class, company.getPrimaryKey(), this) == null) {
146                                    cacheResult(company);
147                            }
148                    }
149            }
150    
151            /**
152             * Clears the cache for all companies.
153             *
154             * <p>
155             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
156             * </p>
157             */
158            public void clearCache() {
159                    CacheRegistryUtil.clear(CompanyImpl.class.getName());
160                    EntityCacheUtil.clearCache(CompanyImpl.class.getName());
161                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
162                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
163            }
164    
165            /**
166             * Clears the cache for the company.
167             *
168             * <p>
169             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
170             * </p>
171             */
172            public void clearCache(Company company) {
173                    EntityCacheUtil.removeResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
174                            CompanyImpl.class, company.getPrimaryKey());
175    
176                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
177                            new Object[] { company.getWebId() });
178    
179                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
180                            new Object[] { company.getVirtualHost() });
181    
182                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
183                            new Object[] { company.getMx() });
184    
185                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
186                            new Object[] { new Long(company.getLogoId()) });
187            }
188    
189            /**
190             * Creates a new company with the primary key. Does not add the company to the database.
191             *
192             * @param companyId the primary key for the new company
193             * @return the new company
194             */
195            public Company create(long companyId) {
196                    Company company = new CompanyImpl();
197    
198                    company.setNew(true);
199                    company.setPrimaryKey(companyId);
200    
201                    return company;
202            }
203    
204            /**
205             * Removes the company with the primary key from the database. Also notifies the appropriate model listeners.
206             *
207             * @param primaryKey the primary key of the company to remove
208             * @return the company that was removed
209             * @throws com.liferay.portal.NoSuchModelException if a company with the primary key could not be found
210             * @throws SystemException if a system exception occurred
211             */
212            public Company remove(Serializable primaryKey)
213                    throws NoSuchModelException, SystemException {
214                    return remove(((Long)primaryKey).longValue());
215            }
216    
217            /**
218             * Removes the company with the primary key from the database. Also notifies the appropriate model listeners.
219             *
220             * @param companyId the primary key of the company to remove
221             * @return the company that was removed
222             * @throws com.liferay.portal.NoSuchCompanyException if a company with the primary key could not be found
223             * @throws SystemException if a system exception occurred
224             */
225            public Company remove(long companyId)
226                    throws NoSuchCompanyException, SystemException {
227                    Session session = null;
228    
229                    try {
230                            session = openSession();
231    
232                            Company company = (Company)session.get(CompanyImpl.class,
233                                            new Long(companyId));
234    
235                            if (company == null) {
236                                    if (_log.isWarnEnabled()) {
237                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + companyId);
238                                    }
239    
240                                    throw new NoSuchCompanyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
241                                            companyId);
242                            }
243    
244                            return remove(company);
245                    }
246                    catch (NoSuchCompanyException nsee) {
247                            throw nsee;
248                    }
249                    catch (Exception e) {
250                            throw processException(e);
251                    }
252                    finally {
253                            closeSession(session);
254                    }
255            }
256    
257            protected Company removeImpl(Company company) throws SystemException {
258                    company = toUnwrappedModel(company);
259    
260                    Session session = null;
261    
262                    try {
263                            session = openSession();
264    
265                            BatchSessionUtil.delete(session, company);
266                    }
267                    catch (Exception e) {
268                            throw processException(e);
269                    }
270                    finally {
271                            closeSession(session);
272                    }
273    
274                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
275    
276                    CompanyModelImpl companyModelImpl = (CompanyModelImpl)company;
277    
278                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
279                            new Object[] { companyModelImpl.getWebId() });
280    
281                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
282                            new Object[] { companyModelImpl.getVirtualHost() });
283    
284                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
285                            new Object[] { companyModelImpl.getMx() });
286    
287                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
288                            new Object[] { new Long(companyModelImpl.getLogoId()) });
289    
290                    EntityCacheUtil.removeResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
291                            CompanyImpl.class, company.getPrimaryKey());
292    
293                    return company;
294            }
295    
296            public Company updateImpl(com.liferay.portal.model.Company company,
297                    boolean merge) throws SystemException {
298                    company = toUnwrappedModel(company);
299    
300                    boolean isNew = company.isNew();
301    
302                    CompanyModelImpl companyModelImpl = (CompanyModelImpl)company;
303    
304                    Session session = null;
305    
306                    try {
307                            session = openSession();
308    
309                            BatchSessionUtil.update(session, company, merge);
310    
311                            company.setNew(false);
312                    }
313                    catch (Exception e) {
314                            throw processException(e);
315                    }
316                    finally {
317                            closeSession(session);
318                    }
319    
320                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
321    
322                    EntityCacheUtil.putResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
323                            CompanyImpl.class, company.getPrimaryKey(), company);
324    
325                    if (!isNew &&
326                                    (!Validator.equals(company.getWebId(),
327                                            companyModelImpl.getOriginalWebId()))) {
328                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
329                                    new Object[] { companyModelImpl.getOriginalWebId() });
330                    }
331    
332                    if (isNew ||
333                                    (!Validator.equals(company.getWebId(),
334                                            companyModelImpl.getOriginalWebId()))) {
335                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
336                                    new Object[] { company.getWebId() }, company);
337                    }
338    
339                    if (!isNew &&
340                                    (!Validator.equals(company.getVirtualHost(),
341                                            companyModelImpl.getOriginalVirtualHost()))) {
342                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
343                                    new Object[] { companyModelImpl.getOriginalVirtualHost() });
344                    }
345    
346                    if (isNew ||
347                                    (!Validator.equals(company.getVirtualHost(),
348                                            companyModelImpl.getOriginalVirtualHost()))) {
349                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
350                                    new Object[] { company.getVirtualHost() }, company);
351                    }
352    
353                    if (!isNew &&
354                                    (!Validator.equals(company.getMx(),
355                                            companyModelImpl.getOriginalMx()))) {
356                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
357                                    new Object[] { companyModelImpl.getOriginalMx() });
358                    }
359    
360                    if (isNew ||
361                                    (!Validator.equals(company.getMx(),
362                                            companyModelImpl.getOriginalMx()))) {
363                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
364                                    new Object[] { company.getMx() }, company);
365                    }
366    
367                    if (!isNew &&
368                                    (company.getLogoId() != companyModelImpl.getOriginalLogoId())) {
369                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
370                                    new Object[] { new Long(companyModelImpl.getOriginalLogoId()) });
371                    }
372    
373                    if (isNew ||
374                                    (company.getLogoId() != companyModelImpl.getOriginalLogoId())) {
375                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
376                                    new Object[] { new Long(company.getLogoId()) }, company);
377                    }
378    
379                    return company;
380            }
381    
382            protected Company toUnwrappedModel(Company company) {
383                    if (company instanceof CompanyImpl) {
384                            return company;
385                    }
386    
387                    CompanyImpl companyImpl = new CompanyImpl();
388    
389                    companyImpl.setNew(company.isNew());
390                    companyImpl.setPrimaryKey(company.getPrimaryKey());
391    
392                    companyImpl.setCompanyId(company.getCompanyId());
393                    companyImpl.setAccountId(company.getAccountId());
394                    companyImpl.setWebId(company.getWebId());
395                    companyImpl.setKey(company.getKey());
396                    companyImpl.setVirtualHost(company.getVirtualHost());
397                    companyImpl.setMx(company.getMx());
398                    companyImpl.setHomeURL(company.getHomeURL());
399                    companyImpl.setLogoId(company.getLogoId());
400                    companyImpl.setSystem(company.isSystem());
401                    companyImpl.setMaxUsers(company.getMaxUsers());
402    
403                    return companyImpl;
404            }
405    
406            /**
407             * Finds the company with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
408             *
409             * @param primaryKey the primary key of the company to find
410             * @return the company
411             * @throws com.liferay.portal.NoSuchModelException if a company with the primary key could not be found
412             * @throws SystemException if a system exception occurred
413             */
414            public Company findByPrimaryKey(Serializable primaryKey)
415                    throws NoSuchModelException, SystemException {
416                    return findByPrimaryKey(((Long)primaryKey).longValue());
417            }
418    
419            /**
420             * Finds the company with the primary key or throws a {@link com.liferay.portal.NoSuchCompanyException} if it could not be found.
421             *
422             * @param companyId the primary key of the company to find
423             * @return the company
424             * @throws com.liferay.portal.NoSuchCompanyException if a company with the primary key could not be found
425             * @throws SystemException if a system exception occurred
426             */
427            public Company findByPrimaryKey(long companyId)
428                    throws NoSuchCompanyException, SystemException {
429                    Company company = fetchByPrimaryKey(companyId);
430    
431                    if (company == null) {
432                            if (_log.isWarnEnabled()) {
433                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + companyId);
434                            }
435    
436                            throw new NoSuchCompanyException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
437                                    companyId);
438                    }
439    
440                    return company;
441            }
442    
443            /**
444             * Finds the company with the primary key or returns <code>null</code> if it could not be found.
445             *
446             * @param primaryKey the primary key of the company to find
447             * @return the company, or <code>null</code> if a company with the primary key could not be found
448             * @throws SystemException if a system exception occurred
449             */
450            public Company fetchByPrimaryKey(Serializable primaryKey)
451                    throws SystemException {
452                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
453            }
454    
455            /**
456             * Finds the company with the primary key or returns <code>null</code> if it could not be found.
457             *
458             * @param companyId the primary key of the company to find
459             * @return the company, or <code>null</code> if a company with the primary key could not be found
460             * @throws SystemException if a system exception occurred
461             */
462            public Company fetchByPrimaryKey(long companyId) throws SystemException {
463                    Company company = (Company)EntityCacheUtil.getResult(CompanyModelImpl.ENTITY_CACHE_ENABLED,
464                                    CompanyImpl.class, companyId, this);
465    
466                    if (company == null) {
467                            Session session = null;
468    
469                            try {
470                                    session = openSession();
471    
472                                    company = (Company)session.get(CompanyImpl.class,
473                                                    new Long(companyId));
474                            }
475                            catch (Exception e) {
476                                    throw processException(e);
477                            }
478                            finally {
479                                    if (company != null) {
480                                            cacheResult(company);
481                                    }
482    
483                                    closeSession(session);
484                            }
485                    }
486    
487                    return company;
488            }
489    
490            /**
491             * Finds the company where webId = &#63; or throws a {@link com.liferay.portal.NoSuchCompanyException} if it could not be found.
492             *
493             * @param webId the web id to search with
494             * @return the matching company
495             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
496             * @throws SystemException if a system exception occurred
497             */
498            public Company findByWebId(String webId)
499                    throws NoSuchCompanyException, SystemException {
500                    Company company = fetchByWebId(webId);
501    
502                    if (company == null) {
503                            StringBundler msg = new StringBundler(4);
504    
505                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
506    
507                            msg.append("webId=");
508                            msg.append(webId);
509    
510                            msg.append(StringPool.CLOSE_CURLY_BRACE);
511    
512                            if (_log.isWarnEnabled()) {
513                                    _log.warn(msg.toString());
514                            }
515    
516                            throw new NoSuchCompanyException(msg.toString());
517                    }
518    
519                    return company;
520            }
521    
522            /**
523             * Finds the company where webId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
524             *
525             * @param webId the web id to search with
526             * @return the matching company, or <code>null</code> if a matching company could not be found
527             * @throws SystemException if a system exception occurred
528             */
529            public Company fetchByWebId(String webId) throws SystemException {
530                    return fetchByWebId(webId, true);
531            }
532    
533            /**
534             * Finds the company where webId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
535             *
536             * @param webId the web id to search with
537             * @return the matching company, or <code>null</code> if a matching company could not be found
538             * @throws SystemException if a system exception occurred
539             */
540            public Company fetchByWebId(String webId, boolean retrieveFromCache)
541                    throws SystemException {
542                    Object[] finderArgs = new Object[] { webId };
543    
544                    Object result = null;
545    
546                    if (retrieveFromCache) {
547                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_WEBID,
548                                            finderArgs, this);
549                    }
550    
551                    if (result == null) {
552                            StringBundler query = new StringBundler(2);
553    
554                            query.append(_SQL_SELECT_COMPANY_WHERE);
555    
556                            if (webId == null) {
557                                    query.append(_FINDER_COLUMN_WEBID_WEBID_1);
558                            }
559                            else {
560                                    if (webId.equals(StringPool.BLANK)) {
561                                            query.append(_FINDER_COLUMN_WEBID_WEBID_3);
562                                    }
563                                    else {
564                                            query.append(_FINDER_COLUMN_WEBID_WEBID_2);
565                                    }
566                            }
567    
568                            String sql = query.toString();
569    
570                            Session session = null;
571    
572                            try {
573                                    session = openSession();
574    
575                                    Query q = session.createQuery(sql);
576    
577                                    QueryPos qPos = QueryPos.getInstance(q);
578    
579                                    if (webId != null) {
580                                            qPos.add(webId);
581                                    }
582    
583                                    List<Company> list = q.list();
584    
585                                    result = list;
586    
587                                    Company company = null;
588    
589                                    if (list.isEmpty()) {
590                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
591                                                    finderArgs, list);
592                                    }
593                                    else {
594                                            company = list.get(0);
595    
596                                            cacheResult(company);
597    
598                                            if ((company.getWebId() == null) ||
599                                                            !company.getWebId().equals(webId)) {
600                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_WEBID,
601                                                            finderArgs, company);
602                                            }
603                                    }
604    
605                                    return company;
606                            }
607                            catch (Exception e) {
608                                    throw processException(e);
609                            }
610                            finally {
611                                    if (result == null) {
612                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_WEBID,
613                                                    finderArgs);
614                                    }
615    
616                                    closeSession(session);
617                            }
618                    }
619                    else {
620                            if (result instanceof List<?>) {
621                                    return null;
622                            }
623                            else {
624                                    return (Company)result;
625                            }
626                    }
627            }
628    
629            /**
630             * Finds the company where virtualHost = &#63; or throws a {@link com.liferay.portal.NoSuchCompanyException} if it could not be found.
631             *
632             * @param virtualHost the virtual host to search with
633             * @return the matching company
634             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
635             * @throws SystemException if a system exception occurred
636             */
637            public Company findByVirtualHost(String virtualHost)
638                    throws NoSuchCompanyException, SystemException {
639                    Company company = fetchByVirtualHost(virtualHost);
640    
641                    if (company == null) {
642                            StringBundler msg = new StringBundler(4);
643    
644                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
645    
646                            msg.append("virtualHost=");
647                            msg.append(virtualHost);
648    
649                            msg.append(StringPool.CLOSE_CURLY_BRACE);
650    
651                            if (_log.isWarnEnabled()) {
652                                    _log.warn(msg.toString());
653                            }
654    
655                            throw new NoSuchCompanyException(msg.toString());
656                    }
657    
658                    return company;
659            }
660    
661            /**
662             * Finds the company where virtualHost = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
663             *
664             * @param virtualHost the virtual host to search with
665             * @return the matching company, or <code>null</code> if a matching company could not be found
666             * @throws SystemException if a system exception occurred
667             */
668            public Company fetchByVirtualHost(String virtualHost)
669                    throws SystemException {
670                    return fetchByVirtualHost(virtualHost, true);
671            }
672    
673            /**
674             * Finds the company where virtualHost = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
675             *
676             * @param virtualHost the virtual host to search with
677             * @return the matching company, or <code>null</code> if a matching company could not be found
678             * @throws SystemException if a system exception occurred
679             */
680            public Company fetchByVirtualHost(String virtualHost,
681                    boolean retrieveFromCache) throws SystemException {
682                    Object[] finderArgs = new Object[] { virtualHost };
683    
684                    Object result = null;
685    
686                    if (retrieveFromCache) {
687                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
688                                            finderArgs, this);
689                    }
690    
691                    if (result == null) {
692                            StringBundler query = new StringBundler(2);
693    
694                            query.append(_SQL_SELECT_COMPANY_WHERE);
695    
696                            if (virtualHost == null) {
697                                    query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1);
698                            }
699                            else {
700                                    if (virtualHost.equals(StringPool.BLANK)) {
701                                            query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3);
702                                    }
703                                    else {
704                                            query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2);
705                                    }
706                            }
707    
708                            String sql = query.toString();
709    
710                            Session session = null;
711    
712                            try {
713                                    session = openSession();
714    
715                                    Query q = session.createQuery(sql);
716    
717                                    QueryPos qPos = QueryPos.getInstance(q);
718    
719                                    if (virtualHost != null) {
720                                            qPos.add(virtualHost);
721                                    }
722    
723                                    List<Company> list = q.list();
724    
725                                    result = list;
726    
727                                    Company company = null;
728    
729                                    if (list.isEmpty()) {
730                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
731                                                    finderArgs, list);
732                                    }
733                                    else {
734                                            company = list.get(0);
735    
736                                            cacheResult(company);
737    
738                                            if ((company.getVirtualHost() == null) ||
739                                                            !company.getVirtualHost().equals(virtualHost)) {
740                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
741                                                            finderArgs, company);
742                                            }
743                                    }
744    
745                                    return company;
746                            }
747                            catch (Exception e) {
748                                    throw processException(e);
749                            }
750                            finally {
751                                    if (result == null) {
752                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
753                                                    finderArgs);
754                                    }
755    
756                                    closeSession(session);
757                            }
758                    }
759                    else {
760                            if (result instanceof List<?>) {
761                                    return null;
762                            }
763                            else {
764                                    return (Company)result;
765                            }
766                    }
767            }
768    
769            /**
770             * Finds the company where mx = &#63; or throws a {@link com.liferay.portal.NoSuchCompanyException} if it could not be found.
771             *
772             * @param mx the mx to search with
773             * @return the matching company
774             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
775             * @throws SystemException if a system exception occurred
776             */
777            public Company findByMx(String mx)
778                    throws NoSuchCompanyException, SystemException {
779                    Company company = fetchByMx(mx);
780    
781                    if (company == null) {
782                            StringBundler msg = new StringBundler(4);
783    
784                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
785    
786                            msg.append("mx=");
787                            msg.append(mx);
788    
789                            msg.append(StringPool.CLOSE_CURLY_BRACE);
790    
791                            if (_log.isWarnEnabled()) {
792                                    _log.warn(msg.toString());
793                            }
794    
795                            throw new NoSuchCompanyException(msg.toString());
796                    }
797    
798                    return company;
799            }
800    
801            /**
802             * Finds the company where mx = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
803             *
804             * @param mx the mx to search with
805             * @return the matching company, or <code>null</code> if a matching company could not be found
806             * @throws SystemException if a system exception occurred
807             */
808            public Company fetchByMx(String mx) throws SystemException {
809                    return fetchByMx(mx, true);
810            }
811    
812            /**
813             * Finds the company where mx = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
814             *
815             * @param mx the mx to search with
816             * @return the matching company, or <code>null</code> if a matching company could not be found
817             * @throws SystemException if a system exception occurred
818             */
819            public Company fetchByMx(String mx, boolean retrieveFromCache)
820                    throws SystemException {
821                    Object[] finderArgs = new Object[] { mx };
822    
823                    Object result = null;
824    
825                    if (retrieveFromCache) {
826                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_MX,
827                                            finderArgs, this);
828                    }
829    
830                    if (result == null) {
831                            StringBundler query = new StringBundler(2);
832    
833                            query.append(_SQL_SELECT_COMPANY_WHERE);
834    
835                            if (mx == null) {
836                                    query.append(_FINDER_COLUMN_MX_MX_1);
837                            }
838                            else {
839                                    if (mx.equals(StringPool.BLANK)) {
840                                            query.append(_FINDER_COLUMN_MX_MX_3);
841                                    }
842                                    else {
843                                            query.append(_FINDER_COLUMN_MX_MX_2);
844                                    }
845                            }
846    
847                            String sql = query.toString();
848    
849                            Session session = null;
850    
851                            try {
852                                    session = openSession();
853    
854                                    Query q = session.createQuery(sql);
855    
856                                    QueryPos qPos = QueryPos.getInstance(q);
857    
858                                    if (mx != null) {
859                                            qPos.add(mx);
860                                    }
861    
862                                    List<Company> list = q.list();
863    
864                                    result = list;
865    
866                                    Company company = null;
867    
868                                    if (list.isEmpty()) {
869                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
870                                                    finderArgs, list);
871                                    }
872                                    else {
873                                            company = list.get(0);
874    
875                                            cacheResult(company);
876    
877                                            if ((company.getMx() == null) ||
878                                                            !company.getMx().equals(mx)) {
879                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_MX,
880                                                            finderArgs, company);
881                                            }
882                                    }
883    
884                                    return company;
885                            }
886                            catch (Exception e) {
887                                    throw processException(e);
888                            }
889                            finally {
890                                    if (result == null) {
891                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
892                                                    finderArgs);
893                                    }
894    
895                                    closeSession(session);
896                            }
897                    }
898                    else {
899                            if (result instanceof List<?>) {
900                                    return null;
901                            }
902                            else {
903                                    return (Company)result;
904                            }
905                    }
906            }
907    
908            /**
909             * Finds the company where logoId = &#63; or throws a {@link com.liferay.portal.NoSuchCompanyException} if it could not be found.
910             *
911             * @param logoId the logo id to search with
912             * @return the matching company
913             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
914             * @throws SystemException if a system exception occurred
915             */
916            public Company findByLogoId(long logoId)
917                    throws NoSuchCompanyException, SystemException {
918                    Company company = fetchByLogoId(logoId);
919    
920                    if (company == null) {
921                            StringBundler msg = new StringBundler(4);
922    
923                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
924    
925                            msg.append("logoId=");
926                            msg.append(logoId);
927    
928                            msg.append(StringPool.CLOSE_CURLY_BRACE);
929    
930                            if (_log.isWarnEnabled()) {
931                                    _log.warn(msg.toString());
932                            }
933    
934                            throw new NoSuchCompanyException(msg.toString());
935                    }
936    
937                    return company;
938            }
939    
940            /**
941             * Finds the company where logoId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
942             *
943             * @param logoId the logo id to search with
944             * @return the matching company, or <code>null</code> if a matching company could not be found
945             * @throws SystemException if a system exception occurred
946             */
947            public Company fetchByLogoId(long logoId) throws SystemException {
948                    return fetchByLogoId(logoId, true);
949            }
950    
951            /**
952             * Finds the company where logoId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
953             *
954             * @param logoId the logo id to search with
955             * @return the matching company, or <code>null</code> if a matching company could not be found
956             * @throws SystemException if a system exception occurred
957             */
958            public Company fetchByLogoId(long logoId, boolean retrieveFromCache)
959                    throws SystemException {
960                    Object[] finderArgs = new Object[] { logoId };
961    
962                    Object result = null;
963    
964                    if (retrieveFromCache) {
965                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_LOGOID,
966                                            finderArgs, this);
967                    }
968    
969                    if (result == null) {
970                            StringBundler query = new StringBundler(2);
971    
972                            query.append(_SQL_SELECT_COMPANY_WHERE);
973    
974                            query.append(_FINDER_COLUMN_LOGOID_LOGOID_2);
975    
976                            String sql = query.toString();
977    
978                            Session session = null;
979    
980                            try {
981                                    session = openSession();
982    
983                                    Query q = session.createQuery(sql);
984    
985                                    QueryPos qPos = QueryPos.getInstance(q);
986    
987                                    qPos.add(logoId);
988    
989                                    List<Company> list = q.list();
990    
991                                    result = list;
992    
993                                    Company company = null;
994    
995                                    if (list.isEmpty()) {
996                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
997                                                    finderArgs, list);
998                                    }
999                                    else {
1000                                            company = list.get(0);
1001    
1002                                            cacheResult(company);
1003    
1004                                            if ((company.getLogoId() != logoId)) {
1005                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_LOGOID,
1006                                                            finderArgs, company);
1007                                            }
1008                                    }
1009    
1010                                    return company;
1011                            }
1012                            catch (Exception e) {
1013                                    throw processException(e);
1014                            }
1015                            finally {
1016                                    if (result == null) {
1017                                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
1018                                                    finderArgs);
1019                                    }
1020    
1021                                    closeSession(session);
1022                            }
1023                    }
1024                    else {
1025                            if (result instanceof List<?>) {
1026                                    return null;
1027                            }
1028                            else {
1029                                    return (Company)result;
1030                            }
1031                    }
1032            }
1033    
1034            /**
1035             * Finds all the companies where system = &#63;.
1036             *
1037             * @param system the system to search with
1038             * @return the matching companies
1039             * @throws SystemException if a system exception occurred
1040             */
1041            public List<Company> findBySystem(boolean system) throws SystemException {
1042                    return findBySystem(system, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1043            }
1044    
1045            /**
1046             * Finds a range of all the companies where system = &#63;.
1047             *
1048             * <p>
1049             * 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.
1050             * </p>
1051             *
1052             * @param system the system to search with
1053             * @param start the lower bound of the range of companies to return
1054             * @param end the upper bound of the range of companies to return (not inclusive)
1055             * @return the range of matching companies
1056             * @throws SystemException if a system exception occurred
1057             */
1058            public List<Company> findBySystem(boolean system, int start, int end)
1059                    throws SystemException {
1060                    return findBySystem(system, start, end, null);
1061            }
1062    
1063            /**
1064             * Finds an ordered range of all the companies where system = &#63;.
1065             *
1066             * <p>
1067             * 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.
1068             * </p>
1069             *
1070             * @param system the system to search with
1071             * @param start the lower bound of the range of companies to return
1072             * @param end the upper bound of the range of companies to return (not inclusive)
1073             * @param orderByComparator the comparator to order the results by
1074             * @return the ordered range of matching companies
1075             * @throws SystemException if a system exception occurred
1076             */
1077            public List<Company> findBySystem(boolean system, int start, int end,
1078                    OrderByComparator orderByComparator) throws SystemException {
1079                    Object[] finderArgs = new Object[] {
1080                                    system,
1081                                    
1082                                    String.valueOf(start), String.valueOf(end),
1083                                    String.valueOf(orderByComparator)
1084                            };
1085    
1086                    List<Company> list = (List<Company>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_SYSTEM,
1087                                    finderArgs, this);
1088    
1089                    if (list == null) {
1090                            StringBundler query = null;
1091    
1092                            if (orderByComparator != null) {
1093                                    query = new StringBundler(3 +
1094                                                    (orderByComparator.getOrderByFields().length * 3));
1095                            }
1096                            else {
1097                                    query = new StringBundler(2);
1098                            }
1099    
1100                            query.append(_SQL_SELECT_COMPANY_WHERE);
1101    
1102                            query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1103    
1104                            if (orderByComparator != null) {
1105                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1106                                            orderByComparator);
1107                            }
1108    
1109                            String sql = query.toString();
1110    
1111                            Session session = null;
1112    
1113                            try {
1114                                    session = openSession();
1115    
1116                                    Query q = session.createQuery(sql);
1117    
1118                                    QueryPos qPos = QueryPos.getInstance(q);
1119    
1120                                    qPos.add(system);
1121    
1122                                    list = (List<Company>)QueryUtil.list(q, getDialect(), start, end);
1123                            }
1124                            catch (Exception e) {
1125                                    throw processException(e);
1126                            }
1127                            finally {
1128                                    if (list == null) {
1129                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_SYSTEM,
1130                                                    finderArgs);
1131                                    }
1132                                    else {
1133                                            cacheResult(list);
1134    
1135                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_SYSTEM,
1136                                                    finderArgs, list);
1137                                    }
1138    
1139                                    closeSession(session);
1140                            }
1141                    }
1142    
1143                    return list;
1144            }
1145    
1146            /**
1147             * Finds the first company in the ordered set where system = &#63;.
1148             *
1149             * <p>
1150             * 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.
1151             * </p>
1152             *
1153             * @param system the system to search with
1154             * @param orderByComparator the comparator to order the set by
1155             * @return the first matching company
1156             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
1157             * @throws SystemException if a system exception occurred
1158             */
1159            public Company findBySystem_First(boolean system,
1160                    OrderByComparator orderByComparator)
1161                    throws NoSuchCompanyException, SystemException {
1162                    List<Company> list = findBySystem(system, 0, 1, orderByComparator);
1163    
1164                    if (list.isEmpty()) {
1165                            StringBundler msg = new StringBundler(4);
1166    
1167                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1168    
1169                            msg.append("system=");
1170                            msg.append(system);
1171    
1172                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1173    
1174                            throw new NoSuchCompanyException(msg.toString());
1175                    }
1176                    else {
1177                            return list.get(0);
1178                    }
1179            }
1180    
1181            /**
1182             * Finds the last company in the ordered set where system = &#63;.
1183             *
1184             * <p>
1185             * 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.
1186             * </p>
1187             *
1188             * @param system the system to search with
1189             * @param orderByComparator the comparator to order the set by
1190             * @return the last matching company
1191             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
1192             * @throws SystemException if a system exception occurred
1193             */
1194            public Company findBySystem_Last(boolean system,
1195                    OrderByComparator orderByComparator)
1196                    throws NoSuchCompanyException, SystemException {
1197                    int count = countBySystem(system);
1198    
1199                    List<Company> list = findBySystem(system, count - 1, count,
1200                                    orderByComparator);
1201    
1202                    if (list.isEmpty()) {
1203                            StringBundler msg = new StringBundler(4);
1204    
1205                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1206    
1207                            msg.append("system=");
1208                            msg.append(system);
1209    
1210                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1211    
1212                            throw new NoSuchCompanyException(msg.toString());
1213                    }
1214                    else {
1215                            return list.get(0);
1216                    }
1217            }
1218    
1219            /**
1220             * Finds the companies before and after the current company in the ordered set where system = &#63;.
1221             *
1222             * <p>
1223             * 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.
1224             * </p>
1225             *
1226             * @param companyId the primary key of the current company
1227             * @param system the system to search with
1228             * @param orderByComparator the comparator to order the set by
1229             * @return the previous, current, and next company
1230             * @throws com.liferay.portal.NoSuchCompanyException if a company with the primary key could not be found
1231             * @throws SystemException if a system exception occurred
1232             */
1233            public Company[] findBySystem_PrevAndNext(long companyId, boolean system,
1234                    OrderByComparator orderByComparator)
1235                    throws NoSuchCompanyException, SystemException {
1236                    Company company = findByPrimaryKey(companyId);
1237    
1238                    Session session = null;
1239    
1240                    try {
1241                            session = openSession();
1242    
1243                            Company[] array = new CompanyImpl[3];
1244    
1245                            array[0] = getBySystem_PrevAndNext(session, company, system,
1246                                            orderByComparator, true);
1247    
1248                            array[1] = company;
1249    
1250                            array[2] = getBySystem_PrevAndNext(session, company, system,
1251                                            orderByComparator, false);
1252    
1253                            return array;
1254                    }
1255                    catch (Exception e) {
1256                            throw processException(e);
1257                    }
1258                    finally {
1259                            closeSession(session);
1260                    }
1261            }
1262    
1263            protected Company getBySystem_PrevAndNext(Session session, Company company,
1264                    boolean system, OrderByComparator orderByComparator, boolean previous) {
1265                    StringBundler query = null;
1266    
1267                    if (orderByComparator != null) {
1268                            query = new StringBundler(6 +
1269                                            (orderByComparator.getOrderByFields().length * 6));
1270                    }
1271                    else {
1272                            query = new StringBundler(3);
1273                    }
1274    
1275                    query.append(_SQL_SELECT_COMPANY_WHERE);
1276    
1277                    query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1278    
1279                    if (orderByComparator != null) {
1280                            String[] orderByFields = orderByComparator.getOrderByFields();
1281    
1282                            if (orderByFields.length > 0) {
1283                                    query.append(WHERE_AND);
1284                            }
1285    
1286                            for (int i = 0; i < orderByFields.length; i++) {
1287                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1288                                    query.append(orderByFields[i]);
1289    
1290                                    if ((i + 1) < orderByFields.length) {
1291                                            if (orderByComparator.isAscending() ^ previous) {
1292                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1293                                            }
1294                                            else {
1295                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1296                                            }
1297                                    }
1298                                    else {
1299                                            if (orderByComparator.isAscending() ^ previous) {
1300                                                    query.append(WHERE_GREATER_THAN);
1301                                            }
1302                                            else {
1303                                                    query.append(WHERE_LESSER_THAN);
1304                                            }
1305                                    }
1306                            }
1307    
1308                            query.append(ORDER_BY_CLAUSE);
1309    
1310                            for (int i = 0; i < orderByFields.length; i++) {
1311                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1312                                    query.append(orderByFields[i]);
1313    
1314                                    if ((i + 1) < orderByFields.length) {
1315                                            if (orderByComparator.isAscending() ^ previous) {
1316                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1317                                            }
1318                                            else {
1319                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1320                                            }
1321                                    }
1322                                    else {
1323                                            if (orderByComparator.isAscending() ^ previous) {
1324                                                    query.append(ORDER_BY_ASC);
1325                                            }
1326                                            else {
1327                                                    query.append(ORDER_BY_DESC);
1328                                            }
1329                                    }
1330                            }
1331                    }
1332    
1333                    String sql = query.toString();
1334    
1335                    Query q = session.createQuery(sql);
1336    
1337                    q.setFirstResult(0);
1338                    q.setMaxResults(2);
1339    
1340                    QueryPos qPos = QueryPos.getInstance(q);
1341    
1342                    qPos.add(system);
1343    
1344                    if (orderByComparator != null) {
1345                            Object[] values = orderByComparator.getOrderByValues(company);
1346    
1347                            for (Object value : values) {
1348                                    qPos.add(value);
1349                            }
1350                    }
1351    
1352                    List<Company> list = q.list();
1353    
1354                    if (list.size() == 2) {
1355                            return list.get(1);
1356                    }
1357                    else {
1358                            return null;
1359                    }
1360            }
1361    
1362            /**
1363             * Finds all the companies.
1364             *
1365             * @return the companies
1366             * @throws SystemException if a system exception occurred
1367             */
1368            public List<Company> findAll() throws SystemException {
1369                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1370            }
1371    
1372            /**
1373             * Finds a range of all the companies.
1374             *
1375             * <p>
1376             * 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.
1377             * </p>
1378             *
1379             * @param start the lower bound of the range of companies to return
1380             * @param end the upper bound of the range of companies to return (not inclusive)
1381             * @return the range of companies
1382             * @throws SystemException if a system exception occurred
1383             */
1384            public List<Company> findAll(int start, int end) throws SystemException {
1385                    return findAll(start, end, null);
1386            }
1387    
1388            /**
1389             * Finds an ordered range of all the companies.
1390             *
1391             * <p>
1392             * 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.
1393             * </p>
1394             *
1395             * @param start the lower bound of the range of companies to return
1396             * @param end the upper bound of the range of companies to return (not inclusive)
1397             * @param orderByComparator the comparator to order the results by
1398             * @return the ordered range of companies
1399             * @throws SystemException if a system exception occurred
1400             */
1401            public List<Company> findAll(int start, int end,
1402                    OrderByComparator orderByComparator) throws SystemException {
1403                    Object[] finderArgs = new Object[] {
1404                                    String.valueOf(start), String.valueOf(end),
1405                                    String.valueOf(orderByComparator)
1406                            };
1407    
1408                    List<Company> list = (List<Company>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1409                                    finderArgs, this);
1410    
1411                    if (list == null) {
1412                            StringBundler query = null;
1413                            String sql = null;
1414    
1415                            if (orderByComparator != null) {
1416                                    query = new StringBundler(2 +
1417                                                    (orderByComparator.getOrderByFields().length * 3));
1418    
1419                                    query.append(_SQL_SELECT_COMPANY);
1420    
1421                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1422                                            orderByComparator);
1423    
1424                                    sql = query.toString();
1425                            }
1426                            else {
1427                                    sql = _SQL_SELECT_COMPANY;
1428                            }
1429    
1430                            Session session = null;
1431    
1432                            try {
1433                                    session = openSession();
1434    
1435                                    Query q = session.createQuery(sql);
1436    
1437                                    if (orderByComparator == null) {
1438                                            list = (List<Company>)QueryUtil.list(q, getDialect(),
1439                                                            start, end, false);
1440    
1441                                            Collections.sort(list);
1442                                    }
1443                                    else {
1444                                            list = (List<Company>)QueryUtil.list(q, getDialect(),
1445                                                            start, end);
1446                                    }
1447                            }
1448                            catch (Exception e) {
1449                                    throw processException(e);
1450                            }
1451                            finally {
1452                                    if (list == null) {
1453                                            FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
1454                                                    finderArgs);
1455                                    }
1456                                    else {
1457                                            cacheResult(list);
1458    
1459                                            FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
1460                                                    list);
1461                                    }
1462    
1463                                    closeSession(session);
1464                            }
1465                    }
1466    
1467                    return list;
1468            }
1469    
1470            /**
1471             * Removes the company where webId = &#63; from the database.
1472             *
1473             * @param webId the web id to search with
1474             * @throws SystemException if a system exception occurred
1475             */
1476            public void removeByWebId(String webId)
1477                    throws NoSuchCompanyException, SystemException {
1478                    Company company = findByWebId(webId);
1479    
1480                    remove(company);
1481            }
1482    
1483            /**
1484             * Removes the company where virtualHost = &#63; from the database.
1485             *
1486             * @param virtualHost the virtual host to search with
1487             * @throws SystemException if a system exception occurred
1488             */
1489            public void removeByVirtualHost(String virtualHost)
1490                    throws NoSuchCompanyException, SystemException {
1491                    Company company = findByVirtualHost(virtualHost);
1492    
1493                    remove(company);
1494            }
1495    
1496            /**
1497             * Removes the company where mx = &#63; from the database.
1498             *
1499             * @param mx the mx to search with
1500             * @throws SystemException if a system exception occurred
1501             */
1502            public void removeByMx(String mx)
1503                    throws NoSuchCompanyException, SystemException {
1504                    Company company = findByMx(mx);
1505    
1506                    remove(company);
1507            }
1508    
1509            /**
1510             * Removes the company where logoId = &#63; from the database.
1511             *
1512             * @param logoId the logo id to search with
1513             * @throws SystemException if a system exception occurred
1514             */
1515            public void removeByLogoId(long logoId)
1516                    throws NoSuchCompanyException, SystemException {
1517                    Company company = findByLogoId(logoId);
1518    
1519                    remove(company);
1520            }
1521    
1522            /**
1523             * Removes all the companies where system = &#63; from the database.
1524             *
1525             * @param system the system to search with
1526             * @throws SystemException if a system exception occurred
1527             */
1528            public void removeBySystem(boolean system) throws SystemException {
1529                    for (Company company : findBySystem(system)) {
1530                            remove(company);
1531                    }
1532            }
1533    
1534            /**
1535             * Removes all the companies from the database.
1536             *
1537             * @throws SystemException if a system exception occurred
1538             */
1539            public void removeAll() throws SystemException {
1540                    for (Company company : findAll()) {
1541                            remove(company);
1542                    }
1543            }
1544    
1545            /**
1546             * Counts all the companies where webId = &#63;.
1547             *
1548             * @param webId the web id to search with
1549             * @return the number of matching companies
1550             * @throws SystemException if a system exception occurred
1551             */
1552            public int countByWebId(String webId) throws SystemException {
1553                    Object[] finderArgs = new Object[] { webId };
1554    
1555                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_WEBID,
1556                                    finderArgs, this);
1557    
1558                    if (count == null) {
1559                            StringBundler query = new StringBundler(2);
1560    
1561                            query.append(_SQL_COUNT_COMPANY_WHERE);
1562    
1563                            if (webId == null) {
1564                                    query.append(_FINDER_COLUMN_WEBID_WEBID_1);
1565                            }
1566                            else {
1567                                    if (webId.equals(StringPool.BLANK)) {
1568                                            query.append(_FINDER_COLUMN_WEBID_WEBID_3);
1569                                    }
1570                                    else {
1571                                            query.append(_FINDER_COLUMN_WEBID_WEBID_2);
1572                                    }
1573                            }
1574    
1575                            String sql = query.toString();
1576    
1577                            Session session = null;
1578    
1579                            try {
1580                                    session = openSession();
1581    
1582                                    Query q = session.createQuery(sql);
1583    
1584                                    QueryPos qPos = QueryPos.getInstance(q);
1585    
1586                                    if (webId != null) {
1587                                            qPos.add(webId);
1588                                    }
1589    
1590                                    count = (Long)q.uniqueResult();
1591                            }
1592                            catch (Exception e) {
1593                                    throw processException(e);
1594                            }
1595                            finally {
1596                                    if (count == null) {
1597                                            count = Long.valueOf(0);
1598                                    }
1599    
1600                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_WEBID,
1601                                            finderArgs, count);
1602    
1603                                    closeSession(session);
1604                            }
1605                    }
1606    
1607                    return count.intValue();
1608            }
1609    
1610            /**
1611             * Counts all the companies where virtualHost = &#63;.
1612             *
1613             * @param virtualHost the virtual host to search with
1614             * @return the number of matching companies
1615             * @throws SystemException if a system exception occurred
1616             */
1617            public int countByVirtualHost(String virtualHost) throws SystemException {
1618                    Object[] finderArgs = new Object[] { virtualHost };
1619    
1620                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1621                                    finderArgs, this);
1622    
1623                    if (count == null) {
1624                            StringBundler query = new StringBundler(2);
1625    
1626                            query.append(_SQL_COUNT_COMPANY_WHERE);
1627    
1628                            if (virtualHost == null) {
1629                                    query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1);
1630                            }
1631                            else {
1632                                    if (virtualHost.equals(StringPool.BLANK)) {
1633                                            query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3);
1634                                    }
1635                                    else {
1636                                            query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2);
1637                                    }
1638                            }
1639    
1640                            String sql = query.toString();
1641    
1642                            Session session = null;
1643    
1644                            try {
1645                                    session = openSession();
1646    
1647                                    Query q = session.createQuery(sql);
1648    
1649                                    QueryPos qPos = QueryPos.getInstance(q);
1650    
1651                                    if (virtualHost != null) {
1652                                            qPos.add(virtualHost);
1653                                    }
1654    
1655                                    count = (Long)q.uniqueResult();
1656                            }
1657                            catch (Exception e) {
1658                                    throw processException(e);
1659                            }
1660                            finally {
1661                                    if (count == null) {
1662                                            count = Long.valueOf(0);
1663                                    }
1664    
1665                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1666                                            finderArgs, count);
1667    
1668                                    closeSession(session);
1669                            }
1670                    }
1671    
1672                    return count.intValue();
1673            }
1674    
1675            /**
1676             * Counts all the companies where mx = &#63;.
1677             *
1678             * @param mx the mx to search with
1679             * @return the number of matching companies
1680             * @throws SystemException if a system exception occurred
1681             */
1682            public int countByMx(String mx) throws SystemException {
1683                    Object[] finderArgs = new Object[] { mx };
1684    
1685                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_MX,
1686                                    finderArgs, this);
1687    
1688                    if (count == null) {
1689                            StringBundler query = new StringBundler(2);
1690    
1691                            query.append(_SQL_COUNT_COMPANY_WHERE);
1692    
1693                            if (mx == null) {
1694                                    query.append(_FINDER_COLUMN_MX_MX_1);
1695                            }
1696                            else {
1697                                    if (mx.equals(StringPool.BLANK)) {
1698                                            query.append(_FINDER_COLUMN_MX_MX_3);
1699                                    }
1700                                    else {
1701                                            query.append(_FINDER_COLUMN_MX_MX_2);
1702                                    }
1703                            }
1704    
1705                            String sql = query.toString();
1706    
1707                            Session session = null;
1708    
1709                            try {
1710                                    session = openSession();
1711    
1712                                    Query q = session.createQuery(sql);
1713    
1714                                    QueryPos qPos = QueryPos.getInstance(q);
1715    
1716                                    if (mx != null) {
1717                                            qPos.add(mx);
1718                                    }
1719    
1720                                    count = (Long)q.uniqueResult();
1721                            }
1722                            catch (Exception e) {
1723                                    throw processException(e);
1724                            }
1725                            finally {
1726                                    if (count == null) {
1727                                            count = Long.valueOf(0);
1728                                    }
1729    
1730                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_MX, finderArgs,
1731                                            count);
1732    
1733                                    closeSession(session);
1734                            }
1735                    }
1736    
1737                    return count.intValue();
1738            }
1739    
1740            /**
1741             * Counts all the companies where logoId = &#63;.
1742             *
1743             * @param logoId the logo id to search with
1744             * @return the number of matching companies
1745             * @throws SystemException if a system exception occurred
1746             */
1747            public int countByLogoId(long logoId) throws SystemException {
1748                    Object[] finderArgs = new Object[] { logoId };
1749    
1750                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LOGOID,
1751                                    finderArgs, this);
1752    
1753                    if (count == null) {
1754                            StringBundler query = new StringBundler(2);
1755    
1756                            query.append(_SQL_COUNT_COMPANY_WHERE);
1757    
1758                            query.append(_FINDER_COLUMN_LOGOID_LOGOID_2);
1759    
1760                            String sql = query.toString();
1761    
1762                            Session session = null;
1763    
1764                            try {
1765                                    session = openSession();
1766    
1767                                    Query q = session.createQuery(sql);
1768    
1769                                    QueryPos qPos = QueryPos.getInstance(q);
1770    
1771                                    qPos.add(logoId);
1772    
1773                                    count = (Long)q.uniqueResult();
1774                            }
1775                            catch (Exception e) {
1776                                    throw processException(e);
1777                            }
1778                            finally {
1779                                    if (count == null) {
1780                                            count = Long.valueOf(0);
1781                                    }
1782    
1783                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LOGOID,
1784                                            finderArgs, count);
1785    
1786                                    closeSession(session);
1787                            }
1788                    }
1789    
1790                    return count.intValue();
1791            }
1792    
1793            /**
1794             * Counts all the companies where system = &#63;.
1795             *
1796             * @param system the system to search with
1797             * @return the number of matching companies
1798             * @throws SystemException if a system exception occurred
1799             */
1800            public int countBySystem(boolean system) throws SystemException {
1801                    Object[] finderArgs = new Object[] { system };
1802    
1803                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SYSTEM,
1804                                    finderArgs, this);
1805    
1806                    if (count == null) {
1807                            StringBundler query = new StringBundler(2);
1808    
1809                            query.append(_SQL_COUNT_COMPANY_WHERE);
1810    
1811                            query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1812    
1813                            String sql = query.toString();
1814    
1815                            Session session = null;
1816    
1817                            try {
1818                                    session = openSession();
1819    
1820                                    Query q = session.createQuery(sql);
1821    
1822                                    QueryPos qPos = QueryPos.getInstance(q);
1823    
1824                                    qPos.add(system);
1825    
1826                                    count = (Long)q.uniqueResult();
1827                            }
1828                            catch (Exception e) {
1829                                    throw processException(e);
1830                            }
1831                            finally {
1832                                    if (count == null) {
1833                                            count = Long.valueOf(0);
1834                                    }
1835    
1836                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SYSTEM,
1837                                            finderArgs, count);
1838    
1839                                    closeSession(session);
1840                            }
1841                    }
1842    
1843                    return count.intValue();
1844            }
1845    
1846            /**
1847             * Counts all the companies.
1848             *
1849             * @return the number of companies
1850             * @throws SystemException if a system exception occurred
1851             */
1852            public int countAll() throws SystemException {
1853                    Object[] finderArgs = new Object[0];
1854    
1855                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1856                                    finderArgs, this);
1857    
1858                    if (count == null) {
1859                            Session session = null;
1860    
1861                            try {
1862                                    session = openSession();
1863    
1864                                    Query q = session.createQuery(_SQL_COUNT_COMPANY);
1865    
1866                                    count = (Long)q.uniqueResult();
1867                            }
1868                            catch (Exception e) {
1869                                    throw processException(e);
1870                            }
1871                            finally {
1872                                    if (count == null) {
1873                                            count = Long.valueOf(0);
1874                                    }
1875    
1876                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1877                                            count);
1878    
1879                                    closeSession(session);
1880                            }
1881                    }
1882    
1883                    return count.intValue();
1884            }
1885    
1886            /**
1887             * Initializes the company persistence.
1888             */
1889            public void afterPropertiesSet() {
1890                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1891                                            com.liferay.portal.util.PropsUtil.get(
1892                                                    "value.object.listener.com.liferay.portal.model.Company")));
1893    
1894                    if (listenerClassNames.length > 0) {
1895                            try {
1896                                    List<ModelListener<Company>> listenersList = new ArrayList<ModelListener<Company>>();
1897    
1898                                    for (String listenerClassName : listenerClassNames) {
1899                                            listenersList.add((ModelListener<Company>)InstanceFactory.newInstance(
1900                                                            listenerClassName));
1901                                    }
1902    
1903                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1904                            }
1905                            catch (Exception e) {
1906                                    _log.error(e);
1907                            }
1908                    }
1909            }
1910    
1911            public void destroy() {
1912                    EntityCacheUtil.removeCache(CompanyImpl.class.getName());
1913                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1914                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
1915            }
1916    
1917            @BeanReference(type = AccountPersistence.class)
1918            protected AccountPersistence accountPersistence;
1919            @BeanReference(type = AddressPersistence.class)
1920            protected AddressPersistence addressPersistence;
1921            @BeanReference(type = BrowserTrackerPersistence.class)
1922            protected BrowserTrackerPersistence browserTrackerPersistence;
1923            @BeanReference(type = ClassNamePersistence.class)
1924            protected ClassNamePersistence classNamePersistence;
1925            @BeanReference(type = ClusterGroupPersistence.class)
1926            protected ClusterGroupPersistence clusterGroupPersistence;
1927            @BeanReference(type = CompanyPersistence.class)
1928            protected CompanyPersistence companyPersistence;
1929            @BeanReference(type = ContactPersistence.class)
1930            protected ContactPersistence contactPersistence;
1931            @BeanReference(type = CountryPersistence.class)
1932            protected CountryPersistence countryPersistence;
1933            @BeanReference(type = EmailAddressPersistence.class)
1934            protected EmailAddressPersistence emailAddressPersistence;
1935            @BeanReference(type = GroupPersistence.class)
1936            protected GroupPersistence groupPersistence;
1937            @BeanReference(type = ImagePersistence.class)
1938            protected ImagePersistence imagePersistence;
1939            @BeanReference(type = LayoutPersistence.class)
1940            protected LayoutPersistence layoutPersistence;
1941            @BeanReference(type = LayoutPrototypePersistence.class)
1942            protected LayoutPrototypePersistence layoutPrototypePersistence;
1943            @BeanReference(type = LayoutSetPersistence.class)
1944            protected LayoutSetPersistence layoutSetPersistence;
1945            @BeanReference(type = LayoutSetPrototypePersistence.class)
1946            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1947            @BeanReference(type = ListTypePersistence.class)
1948            protected ListTypePersistence listTypePersistence;
1949            @BeanReference(type = LockPersistence.class)
1950            protected LockPersistence lockPersistence;
1951            @BeanReference(type = MembershipRequestPersistence.class)
1952            protected MembershipRequestPersistence membershipRequestPersistence;
1953            @BeanReference(type = OrganizationPersistence.class)
1954            protected OrganizationPersistence organizationPersistence;
1955            @BeanReference(type = OrgGroupPermissionPersistence.class)
1956            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1957            @BeanReference(type = OrgGroupRolePersistence.class)
1958            protected OrgGroupRolePersistence orgGroupRolePersistence;
1959            @BeanReference(type = OrgLaborPersistence.class)
1960            protected OrgLaborPersistence orgLaborPersistence;
1961            @BeanReference(type = PasswordPolicyPersistence.class)
1962            protected PasswordPolicyPersistence passwordPolicyPersistence;
1963            @BeanReference(type = PasswordPolicyRelPersistence.class)
1964            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1965            @BeanReference(type = PasswordTrackerPersistence.class)
1966            protected PasswordTrackerPersistence passwordTrackerPersistence;
1967            @BeanReference(type = PermissionPersistence.class)
1968            protected PermissionPersistence permissionPersistence;
1969            @BeanReference(type = PhonePersistence.class)
1970            protected PhonePersistence phonePersistence;
1971            @BeanReference(type = PluginSettingPersistence.class)
1972            protected PluginSettingPersistence pluginSettingPersistence;
1973            @BeanReference(type = PortletPersistence.class)
1974            protected PortletPersistence portletPersistence;
1975            @BeanReference(type = PortletItemPersistence.class)
1976            protected PortletItemPersistence portletItemPersistence;
1977            @BeanReference(type = PortletPreferencesPersistence.class)
1978            protected PortletPreferencesPersistence portletPreferencesPersistence;
1979            @BeanReference(type = RegionPersistence.class)
1980            protected RegionPersistence regionPersistence;
1981            @BeanReference(type = ReleasePersistence.class)
1982            protected ReleasePersistence releasePersistence;
1983            @BeanReference(type = ResourcePersistence.class)
1984            protected ResourcePersistence resourcePersistence;
1985            @BeanReference(type = ResourceActionPersistence.class)
1986            protected ResourceActionPersistence resourceActionPersistence;
1987            @BeanReference(type = ResourceCodePersistence.class)
1988            protected ResourceCodePersistence resourceCodePersistence;
1989            @BeanReference(type = ResourcePermissionPersistence.class)
1990            protected ResourcePermissionPersistence resourcePermissionPersistence;
1991            @BeanReference(type = RolePersistence.class)
1992            protected RolePersistence rolePersistence;
1993            @BeanReference(type = ServiceComponentPersistence.class)
1994            protected ServiceComponentPersistence serviceComponentPersistence;
1995            @BeanReference(type = ShardPersistence.class)
1996            protected ShardPersistence shardPersistence;
1997            @BeanReference(type = SubscriptionPersistence.class)
1998            protected SubscriptionPersistence subscriptionPersistence;
1999            @BeanReference(type = TicketPersistence.class)
2000            protected TicketPersistence ticketPersistence;
2001            @BeanReference(type = TeamPersistence.class)
2002            protected TeamPersistence teamPersistence;
2003            @BeanReference(type = UserPersistence.class)
2004            protected UserPersistence userPersistence;
2005            @BeanReference(type = UserGroupPersistence.class)
2006            protected UserGroupPersistence userGroupPersistence;
2007            @BeanReference(type = UserGroupGroupRolePersistence.class)
2008            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2009            @BeanReference(type = UserGroupRolePersistence.class)
2010            protected UserGroupRolePersistence userGroupRolePersistence;
2011            @BeanReference(type = UserIdMapperPersistence.class)
2012            protected UserIdMapperPersistence userIdMapperPersistence;
2013            @BeanReference(type = UserTrackerPersistence.class)
2014            protected UserTrackerPersistence userTrackerPersistence;
2015            @BeanReference(type = UserTrackerPathPersistence.class)
2016            protected UserTrackerPathPersistence userTrackerPathPersistence;
2017            @BeanReference(type = WebDAVPropsPersistence.class)
2018            protected WebDAVPropsPersistence webDAVPropsPersistence;
2019            @BeanReference(type = WebsitePersistence.class)
2020            protected WebsitePersistence websitePersistence;
2021            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2022            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2023            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2024            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2025            private static final String _SQL_SELECT_COMPANY = "SELECT company FROM Company company";
2026            private static final String _SQL_SELECT_COMPANY_WHERE = "SELECT company FROM Company company WHERE ";
2027            private static final String _SQL_COUNT_COMPANY = "SELECT COUNT(company) FROM Company company";
2028            private static final String _SQL_COUNT_COMPANY_WHERE = "SELECT COUNT(company) FROM Company company WHERE ";
2029            private static final String _FINDER_COLUMN_WEBID_WEBID_1 = "company.webId IS NULL";
2030            private static final String _FINDER_COLUMN_WEBID_WEBID_2 = "company.webId = ?";
2031            private static final String _FINDER_COLUMN_WEBID_WEBID_3 = "(company.webId IS NULL OR company.webId = ?)";
2032            private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1 = "company.virtualHost IS NULL";
2033            private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2 = "company.virtualHost = ?";
2034            private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3 = "(company.virtualHost IS NULL OR company.virtualHost = ?)";
2035            private static final String _FINDER_COLUMN_MX_MX_1 = "company.mx IS NULL";
2036            private static final String _FINDER_COLUMN_MX_MX_2 = "company.mx = ?";
2037            private static final String _FINDER_COLUMN_MX_MX_3 = "(company.mx IS NULL OR company.mx = ?)";
2038            private static final String _FINDER_COLUMN_LOGOID_LOGOID_2 = "company.logoId = ?";
2039            private static final String _FINDER_COLUMN_SYSTEM_SYSTEM_2 = "company.system = ?";
2040            private static final String _ORDER_BY_ENTITY_ALIAS = "company.";
2041            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Company exists with the primary key ";
2042            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Company exists with the key {";
2043            private static Log _log = LogFactoryUtil.getLog(CompanyPersistenceImpl.class);
2044    }