001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.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.getOriginalWebId() });
280    
281                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
282                            new Object[] { companyModelImpl.getOriginalVirtualHost() });
283    
284                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_MX,
285                            new Object[] { companyModelImpl.getOriginalMx() });
286    
287                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_LOGOID,
288                            new Object[] { new Long(companyModelImpl.getOriginalLogoId()) });
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                            Session session = null;
553    
554                            try {
555                                    session = openSession();
556    
557                                    StringBundler query = new StringBundler(2);
558    
559                                    query.append(_SQL_SELECT_COMPANY_WHERE);
560    
561                                    if (webId == null) {
562                                            query.append(_FINDER_COLUMN_WEBID_WEBID_1);
563                                    }
564                                    else {
565                                            if (webId.equals(StringPool.BLANK)) {
566                                                    query.append(_FINDER_COLUMN_WEBID_WEBID_3);
567                                            }
568                                            else {
569                                                    query.append(_FINDER_COLUMN_WEBID_WEBID_2);
570                                            }
571                                    }
572    
573                                    String sql = query.toString();
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.putResult(FINDER_PATH_FETCH_BY_WEBID,
613                                                    finderArgs, new ArrayList<Company>());
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                            Session session = null;
693    
694                            try {
695                                    session = openSession();
696    
697                                    StringBundler query = new StringBundler(2);
698    
699                                    query.append(_SQL_SELECT_COMPANY_WHERE);
700    
701                                    if (virtualHost == null) {
702                                            query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1);
703                                    }
704                                    else {
705                                            if (virtualHost.equals(StringPool.BLANK)) {
706                                                    query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3);
707                                            }
708                                            else {
709                                                    query.append(_FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2);
710                                            }
711                                    }
712    
713                                    String sql = query.toString();
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.putResult(FINDER_PATH_FETCH_BY_VIRTUALHOST,
753                                                    finderArgs, new ArrayList<Company>());
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                            Session session = null;
832    
833                            try {
834                                    session = openSession();
835    
836                                    StringBundler query = new StringBundler(2);
837    
838                                    query.append(_SQL_SELECT_COMPANY_WHERE);
839    
840                                    if (mx == null) {
841                                            query.append(_FINDER_COLUMN_MX_MX_1);
842                                    }
843                                    else {
844                                            if (mx.equals(StringPool.BLANK)) {
845                                                    query.append(_FINDER_COLUMN_MX_MX_3);
846                                            }
847                                            else {
848                                                    query.append(_FINDER_COLUMN_MX_MX_2);
849                                            }
850                                    }
851    
852                                    String sql = query.toString();
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.putResult(FINDER_PATH_FETCH_BY_MX,
892                                                    finderArgs, new ArrayList<Company>());
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                            Session session = null;
971    
972                            try {
973                                    session = openSession();
974    
975                                    StringBundler query = new StringBundler(2);
976    
977                                    query.append(_SQL_SELECT_COMPANY_WHERE);
978    
979                                    query.append(_FINDER_COLUMN_LOGOID_LOGOID_2);
980    
981                                    String sql = query.toString();
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.putResult(FINDER_PATH_FETCH_BY_LOGOID,
1018                                                    finderArgs, new ArrayList<Company>());
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                            Session session = null;
1091    
1092                            try {
1093                                    session = openSession();
1094    
1095                                    StringBundler query = null;
1096    
1097                                    if (orderByComparator != null) {
1098                                            query = new StringBundler(3 +
1099                                                            (orderByComparator.getOrderByFields().length * 3));
1100                                    }
1101                                    else {
1102                                            query = new StringBundler(2);
1103                                    }
1104    
1105                                    query.append(_SQL_SELECT_COMPANY_WHERE);
1106    
1107                                    query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1108    
1109                                    if (orderByComparator != null) {
1110                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1111                                                    orderByComparator);
1112                                    }
1113    
1114                                    String sql = query.toString();
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                                            list = new ArrayList<Company>();
1130                                    }
1131    
1132                                    cacheResult(list);
1133    
1134                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_SYSTEM,
1135                                            finderArgs, list);
1136    
1137                                    closeSession(session);
1138                            }
1139                    }
1140    
1141                    return list;
1142            }
1143    
1144            /**
1145             * Finds the first company in the ordered set where system = &#63;.
1146             *
1147             * <p>
1148             * 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.
1149             * </p>
1150             *
1151             * @param system the system to search with
1152             * @param orderByComparator the comparator to order the set by
1153             * @return the first matching company
1154             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
1155             * @throws SystemException if a system exception occurred
1156             */
1157            public Company findBySystem_First(boolean system,
1158                    OrderByComparator orderByComparator)
1159                    throws NoSuchCompanyException, SystemException {
1160                    List<Company> list = findBySystem(system, 0, 1, orderByComparator);
1161    
1162                    if (list.isEmpty()) {
1163                            StringBundler msg = new StringBundler(4);
1164    
1165                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1166    
1167                            msg.append("system=");
1168                            msg.append(system);
1169    
1170                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1171    
1172                            throw new NoSuchCompanyException(msg.toString());
1173                    }
1174                    else {
1175                            return list.get(0);
1176                    }
1177            }
1178    
1179            /**
1180             * Finds the last company in the ordered set where system = &#63;.
1181             *
1182             * <p>
1183             * 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.
1184             * </p>
1185             *
1186             * @param system the system to search with
1187             * @param orderByComparator the comparator to order the set by
1188             * @return the last matching company
1189             * @throws com.liferay.portal.NoSuchCompanyException if a matching company could not be found
1190             * @throws SystemException if a system exception occurred
1191             */
1192            public Company findBySystem_Last(boolean system,
1193                    OrderByComparator orderByComparator)
1194                    throws NoSuchCompanyException, SystemException {
1195                    int count = countBySystem(system);
1196    
1197                    List<Company> list = findBySystem(system, count - 1, count,
1198                                    orderByComparator);
1199    
1200                    if (list.isEmpty()) {
1201                            StringBundler msg = new StringBundler(4);
1202    
1203                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1204    
1205                            msg.append("system=");
1206                            msg.append(system);
1207    
1208                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1209    
1210                            throw new NoSuchCompanyException(msg.toString());
1211                    }
1212                    else {
1213                            return list.get(0);
1214                    }
1215            }
1216    
1217            /**
1218             * Finds the companies before and after the current company in the ordered set where system = &#63;.
1219             *
1220             * <p>
1221             * 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.
1222             * </p>
1223             *
1224             * @param companyId the primary key of the current company
1225             * @param system the system to search with
1226             * @param orderByComparator the comparator to order the set by
1227             * @return the previous, current, and next company
1228             * @throws com.liferay.portal.NoSuchCompanyException if a company with the primary key could not be found
1229             * @throws SystemException if a system exception occurred
1230             */
1231            public Company[] findBySystem_PrevAndNext(long companyId, boolean system,
1232                    OrderByComparator orderByComparator)
1233                    throws NoSuchCompanyException, SystemException {
1234                    Company company = findByPrimaryKey(companyId);
1235    
1236                    Session session = null;
1237    
1238                    try {
1239                            session = openSession();
1240    
1241                            Company[] array = new CompanyImpl[3];
1242    
1243                            array[0] = getBySystem_PrevAndNext(session, company, system,
1244                                            orderByComparator, true);
1245    
1246                            array[1] = company;
1247    
1248                            array[2] = getBySystem_PrevAndNext(session, company, system,
1249                                            orderByComparator, false);
1250    
1251                            return array;
1252                    }
1253                    catch (Exception e) {
1254                            throw processException(e);
1255                    }
1256                    finally {
1257                            closeSession(session);
1258                    }
1259            }
1260    
1261            protected Company getBySystem_PrevAndNext(Session session, Company company,
1262                    boolean system, OrderByComparator orderByComparator, boolean previous) {
1263                    StringBundler query = null;
1264    
1265                    if (orderByComparator != null) {
1266                            query = new StringBundler(6 +
1267                                            (orderByComparator.getOrderByFields().length * 6));
1268                    }
1269                    else {
1270                            query = new StringBundler(3);
1271                    }
1272    
1273                    query.append(_SQL_SELECT_COMPANY_WHERE);
1274    
1275                    query.append(_FINDER_COLUMN_SYSTEM_SYSTEM_2);
1276    
1277                    if (orderByComparator != null) {
1278                            String[] orderByFields = orderByComparator.getOrderByFields();
1279    
1280                            if (orderByFields.length > 0) {
1281                                    query.append(WHERE_AND);
1282                            }
1283    
1284                            for (int i = 0; i < orderByFields.length; i++) {
1285                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1286                                    query.append(orderByFields[i]);
1287    
1288                                    if ((i + 1) < orderByFields.length) {
1289                                            if (orderByComparator.isAscending() ^ previous) {
1290                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1291                                            }
1292                                            else {
1293                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1294                                            }
1295                                    }
1296                                    else {
1297                                            if (orderByComparator.isAscending() ^ previous) {
1298                                                    query.append(WHERE_GREATER_THAN);
1299                                            }
1300                                            else {
1301                                                    query.append(WHERE_LESSER_THAN);
1302                                            }
1303                                    }
1304                            }
1305    
1306                            query.append(ORDER_BY_CLAUSE);
1307    
1308                            for (int i = 0; i < orderByFields.length; i++) {
1309                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1310                                    query.append(orderByFields[i]);
1311    
1312                                    if ((i + 1) < orderByFields.length) {
1313                                            if (orderByComparator.isAscending() ^ previous) {
1314                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1315                                            }
1316                                            else {
1317                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1318                                            }
1319                                    }
1320                                    else {
1321                                            if (orderByComparator.isAscending() ^ previous) {
1322                                                    query.append(ORDER_BY_ASC);
1323                                            }
1324                                            else {
1325                                                    query.append(ORDER_BY_DESC);
1326                                            }
1327                                    }
1328                            }
1329                    }
1330    
1331                    String sql = query.toString();
1332    
1333                    Query q = session.createQuery(sql);
1334    
1335                    q.setFirstResult(0);
1336                    q.setMaxResults(2);
1337    
1338                    QueryPos qPos = QueryPos.getInstance(q);
1339    
1340                    qPos.add(system);
1341    
1342                    if (orderByComparator != null) {
1343                            Object[] values = orderByComparator.getOrderByValues(company);
1344    
1345                            for (Object value : values) {
1346                                    qPos.add(value);
1347                            }
1348                    }
1349    
1350                    List<Company> list = q.list();
1351    
1352                    if (list.size() == 2) {
1353                            return list.get(1);
1354                    }
1355                    else {
1356                            return null;
1357                    }
1358            }
1359    
1360            /**
1361             * Finds all the companies.
1362             *
1363             * @return the companies
1364             * @throws SystemException if a system exception occurred
1365             */
1366            public List<Company> findAll() throws SystemException {
1367                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1368            }
1369    
1370            /**
1371             * Finds a range of all the companies.
1372             *
1373             * <p>
1374             * 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.
1375             * </p>
1376             *
1377             * @param start the lower bound of the range of companies to return
1378             * @param end the upper bound of the range of companies to return (not inclusive)
1379             * @return the range of companies
1380             * @throws SystemException if a system exception occurred
1381             */
1382            public List<Company> findAll(int start, int end) throws SystemException {
1383                    return findAll(start, end, null);
1384            }
1385    
1386            /**
1387             * Finds an ordered range of all the companies.
1388             *
1389             * <p>
1390             * 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.
1391             * </p>
1392             *
1393             * @param start the lower bound of the range of companies to return
1394             * @param end the upper bound of the range of companies to return (not inclusive)
1395             * @param orderByComparator the comparator to order the results by
1396             * @return the ordered range of companies
1397             * @throws SystemException if a system exception occurred
1398             */
1399            public List<Company> findAll(int start, int end,
1400                    OrderByComparator orderByComparator) throws SystemException {
1401                    Object[] finderArgs = new Object[] {
1402                                    String.valueOf(start), String.valueOf(end),
1403                                    String.valueOf(orderByComparator)
1404                            };
1405    
1406                    List<Company> list = (List<Company>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1407                                    finderArgs, this);
1408    
1409                    if (list == null) {
1410                            Session session = null;
1411    
1412                            try {
1413                                    session = openSession();
1414    
1415                                    StringBundler query = null;
1416                                    String sql = null;
1417    
1418                                    if (orderByComparator != null) {
1419                                            query = new StringBundler(2 +
1420                                                            (orderByComparator.getOrderByFields().length * 3));
1421    
1422                                            query.append(_SQL_SELECT_COMPANY);
1423    
1424                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1425                                                    orderByComparator);
1426    
1427                                            sql = query.toString();
1428                                    }
1429                                    else {
1430                                            sql = _SQL_SELECT_COMPANY;
1431                                    }
1432    
1433                                    Query q = session.createQuery(sql);
1434    
1435                                    if (orderByComparator == null) {
1436                                            list = (List<Company>)QueryUtil.list(q, getDialect(),
1437                                                            start, end, false);
1438    
1439                                            Collections.sort(list);
1440                                    }
1441                                    else {
1442                                            list = (List<Company>)QueryUtil.list(q, getDialect(),
1443                                                            start, end);
1444                                    }
1445                            }
1446                            catch (Exception e) {
1447                                    throw processException(e);
1448                            }
1449                            finally {
1450                                    if (list == null) {
1451                                            list = new ArrayList<Company>();
1452                                    }
1453    
1454                                    cacheResult(list);
1455    
1456                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1457    
1458                                    closeSession(session);
1459                            }
1460                    }
1461    
1462                    return list;
1463            }
1464    
1465            /**
1466             * Removes the company where webId = &#63; from the database.
1467             *
1468             * @param webId the web id to search with
1469             * @throws SystemException if a system exception occurred
1470             */
1471            public void removeByWebId(String webId)
1472                    throws NoSuchCompanyException, SystemException {
1473                    Company company = findByWebId(webId);
1474    
1475                    remove(company);
1476            }
1477    
1478            /**
1479             * Removes the company where virtualHost = &#63; from the database.
1480             *
1481             * @param virtualHost the virtual host to search with
1482             * @throws SystemException if a system exception occurred
1483             */
1484            public void removeByVirtualHost(String virtualHost)
1485                    throws NoSuchCompanyException, SystemException {
1486                    Company company = findByVirtualHost(virtualHost);
1487    
1488                    remove(company);
1489            }
1490    
1491            /**
1492             * Removes the company where mx = &#63; from the database.
1493             *
1494             * @param mx the mx to search with
1495             * @throws SystemException if a system exception occurred
1496             */
1497            public void removeByMx(String mx)
1498                    throws NoSuchCompanyException, SystemException {
1499                    Company company = findByMx(mx);
1500    
1501                    remove(company);
1502            }
1503    
1504            /**
1505             * Removes the company where logoId = &#63; from the database.
1506             *
1507             * @param logoId the logo id to search with
1508             * @throws SystemException if a system exception occurred
1509             */
1510            public void removeByLogoId(long logoId)
1511                    throws NoSuchCompanyException, SystemException {
1512                    Company company = findByLogoId(logoId);
1513    
1514                    remove(company);
1515            }
1516    
1517            /**
1518             * Removes all the companies where system = &#63; from the database.
1519             *
1520             * @param system the system to search with
1521             * @throws SystemException if a system exception occurred
1522             */
1523            public void removeBySystem(boolean system) throws SystemException {
1524                    for (Company company : findBySystem(system)) {
1525                            remove(company);
1526                    }
1527            }
1528    
1529            /**
1530             * Removes all the companies from the database.
1531             *
1532             * @throws SystemException if a system exception occurred
1533             */
1534            public void removeAll() throws SystemException {
1535                    for (Company company : findAll()) {
1536                            remove(company);
1537                    }
1538            }
1539    
1540            /**
1541             * Counts all the companies where webId = &#63;.
1542             *
1543             * @param webId the web id to search with
1544             * @return the number of matching companies
1545             * @throws SystemException if a system exception occurred
1546             */
1547            public int countByWebId(String webId) throws SystemException {
1548                    Object[] finderArgs = new Object[] { webId };
1549    
1550                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_WEBID,
1551                                    finderArgs, this);
1552    
1553                    if (count == null) {
1554                            Session session = null;
1555    
1556                            try {
1557                                    session = openSession();
1558    
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                                    Query q = session.createQuery(sql);
1578    
1579                                    QueryPos qPos = QueryPos.getInstance(q);
1580    
1581                                    if (webId != null) {
1582                                            qPos.add(webId);
1583                                    }
1584    
1585                                    count = (Long)q.uniqueResult();
1586                            }
1587                            catch (Exception e) {
1588                                    throw processException(e);
1589                            }
1590                            finally {
1591                                    if (count == null) {
1592                                            count = Long.valueOf(0);
1593                                    }
1594    
1595                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_WEBID,
1596                                            finderArgs, count);
1597    
1598                                    closeSession(session);
1599                            }
1600                    }
1601    
1602                    return count.intValue();
1603            }
1604    
1605            /**
1606             * Counts all the companies where virtualHost = &#63;.
1607             *
1608             * @param virtualHost the virtual host to search with
1609             * @return the number of matching companies
1610             * @throws SystemException if a system exception occurred
1611             */
1612            public int countByVirtualHost(String virtualHost) throws SystemException {
1613                    Object[] finderArgs = new Object[] { virtualHost };
1614    
1615                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1616                                    finderArgs, this);
1617    
1618                    if (count == null) {
1619                            Session session = null;
1620    
1621                            try {
1622                                    session = openSession();
1623    
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                                    Query q = session.createQuery(sql);
1643    
1644                                    QueryPos qPos = QueryPos.getInstance(q);
1645    
1646                                    if (virtualHost != null) {
1647                                            qPos.add(virtualHost);
1648                                    }
1649    
1650                                    count = (Long)q.uniqueResult();
1651                            }
1652                            catch (Exception e) {
1653                                    throw processException(e);
1654                            }
1655                            finally {
1656                                    if (count == null) {
1657                                            count = Long.valueOf(0);
1658                                    }
1659    
1660                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_VIRTUALHOST,
1661                                            finderArgs, count);
1662    
1663                                    closeSession(session);
1664                            }
1665                    }
1666    
1667                    return count.intValue();
1668            }
1669    
1670            /**
1671             * Counts all the companies where mx = &#63;.
1672             *
1673             * @param mx the mx to search with
1674             * @return the number of matching companies
1675             * @throws SystemException if a system exception occurred
1676             */
1677            public int countByMx(String mx) throws SystemException {
1678                    Object[] finderArgs = new Object[] { mx };
1679    
1680                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_MX,
1681                                    finderArgs, this);
1682    
1683                    if (count == null) {
1684                            Session session = null;
1685    
1686                            try {
1687                                    session = openSession();
1688    
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                                    Query q = session.createQuery(sql);
1708    
1709                                    QueryPos qPos = QueryPos.getInstance(q);
1710    
1711                                    if (mx != null) {
1712                                            qPos.add(mx);
1713                                    }
1714    
1715                                    count = (Long)q.uniqueResult();
1716                            }
1717                            catch (Exception e) {
1718                                    throw processException(e);
1719                            }
1720                            finally {
1721                                    if (count == null) {
1722                                            count = Long.valueOf(0);
1723                                    }
1724    
1725                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_MX, finderArgs,
1726                                            count);
1727    
1728                                    closeSession(session);
1729                            }
1730                    }
1731    
1732                    return count.intValue();
1733            }
1734    
1735            /**
1736             * Counts all the companies where logoId = &#63;.
1737             *
1738             * @param logoId the logo id to search with
1739             * @return the number of matching companies
1740             * @throws SystemException if a system exception occurred
1741             */
1742            public int countByLogoId(long logoId) throws SystemException {
1743                    Object[] finderArgs = new Object[] { logoId };
1744    
1745                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_LOGOID,
1746                                    finderArgs, this);
1747    
1748                    if (count == null) {
1749                            Session session = null;
1750    
1751                            try {
1752                                    session = openSession();
1753    
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                                    Query q = session.createQuery(sql);
1763    
1764                                    QueryPos qPos = QueryPos.getInstance(q);
1765    
1766                                    qPos.add(logoId);
1767    
1768                                    count = (Long)q.uniqueResult();
1769                            }
1770                            catch (Exception e) {
1771                                    throw processException(e);
1772                            }
1773                            finally {
1774                                    if (count == null) {
1775                                            count = Long.valueOf(0);
1776                                    }
1777    
1778                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_LOGOID,
1779                                            finderArgs, count);
1780    
1781                                    closeSession(session);
1782                            }
1783                    }
1784    
1785                    return count.intValue();
1786            }
1787    
1788            /**
1789             * Counts all the companies where system = &#63;.
1790             *
1791             * @param system the system to search with
1792             * @return the number of matching companies
1793             * @throws SystemException if a system exception occurred
1794             */
1795            public int countBySystem(boolean system) throws SystemException {
1796                    Object[] finderArgs = new Object[] { system };
1797    
1798                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_SYSTEM,
1799                                    finderArgs, this);
1800    
1801                    if (count == null) {
1802                            Session session = null;
1803    
1804                            try {
1805                                    session = openSession();
1806    
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                                    Query q = session.createQuery(sql);
1816    
1817                                    QueryPos qPos = QueryPos.getInstance(q);
1818    
1819                                    qPos.add(system);
1820    
1821                                    count = (Long)q.uniqueResult();
1822                            }
1823                            catch (Exception e) {
1824                                    throw processException(e);
1825                            }
1826                            finally {
1827                                    if (count == null) {
1828                                            count = Long.valueOf(0);
1829                                    }
1830    
1831                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_SYSTEM,
1832                                            finderArgs, count);
1833    
1834                                    closeSession(session);
1835                            }
1836                    }
1837    
1838                    return count.intValue();
1839            }
1840    
1841            /**
1842             * Counts all the companies.
1843             *
1844             * @return the number of companies
1845             * @throws SystemException if a system exception occurred
1846             */
1847            public int countAll() throws SystemException {
1848                    Object[] finderArgs = new Object[0];
1849    
1850                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1851                                    finderArgs, this);
1852    
1853                    if (count == null) {
1854                            Session session = null;
1855    
1856                            try {
1857                                    session = openSession();
1858    
1859                                    Query q = session.createQuery(_SQL_COUNT_COMPANY);
1860    
1861                                    count = (Long)q.uniqueResult();
1862                            }
1863                            catch (Exception e) {
1864                                    throw processException(e);
1865                            }
1866                            finally {
1867                                    if (count == null) {
1868                                            count = Long.valueOf(0);
1869                                    }
1870    
1871                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1872                                            count);
1873    
1874                                    closeSession(session);
1875                            }
1876                    }
1877    
1878                    return count.intValue();
1879            }
1880    
1881            /**
1882             * Initializes the company persistence.
1883             */
1884            public void afterPropertiesSet() {
1885                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1886                                            com.liferay.portal.util.PropsUtil.get(
1887                                                    "value.object.listener.com.liferay.portal.model.Company")));
1888    
1889                    if (listenerClassNames.length > 0) {
1890                            try {
1891                                    List<ModelListener<Company>> listenersList = new ArrayList<ModelListener<Company>>();
1892    
1893                                    for (String listenerClassName : listenerClassNames) {
1894                                            listenersList.add((ModelListener<Company>)InstanceFactory.newInstance(
1895                                                            listenerClassName));
1896                                    }
1897    
1898                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1899                            }
1900                            catch (Exception e) {
1901                                    _log.error(e);
1902                            }
1903                    }
1904            }
1905    
1906            public void destroy() {
1907                    EntityCacheUtil.removeCache(CompanyImpl.class.getName());
1908                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1909                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
1910            }
1911    
1912            @BeanReference(type = AccountPersistence.class)
1913            protected AccountPersistence accountPersistence;
1914            @BeanReference(type = AddressPersistence.class)
1915            protected AddressPersistence addressPersistence;
1916            @BeanReference(type = BrowserTrackerPersistence.class)
1917            protected BrowserTrackerPersistence browserTrackerPersistence;
1918            @BeanReference(type = ClassNamePersistence.class)
1919            protected ClassNamePersistence classNamePersistence;
1920            @BeanReference(type = ClusterGroupPersistence.class)
1921            protected ClusterGroupPersistence clusterGroupPersistence;
1922            @BeanReference(type = CompanyPersistence.class)
1923            protected CompanyPersistence companyPersistence;
1924            @BeanReference(type = ContactPersistence.class)
1925            protected ContactPersistence contactPersistence;
1926            @BeanReference(type = CountryPersistence.class)
1927            protected CountryPersistence countryPersistence;
1928            @BeanReference(type = EmailAddressPersistence.class)
1929            protected EmailAddressPersistence emailAddressPersistence;
1930            @BeanReference(type = GroupPersistence.class)
1931            protected GroupPersistence groupPersistence;
1932            @BeanReference(type = ImagePersistence.class)
1933            protected ImagePersistence imagePersistence;
1934            @BeanReference(type = LayoutPersistence.class)
1935            protected LayoutPersistence layoutPersistence;
1936            @BeanReference(type = LayoutPrototypePersistence.class)
1937            protected LayoutPrototypePersistence layoutPrototypePersistence;
1938            @BeanReference(type = LayoutSetPersistence.class)
1939            protected LayoutSetPersistence layoutSetPersistence;
1940            @BeanReference(type = LayoutSetPrototypePersistence.class)
1941            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1942            @BeanReference(type = ListTypePersistence.class)
1943            protected ListTypePersistence listTypePersistence;
1944            @BeanReference(type = LockPersistence.class)
1945            protected LockPersistence lockPersistence;
1946            @BeanReference(type = MembershipRequestPersistence.class)
1947            protected MembershipRequestPersistence membershipRequestPersistence;
1948            @BeanReference(type = OrganizationPersistence.class)
1949            protected OrganizationPersistence organizationPersistence;
1950            @BeanReference(type = OrgGroupPermissionPersistence.class)
1951            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1952            @BeanReference(type = OrgGroupRolePersistence.class)
1953            protected OrgGroupRolePersistence orgGroupRolePersistence;
1954            @BeanReference(type = OrgLaborPersistence.class)
1955            protected OrgLaborPersistence orgLaborPersistence;
1956            @BeanReference(type = PasswordPolicyPersistence.class)
1957            protected PasswordPolicyPersistence passwordPolicyPersistence;
1958            @BeanReference(type = PasswordPolicyRelPersistence.class)
1959            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1960            @BeanReference(type = PasswordTrackerPersistence.class)
1961            protected PasswordTrackerPersistence passwordTrackerPersistence;
1962            @BeanReference(type = PermissionPersistence.class)
1963            protected PermissionPersistence permissionPersistence;
1964            @BeanReference(type = PhonePersistence.class)
1965            protected PhonePersistence phonePersistence;
1966            @BeanReference(type = PluginSettingPersistence.class)
1967            protected PluginSettingPersistence pluginSettingPersistence;
1968            @BeanReference(type = PortletPersistence.class)
1969            protected PortletPersistence portletPersistence;
1970            @BeanReference(type = PortletItemPersistence.class)
1971            protected PortletItemPersistence portletItemPersistence;
1972            @BeanReference(type = PortletPreferencesPersistence.class)
1973            protected PortletPreferencesPersistence portletPreferencesPersistence;
1974            @BeanReference(type = RegionPersistence.class)
1975            protected RegionPersistence regionPersistence;
1976            @BeanReference(type = ReleasePersistence.class)
1977            protected ReleasePersistence releasePersistence;
1978            @BeanReference(type = ResourcePersistence.class)
1979            protected ResourcePersistence resourcePersistence;
1980            @BeanReference(type = ResourceActionPersistence.class)
1981            protected ResourceActionPersistence resourceActionPersistence;
1982            @BeanReference(type = ResourceCodePersistence.class)
1983            protected ResourceCodePersistence resourceCodePersistence;
1984            @BeanReference(type = ResourcePermissionPersistence.class)
1985            protected ResourcePermissionPersistence resourcePermissionPersistence;
1986            @BeanReference(type = RolePersistence.class)
1987            protected RolePersistence rolePersistence;
1988            @BeanReference(type = ServiceComponentPersistence.class)
1989            protected ServiceComponentPersistence serviceComponentPersistence;
1990            @BeanReference(type = ShardPersistence.class)
1991            protected ShardPersistence shardPersistence;
1992            @BeanReference(type = SubscriptionPersistence.class)
1993            protected SubscriptionPersistence subscriptionPersistence;
1994            @BeanReference(type = TicketPersistence.class)
1995            protected TicketPersistence ticketPersistence;
1996            @BeanReference(type = TeamPersistence.class)
1997            protected TeamPersistence teamPersistence;
1998            @BeanReference(type = UserPersistence.class)
1999            protected UserPersistence userPersistence;
2000            @BeanReference(type = UserGroupPersistence.class)
2001            protected UserGroupPersistence userGroupPersistence;
2002            @BeanReference(type = UserGroupGroupRolePersistence.class)
2003            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
2004            @BeanReference(type = UserGroupRolePersistence.class)
2005            protected UserGroupRolePersistence userGroupRolePersistence;
2006            @BeanReference(type = UserIdMapperPersistence.class)
2007            protected UserIdMapperPersistence userIdMapperPersistence;
2008            @BeanReference(type = UserTrackerPersistence.class)
2009            protected UserTrackerPersistence userTrackerPersistence;
2010            @BeanReference(type = UserTrackerPathPersistence.class)
2011            protected UserTrackerPathPersistence userTrackerPathPersistence;
2012            @BeanReference(type = WebDAVPropsPersistence.class)
2013            protected WebDAVPropsPersistence webDAVPropsPersistence;
2014            @BeanReference(type = WebsitePersistence.class)
2015            protected WebsitePersistence websitePersistence;
2016            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
2017            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
2018            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
2019            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
2020            private static final String _SQL_SELECT_COMPANY = "SELECT company FROM Company company";
2021            private static final String _SQL_SELECT_COMPANY_WHERE = "SELECT company FROM Company company WHERE ";
2022            private static final String _SQL_COUNT_COMPANY = "SELECT COUNT(company) FROM Company company";
2023            private static final String _SQL_COUNT_COMPANY_WHERE = "SELECT COUNT(company) FROM Company company WHERE ";
2024            private static final String _FINDER_COLUMN_WEBID_WEBID_1 = "company.webId IS NULL";
2025            private static final String _FINDER_COLUMN_WEBID_WEBID_2 = "company.webId = ?";
2026            private static final String _FINDER_COLUMN_WEBID_WEBID_3 = "(company.webId IS NULL OR company.webId = ?)";
2027            private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_1 = "company.virtualHost IS NULL";
2028            private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_2 = "company.virtualHost = ?";
2029            private static final String _FINDER_COLUMN_VIRTUALHOST_VIRTUALHOST_3 = "(company.virtualHost IS NULL OR company.virtualHost = ?)";
2030            private static final String _FINDER_COLUMN_MX_MX_1 = "company.mx IS NULL";
2031            private static final String _FINDER_COLUMN_MX_MX_2 = "company.mx = ?";
2032            private static final String _FINDER_COLUMN_MX_MX_3 = "(company.mx IS NULL OR company.mx = ?)";
2033            private static final String _FINDER_COLUMN_LOGOID_LOGOID_2 = "company.logoId = ?";
2034            private static final String _FINDER_COLUMN_SYSTEM_SYSTEM_2 = "company.system = ?";
2035            private static final String _ORDER_BY_ENTITY_ALIAS = "company.";
2036            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Company exists with the primary key ";
2037            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Company exists with the key {";
2038            private static Log _log = LogFactoryUtil.getLog(CompanyPersistenceImpl.class);
2039    }