001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.NoSuchExportImportConfigurationException;
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.log.Log;
029    import com.liferay.portal.kernel.log.LogFactoryUtil;
030    import com.liferay.portal.kernel.util.OrderByComparator;
031    import com.liferay.portal.kernel.util.SetUtil;
032    import com.liferay.portal.kernel.util.StringBundler;
033    import com.liferay.portal.kernel.util.StringPool;
034    import com.liferay.portal.model.CacheModel;
035    import com.liferay.portal.model.ExportImportConfiguration;
036    import com.liferay.portal.model.MVCCModel;
037    import com.liferay.portal.model.impl.ExportImportConfigurationImpl;
038    import com.liferay.portal.model.impl.ExportImportConfigurationModelImpl;
039    import com.liferay.portal.service.persistence.ExportImportConfigurationPersistence;
040    
041    import java.io.Serializable;
042    
043    import java.util.Collections;
044    import java.util.HashMap;
045    import java.util.HashSet;
046    import java.util.Iterator;
047    import java.util.List;
048    import java.util.Map;
049    import java.util.Set;
050    
051    /**
052     * The persistence implementation for the export import configuration service.
053     *
054     * <p>
055     * Caching information and settings can be found in <code>portal.properties</code>
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see ExportImportConfigurationPersistence
060     * @see ExportImportConfigurationUtil
061     * @generated
062     */
063    @ProviderType
064    public class ExportImportConfigurationPersistenceImpl
065            extends BasePersistenceImpl<ExportImportConfiguration>
066            implements ExportImportConfigurationPersistence {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * Never modify or reference this class directly. Always use {@link ExportImportConfigurationUtil} to access the export import configuration persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
071             */
072            public static final String FINDER_CLASS_NAME_ENTITY = ExportImportConfigurationImpl.class.getName();
073            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
074                    ".List1";
075            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
076                    ".List2";
077            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
078                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
079                            ExportImportConfigurationImpl.class,
080                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
081            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
082                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
083                            ExportImportConfigurationImpl.class,
084                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
085            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
086                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
087                            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll",
088                            new String[0]);
089            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
090                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
091                            ExportImportConfigurationImpl.class,
092                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
093                            new String[] {
094                                    Long.class.getName(),
095                                    
096                            Integer.class.getName(), Integer.class.getName(),
097                                    OrderByComparator.class.getName()
098                            });
099            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
100                    new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
101                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
102                            ExportImportConfigurationImpl.class,
103                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
104                            new String[] { Long.class.getName() },
105                            ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
106                            ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
107            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
108                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
109                            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
110                            "countByGroupId", new String[] { Long.class.getName() });
111    
112            /**
113             * Returns all the export import configurations where groupId = &#63;.
114             *
115             * @param groupId the group ID
116             * @return the matching export import configurations
117             */
118            @Override
119            public List<ExportImportConfiguration> findByGroupId(long groupId) {
120                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
121            }
122    
123            /**
124             * Returns a range of all the export import configurations where groupId = &#63;.
125             *
126             * <p>
127             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
128             * </p>
129             *
130             * @param groupId the group ID
131             * @param start the lower bound of the range of export import configurations
132             * @param end the upper bound of the range of export import configurations (not inclusive)
133             * @return the range of matching export import configurations
134             */
135            @Override
136            public List<ExportImportConfiguration> findByGroupId(long groupId,
137                    int start, int end) {
138                    return findByGroupId(groupId, start, end, null);
139            }
140    
141            /**
142             * Returns an ordered range of all the export import configurations where groupId = &#63;.
143             *
144             * <p>
145             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
146             * </p>
147             *
148             * @param groupId the group ID
149             * @param start the lower bound of the range of export import configurations
150             * @param end the upper bound of the range of export import configurations (not inclusive)
151             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
152             * @return the ordered range of matching export import configurations
153             */
154            @Override
155            public List<ExportImportConfiguration> findByGroupId(long groupId,
156                    int start, int end,
157                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
158                    boolean pagination = true;
159                    FinderPath finderPath = null;
160                    Object[] finderArgs = null;
161    
162                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
163                                    (orderByComparator == null)) {
164                            pagination = false;
165                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
166                            finderArgs = new Object[] { groupId };
167                    }
168                    else {
169                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
170                            finderArgs = new Object[] { groupId, start, end, orderByComparator };
171                    }
172    
173                    List<ExportImportConfiguration> list = (List<ExportImportConfiguration>)FinderCacheUtil.getResult(finderPath,
174                                    finderArgs, this);
175    
176                    if ((list != null) && !list.isEmpty()) {
177                            for (ExportImportConfiguration exportImportConfiguration : list) {
178                                    if ((groupId != exportImportConfiguration.getGroupId())) {
179                                            list = null;
180    
181                                            break;
182                                    }
183                            }
184                    }
185    
186                    if (list == null) {
187                            StringBundler query = null;
188    
189                            if (orderByComparator != null) {
190                                    query = new StringBundler(3 +
191                                                    (orderByComparator.getOrderByFields().length * 3));
192                            }
193                            else {
194                                    query = new StringBundler(3);
195                            }
196    
197                            query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
198    
199                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
200    
201                            if (orderByComparator != null) {
202                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
203                                            orderByComparator);
204                            }
205                            else
206                             if (pagination) {
207                                    query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
208                            }
209    
210                            String sql = query.toString();
211    
212                            Session session = null;
213    
214                            try {
215                                    session = openSession();
216    
217                                    Query q = session.createQuery(sql);
218    
219                                    QueryPos qPos = QueryPos.getInstance(q);
220    
221                                    qPos.add(groupId);
222    
223                                    if (!pagination) {
224                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
225                                                            getDialect(), start, end, false);
226    
227                                            Collections.sort(list);
228    
229                                            list = Collections.unmodifiableList(list);
230                                    }
231                                    else {
232                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
233                                                            getDialect(), start, end);
234                                    }
235    
236                                    cacheResult(list);
237    
238                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
239                            }
240                            catch (Exception e) {
241                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
242    
243                                    throw processException(e);
244                            }
245                            finally {
246                                    closeSession(session);
247                            }
248                    }
249    
250                    return list;
251            }
252    
253            /**
254             * Returns the first export import configuration in the ordered set where groupId = &#63;.
255             *
256             * @param groupId the group ID
257             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
258             * @return the first matching export import configuration
259             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
260             */
261            @Override
262            public ExportImportConfiguration findByGroupId_First(long groupId,
263                    OrderByComparator<ExportImportConfiguration> orderByComparator)
264                    throws NoSuchExportImportConfigurationException {
265                    ExportImportConfiguration exportImportConfiguration = fetchByGroupId_First(groupId,
266                                    orderByComparator);
267    
268                    if (exportImportConfiguration != null) {
269                            return exportImportConfiguration;
270                    }
271    
272                    StringBundler msg = new StringBundler(4);
273    
274                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
275    
276                    msg.append("groupId=");
277                    msg.append(groupId);
278    
279                    msg.append(StringPool.CLOSE_CURLY_BRACE);
280    
281                    throw new NoSuchExportImportConfigurationException(msg.toString());
282            }
283    
284            /**
285             * Returns the first export import configuration in the ordered set where groupId = &#63;.
286             *
287             * @param groupId the group ID
288             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
289             * @return the first matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
290             */
291            @Override
292            public ExportImportConfiguration fetchByGroupId_First(long groupId,
293                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
294                    List<ExportImportConfiguration> list = findByGroupId(groupId, 0, 1,
295                                    orderByComparator);
296    
297                    if (!list.isEmpty()) {
298                            return list.get(0);
299                    }
300    
301                    return null;
302            }
303    
304            /**
305             * Returns the last export import configuration in the ordered set where groupId = &#63;.
306             *
307             * @param groupId the group ID
308             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
309             * @return the last matching export import configuration
310             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
311             */
312            @Override
313            public ExportImportConfiguration findByGroupId_Last(long groupId,
314                    OrderByComparator<ExportImportConfiguration> orderByComparator)
315                    throws NoSuchExportImportConfigurationException {
316                    ExportImportConfiguration exportImportConfiguration = fetchByGroupId_Last(groupId,
317                                    orderByComparator);
318    
319                    if (exportImportConfiguration != null) {
320                            return exportImportConfiguration;
321                    }
322    
323                    StringBundler msg = new StringBundler(4);
324    
325                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
326    
327                    msg.append("groupId=");
328                    msg.append(groupId);
329    
330                    msg.append(StringPool.CLOSE_CURLY_BRACE);
331    
332                    throw new NoSuchExportImportConfigurationException(msg.toString());
333            }
334    
335            /**
336             * Returns the last export import configuration in the ordered set where groupId = &#63;.
337             *
338             * @param groupId the group ID
339             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
340             * @return the last matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
341             */
342            @Override
343            public ExportImportConfiguration fetchByGroupId_Last(long groupId,
344                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
345                    int count = countByGroupId(groupId);
346    
347                    if (count == 0) {
348                            return null;
349                    }
350    
351                    List<ExportImportConfiguration> list = findByGroupId(groupId,
352                                    count - 1, count, orderByComparator);
353    
354                    if (!list.isEmpty()) {
355                            return list.get(0);
356                    }
357    
358                    return null;
359            }
360    
361            /**
362             * Returns the export import configurations before and after the current export import configuration in the ordered set where groupId = &#63;.
363             *
364             * @param exportImportConfigurationId the primary key of the current export import configuration
365             * @param groupId the group ID
366             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
367             * @return the previous, current, and next export import configuration
368             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
369             */
370            @Override
371            public ExportImportConfiguration[] findByGroupId_PrevAndNext(
372                    long exportImportConfigurationId, long groupId,
373                    OrderByComparator<ExportImportConfiguration> orderByComparator)
374                    throws NoSuchExportImportConfigurationException {
375                    ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
376    
377                    Session session = null;
378    
379                    try {
380                            session = openSession();
381    
382                            ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
383    
384                            array[0] = getByGroupId_PrevAndNext(session,
385                                            exportImportConfiguration, groupId, orderByComparator, true);
386    
387                            array[1] = exportImportConfiguration;
388    
389                            array[2] = getByGroupId_PrevAndNext(session,
390                                            exportImportConfiguration, groupId, orderByComparator, false);
391    
392                            return array;
393                    }
394                    catch (Exception e) {
395                            throw processException(e);
396                    }
397                    finally {
398                            closeSession(session);
399                    }
400            }
401    
402            protected ExportImportConfiguration getByGroupId_PrevAndNext(
403                    Session session, ExportImportConfiguration exportImportConfiguration,
404                    long groupId,
405                    OrderByComparator<ExportImportConfiguration> orderByComparator,
406                    boolean previous) {
407                    StringBundler query = null;
408    
409                    if (orderByComparator != null) {
410                            query = new StringBundler(6 +
411                                            (orderByComparator.getOrderByFields().length * 6));
412                    }
413                    else {
414                            query = new StringBundler(3);
415                    }
416    
417                    query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
418    
419                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
420    
421                    if (orderByComparator != null) {
422                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
423    
424                            if (orderByConditionFields.length > 0) {
425                                    query.append(WHERE_AND);
426                            }
427    
428                            for (int i = 0; i < orderByConditionFields.length; i++) {
429                                    query.append(_ORDER_BY_ENTITY_ALIAS);
430                                    query.append(orderByConditionFields[i]);
431    
432                                    if ((i + 1) < orderByConditionFields.length) {
433                                            if (orderByComparator.isAscending() ^ previous) {
434                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
435                                            }
436                                            else {
437                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
438                                            }
439                                    }
440                                    else {
441                                            if (orderByComparator.isAscending() ^ previous) {
442                                                    query.append(WHERE_GREATER_THAN);
443                                            }
444                                            else {
445                                                    query.append(WHERE_LESSER_THAN);
446                                            }
447                                    }
448                            }
449    
450                            query.append(ORDER_BY_CLAUSE);
451    
452                            String[] orderByFields = orderByComparator.getOrderByFields();
453    
454                            for (int i = 0; i < orderByFields.length; i++) {
455                                    query.append(_ORDER_BY_ENTITY_ALIAS);
456                                    query.append(orderByFields[i]);
457    
458                                    if ((i + 1) < orderByFields.length) {
459                                            if (orderByComparator.isAscending() ^ previous) {
460                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
461                                            }
462                                            else {
463                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
464                                            }
465                                    }
466                                    else {
467                                            if (orderByComparator.isAscending() ^ previous) {
468                                                    query.append(ORDER_BY_ASC);
469                                            }
470                                            else {
471                                                    query.append(ORDER_BY_DESC);
472                                            }
473                                    }
474                            }
475                    }
476                    else {
477                            query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
478                    }
479    
480                    String sql = query.toString();
481    
482                    Query q = session.createQuery(sql);
483    
484                    q.setFirstResult(0);
485                    q.setMaxResults(2);
486    
487                    QueryPos qPos = QueryPos.getInstance(q);
488    
489                    qPos.add(groupId);
490    
491                    if (orderByComparator != null) {
492                            Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
493    
494                            for (Object value : values) {
495                                    qPos.add(value);
496                            }
497                    }
498    
499                    List<ExportImportConfiguration> list = q.list();
500    
501                    if (list.size() == 2) {
502                            return list.get(1);
503                    }
504                    else {
505                            return null;
506                    }
507            }
508    
509            /**
510             * Removes all the export import configurations where groupId = &#63; from the database.
511             *
512             * @param groupId the group ID
513             */
514            @Override
515            public void removeByGroupId(long groupId) {
516                    for (ExportImportConfiguration exportImportConfiguration : findByGroupId(
517                                    groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
518                            remove(exportImportConfiguration);
519                    }
520            }
521    
522            /**
523             * Returns the number of export import configurations where groupId = &#63;.
524             *
525             * @param groupId the group ID
526             * @return the number of matching export import configurations
527             */
528            @Override
529            public int countByGroupId(long groupId) {
530                    FinderPath finderPath = FINDER_PATH_COUNT_BY_GROUPID;
531    
532                    Object[] finderArgs = new Object[] { groupId };
533    
534                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
535                                    this);
536    
537                    if (count == null) {
538                            StringBundler query = new StringBundler(2);
539    
540                            query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
541    
542                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
543    
544                            String sql = query.toString();
545    
546                            Session session = null;
547    
548                            try {
549                                    session = openSession();
550    
551                                    Query q = session.createQuery(sql);
552    
553                                    QueryPos qPos = QueryPos.getInstance(q);
554    
555                                    qPos.add(groupId);
556    
557                                    count = (Long)q.uniqueResult();
558    
559                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
560                            }
561                            catch (Exception e) {
562                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
563    
564                                    throw processException(e);
565                            }
566                            finally {
567                                    closeSession(session);
568                            }
569                    }
570    
571                    return count.intValue();
572            }
573    
574            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "exportImportConfiguration.groupId = ?";
575            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID =
576                    new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
577                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
578                            ExportImportConfigurationImpl.class,
579                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
580                            new String[] {
581                                    Long.class.getName(),
582                                    
583                            Integer.class.getName(), Integer.class.getName(),
584                                    OrderByComparator.class.getName()
585                            });
586            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID =
587                    new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
588                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
589                            ExportImportConfigurationImpl.class,
590                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
591                            new String[] { Long.class.getName() },
592                            ExportImportConfigurationModelImpl.COMPANYID_COLUMN_BITMASK |
593                            ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
594            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
595                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
596                            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
597                            "countByCompanyId", new String[] { Long.class.getName() });
598    
599            /**
600             * Returns all the export import configurations where companyId = &#63;.
601             *
602             * @param companyId the company ID
603             * @return the matching export import configurations
604             */
605            @Override
606            public List<ExportImportConfiguration> findByCompanyId(long companyId) {
607                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
608                            null);
609            }
610    
611            /**
612             * Returns a range of all the export import configurations where companyId = &#63;.
613             *
614             * <p>
615             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
616             * </p>
617             *
618             * @param companyId the company ID
619             * @param start the lower bound of the range of export import configurations
620             * @param end the upper bound of the range of export import configurations (not inclusive)
621             * @return the range of matching export import configurations
622             */
623            @Override
624            public List<ExportImportConfiguration> findByCompanyId(long companyId,
625                    int start, int end) {
626                    return findByCompanyId(companyId, start, end, null);
627            }
628    
629            /**
630             * Returns an ordered range of all the export import configurations where companyId = &#63;.
631             *
632             * <p>
633             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
634             * </p>
635             *
636             * @param companyId the company ID
637             * @param start the lower bound of the range of export import configurations
638             * @param end the upper bound of the range of export import configurations (not inclusive)
639             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
640             * @return the ordered range of matching export import configurations
641             */
642            @Override
643            public List<ExportImportConfiguration> findByCompanyId(long companyId,
644                    int start, int end,
645                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
646                    boolean pagination = true;
647                    FinderPath finderPath = null;
648                    Object[] finderArgs = null;
649    
650                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
651                                    (orderByComparator == null)) {
652                            pagination = false;
653                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID;
654                            finderArgs = new Object[] { companyId };
655                    }
656                    else {
657                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_COMPANYID;
658                            finderArgs = new Object[] { companyId, start, end, orderByComparator };
659                    }
660    
661                    List<ExportImportConfiguration> list = (List<ExportImportConfiguration>)FinderCacheUtil.getResult(finderPath,
662                                    finderArgs, this);
663    
664                    if ((list != null) && !list.isEmpty()) {
665                            for (ExportImportConfiguration exportImportConfiguration : list) {
666                                    if ((companyId != exportImportConfiguration.getCompanyId())) {
667                                            list = null;
668    
669                                            break;
670                                    }
671                            }
672                    }
673    
674                    if (list == null) {
675                            StringBundler query = null;
676    
677                            if (orderByComparator != null) {
678                                    query = new StringBundler(3 +
679                                                    (orderByComparator.getOrderByFields().length * 3));
680                            }
681                            else {
682                                    query = new StringBundler(3);
683                            }
684    
685                            query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
686    
687                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
688    
689                            if (orderByComparator != null) {
690                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
691                                            orderByComparator);
692                            }
693                            else
694                             if (pagination) {
695                                    query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
696                            }
697    
698                            String sql = query.toString();
699    
700                            Session session = null;
701    
702                            try {
703                                    session = openSession();
704    
705                                    Query q = session.createQuery(sql);
706    
707                                    QueryPos qPos = QueryPos.getInstance(q);
708    
709                                    qPos.add(companyId);
710    
711                                    if (!pagination) {
712                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
713                                                            getDialect(), start, end, false);
714    
715                                            Collections.sort(list);
716    
717                                            list = Collections.unmodifiableList(list);
718                                    }
719                                    else {
720                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
721                                                            getDialect(), start, end);
722                                    }
723    
724                                    cacheResult(list);
725    
726                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
727                            }
728                            catch (Exception e) {
729                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
730    
731                                    throw processException(e);
732                            }
733                            finally {
734                                    closeSession(session);
735                            }
736                    }
737    
738                    return list;
739            }
740    
741            /**
742             * Returns the first export import configuration in the ordered set where companyId = &#63;.
743             *
744             * @param companyId the company ID
745             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
746             * @return the first matching export import configuration
747             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
748             */
749            @Override
750            public ExportImportConfiguration findByCompanyId_First(long companyId,
751                    OrderByComparator<ExportImportConfiguration> orderByComparator)
752                    throws NoSuchExportImportConfigurationException {
753                    ExportImportConfiguration exportImportConfiguration = fetchByCompanyId_First(companyId,
754                                    orderByComparator);
755    
756                    if (exportImportConfiguration != null) {
757                            return exportImportConfiguration;
758                    }
759    
760                    StringBundler msg = new StringBundler(4);
761    
762                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
763    
764                    msg.append("companyId=");
765                    msg.append(companyId);
766    
767                    msg.append(StringPool.CLOSE_CURLY_BRACE);
768    
769                    throw new NoSuchExportImportConfigurationException(msg.toString());
770            }
771    
772            /**
773             * Returns the first export import configuration in the ordered set where companyId = &#63;.
774             *
775             * @param companyId the company ID
776             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
777             * @return the first matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
778             */
779            @Override
780            public ExportImportConfiguration fetchByCompanyId_First(long companyId,
781                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
782                    List<ExportImportConfiguration> list = findByCompanyId(companyId, 0, 1,
783                                    orderByComparator);
784    
785                    if (!list.isEmpty()) {
786                            return list.get(0);
787                    }
788    
789                    return null;
790            }
791    
792            /**
793             * Returns the last export import configuration in the ordered set where companyId = &#63;.
794             *
795             * @param companyId the company ID
796             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
797             * @return the last matching export import configuration
798             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
799             */
800            @Override
801            public ExportImportConfiguration findByCompanyId_Last(long companyId,
802                    OrderByComparator<ExportImportConfiguration> orderByComparator)
803                    throws NoSuchExportImportConfigurationException {
804                    ExportImportConfiguration exportImportConfiguration = fetchByCompanyId_Last(companyId,
805                                    orderByComparator);
806    
807                    if (exportImportConfiguration != null) {
808                            return exportImportConfiguration;
809                    }
810    
811                    StringBundler msg = new StringBundler(4);
812    
813                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
814    
815                    msg.append("companyId=");
816                    msg.append(companyId);
817    
818                    msg.append(StringPool.CLOSE_CURLY_BRACE);
819    
820                    throw new NoSuchExportImportConfigurationException(msg.toString());
821            }
822    
823            /**
824             * Returns the last export import configuration in the ordered set where companyId = &#63;.
825             *
826             * @param companyId the company ID
827             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
828             * @return the last matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
829             */
830            @Override
831            public ExportImportConfiguration fetchByCompanyId_Last(long companyId,
832                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
833                    int count = countByCompanyId(companyId);
834    
835                    if (count == 0) {
836                            return null;
837                    }
838    
839                    List<ExportImportConfiguration> list = findByCompanyId(companyId,
840                                    count - 1, count, orderByComparator);
841    
842                    if (!list.isEmpty()) {
843                            return list.get(0);
844                    }
845    
846                    return null;
847            }
848    
849            /**
850             * Returns the export import configurations before and after the current export import configuration in the ordered set where companyId = &#63;.
851             *
852             * @param exportImportConfigurationId the primary key of the current export import configuration
853             * @param companyId the company ID
854             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
855             * @return the previous, current, and next export import configuration
856             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
857             */
858            @Override
859            public ExportImportConfiguration[] findByCompanyId_PrevAndNext(
860                    long exportImportConfigurationId, long companyId,
861                    OrderByComparator<ExportImportConfiguration> orderByComparator)
862                    throws NoSuchExportImportConfigurationException {
863                    ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
864    
865                    Session session = null;
866    
867                    try {
868                            session = openSession();
869    
870                            ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
871    
872                            array[0] = getByCompanyId_PrevAndNext(session,
873                                            exportImportConfiguration, companyId, orderByComparator,
874                                            true);
875    
876                            array[1] = exportImportConfiguration;
877    
878                            array[2] = getByCompanyId_PrevAndNext(session,
879                                            exportImportConfiguration, companyId, orderByComparator,
880                                            false);
881    
882                            return array;
883                    }
884                    catch (Exception e) {
885                            throw processException(e);
886                    }
887                    finally {
888                            closeSession(session);
889                    }
890            }
891    
892            protected ExportImportConfiguration getByCompanyId_PrevAndNext(
893                    Session session, ExportImportConfiguration exportImportConfiguration,
894                    long companyId,
895                    OrderByComparator<ExportImportConfiguration> orderByComparator,
896                    boolean previous) {
897                    StringBundler query = null;
898    
899                    if (orderByComparator != null) {
900                            query = new StringBundler(6 +
901                                            (orderByComparator.getOrderByFields().length * 6));
902                    }
903                    else {
904                            query = new StringBundler(3);
905                    }
906    
907                    query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
908    
909                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
910    
911                    if (orderByComparator != null) {
912                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
913    
914                            if (orderByConditionFields.length > 0) {
915                                    query.append(WHERE_AND);
916                            }
917    
918                            for (int i = 0; i < orderByConditionFields.length; i++) {
919                                    query.append(_ORDER_BY_ENTITY_ALIAS);
920                                    query.append(orderByConditionFields[i]);
921    
922                                    if ((i + 1) < orderByConditionFields.length) {
923                                            if (orderByComparator.isAscending() ^ previous) {
924                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
925                                            }
926                                            else {
927                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
928                                            }
929                                    }
930                                    else {
931                                            if (orderByComparator.isAscending() ^ previous) {
932                                                    query.append(WHERE_GREATER_THAN);
933                                            }
934                                            else {
935                                                    query.append(WHERE_LESSER_THAN);
936                                            }
937                                    }
938                            }
939    
940                            query.append(ORDER_BY_CLAUSE);
941    
942                            String[] orderByFields = orderByComparator.getOrderByFields();
943    
944                            for (int i = 0; i < orderByFields.length; i++) {
945                                    query.append(_ORDER_BY_ENTITY_ALIAS);
946                                    query.append(orderByFields[i]);
947    
948                                    if ((i + 1) < orderByFields.length) {
949                                            if (orderByComparator.isAscending() ^ previous) {
950                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
951                                            }
952                                            else {
953                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
954                                            }
955                                    }
956                                    else {
957                                            if (orderByComparator.isAscending() ^ previous) {
958                                                    query.append(ORDER_BY_ASC);
959                                            }
960                                            else {
961                                                    query.append(ORDER_BY_DESC);
962                                            }
963                                    }
964                            }
965                    }
966                    else {
967                            query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
968                    }
969    
970                    String sql = query.toString();
971    
972                    Query q = session.createQuery(sql);
973    
974                    q.setFirstResult(0);
975                    q.setMaxResults(2);
976    
977                    QueryPos qPos = QueryPos.getInstance(q);
978    
979                    qPos.add(companyId);
980    
981                    if (orderByComparator != null) {
982                            Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
983    
984                            for (Object value : values) {
985                                    qPos.add(value);
986                            }
987                    }
988    
989                    List<ExportImportConfiguration> list = q.list();
990    
991                    if (list.size() == 2) {
992                            return list.get(1);
993                    }
994                    else {
995                            return null;
996                    }
997            }
998    
999            /**
1000             * Removes all the export import configurations where companyId = &#63; from the database.
1001             *
1002             * @param companyId the company ID
1003             */
1004            @Override
1005            public void removeByCompanyId(long companyId) {
1006                    for (ExportImportConfiguration exportImportConfiguration : findByCompanyId(
1007                                    companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1008                            remove(exportImportConfiguration);
1009                    }
1010            }
1011    
1012            /**
1013             * Returns the number of export import configurations where companyId = &#63;.
1014             *
1015             * @param companyId the company ID
1016             * @return the number of matching export import configurations
1017             */
1018            @Override
1019            public int countByCompanyId(long companyId) {
1020                    FinderPath finderPath = FINDER_PATH_COUNT_BY_COMPANYID;
1021    
1022                    Object[] finderArgs = new Object[] { companyId };
1023    
1024                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1025                                    this);
1026    
1027                    if (count == null) {
1028                            StringBundler query = new StringBundler(2);
1029    
1030                            query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
1031    
1032                            query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1033    
1034                            String sql = query.toString();
1035    
1036                            Session session = null;
1037    
1038                            try {
1039                                    session = openSession();
1040    
1041                                    Query q = session.createQuery(sql);
1042    
1043                                    QueryPos qPos = QueryPos.getInstance(q);
1044    
1045                                    qPos.add(companyId);
1046    
1047                                    count = (Long)q.uniqueResult();
1048    
1049                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
1050                            }
1051                            catch (Exception e) {
1052                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1053    
1054                                    throw processException(e);
1055                            }
1056                            finally {
1057                                    closeSession(session);
1058                            }
1059                    }
1060    
1061                    return count.intValue();
1062            }
1063    
1064            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "exportImportConfiguration.companyId = ?";
1065            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1066                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1067                            ExportImportConfigurationImpl.class,
1068                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_T",
1069                            new String[] {
1070                                    Long.class.getName(), Integer.class.getName(),
1071                                    
1072                            Integer.class.getName(), Integer.class.getName(),
1073                                    OrderByComparator.class.getName()
1074                            });
1075            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1076                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1077                            ExportImportConfigurationImpl.class,
1078                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_T",
1079                            new String[] { Long.class.getName(), Integer.class.getName() },
1080                            ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
1081                            ExportImportConfigurationModelImpl.TYPE_COLUMN_BITMASK |
1082                            ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
1083            public static final FinderPath FINDER_PATH_COUNT_BY_G_T = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1084                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1085                            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
1086                            "countByG_T",
1087                            new String[] { Long.class.getName(), Integer.class.getName() });
1088    
1089            /**
1090             * Returns all the export import configurations where groupId = &#63; and type = &#63;.
1091             *
1092             * @param groupId the group ID
1093             * @param type the type
1094             * @return the matching export import configurations
1095             */
1096            @Override
1097            public List<ExportImportConfiguration> findByG_T(long groupId, int type) {
1098                    return findByG_T(groupId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1099                            null);
1100            }
1101    
1102            /**
1103             * Returns a range of all the export import configurations where groupId = &#63; and type = &#63;.
1104             *
1105             * <p>
1106             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1107             * </p>
1108             *
1109             * @param groupId the group ID
1110             * @param type the type
1111             * @param start the lower bound of the range of export import configurations
1112             * @param end the upper bound of the range of export import configurations (not inclusive)
1113             * @return the range of matching export import configurations
1114             */
1115            @Override
1116            public List<ExportImportConfiguration> findByG_T(long groupId, int type,
1117                    int start, int end) {
1118                    return findByG_T(groupId, type, start, end, null);
1119            }
1120    
1121            /**
1122             * Returns an ordered range of all the export import configurations where groupId = &#63; and type = &#63;.
1123             *
1124             * <p>
1125             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1126             * </p>
1127             *
1128             * @param groupId the group ID
1129             * @param type the type
1130             * @param start the lower bound of the range of export import configurations
1131             * @param end the upper bound of the range of export import configurations (not inclusive)
1132             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1133             * @return the ordered range of matching export import configurations
1134             */
1135            @Override
1136            public List<ExportImportConfiguration> findByG_T(long groupId, int type,
1137                    int start, int end,
1138                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
1139                    boolean pagination = true;
1140                    FinderPath finderPath = null;
1141                    Object[] finderArgs = null;
1142    
1143                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1144                                    (orderByComparator == null)) {
1145                            pagination = false;
1146                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T;
1147                            finderArgs = new Object[] { groupId, type };
1148                    }
1149                    else {
1150                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T;
1151                            finderArgs = new Object[] {
1152                                            groupId, type,
1153                                            
1154                                            start, end, orderByComparator
1155                                    };
1156                    }
1157    
1158                    List<ExportImportConfiguration> list = (List<ExportImportConfiguration>)FinderCacheUtil.getResult(finderPath,
1159                                    finderArgs, this);
1160    
1161                    if ((list != null) && !list.isEmpty()) {
1162                            for (ExportImportConfiguration exportImportConfiguration : list) {
1163                                    if ((groupId != exportImportConfiguration.getGroupId()) ||
1164                                                    (type != exportImportConfiguration.getType())) {
1165                                            list = null;
1166    
1167                                            break;
1168                                    }
1169                            }
1170                    }
1171    
1172                    if (list == null) {
1173                            StringBundler query = null;
1174    
1175                            if (orderByComparator != null) {
1176                                    query = new StringBundler(4 +
1177                                                    (orderByComparator.getOrderByFields().length * 3));
1178                            }
1179                            else {
1180                                    query = new StringBundler(4);
1181                            }
1182    
1183                            query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
1184    
1185                            query.append(_FINDER_COLUMN_G_T_GROUPID_2);
1186    
1187                            query.append(_FINDER_COLUMN_G_T_TYPE_2);
1188    
1189                            if (orderByComparator != null) {
1190                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1191                                            orderByComparator);
1192                            }
1193                            else
1194                             if (pagination) {
1195                                    query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
1196                            }
1197    
1198                            String sql = query.toString();
1199    
1200                            Session session = null;
1201    
1202                            try {
1203                                    session = openSession();
1204    
1205                                    Query q = session.createQuery(sql);
1206    
1207                                    QueryPos qPos = QueryPos.getInstance(q);
1208    
1209                                    qPos.add(groupId);
1210    
1211                                    qPos.add(type);
1212    
1213                                    if (!pagination) {
1214                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1215                                                            getDialect(), start, end, false);
1216    
1217                                            Collections.sort(list);
1218    
1219                                            list = Collections.unmodifiableList(list);
1220                                    }
1221                                    else {
1222                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1223                                                            getDialect(), start, end);
1224                                    }
1225    
1226                                    cacheResult(list);
1227    
1228                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1229                            }
1230                            catch (Exception e) {
1231                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1232    
1233                                    throw processException(e);
1234                            }
1235                            finally {
1236                                    closeSession(session);
1237                            }
1238                    }
1239    
1240                    return list;
1241            }
1242    
1243            /**
1244             * Returns the first export import configuration in the ordered set where groupId = &#63; and type = &#63;.
1245             *
1246             * @param groupId the group ID
1247             * @param type the type
1248             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1249             * @return the first matching export import configuration
1250             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
1251             */
1252            @Override
1253            public ExportImportConfiguration findByG_T_First(long groupId, int type,
1254                    OrderByComparator<ExportImportConfiguration> orderByComparator)
1255                    throws NoSuchExportImportConfigurationException {
1256                    ExportImportConfiguration exportImportConfiguration = fetchByG_T_First(groupId,
1257                                    type, orderByComparator);
1258    
1259                    if (exportImportConfiguration != null) {
1260                            return exportImportConfiguration;
1261                    }
1262    
1263                    StringBundler msg = new StringBundler(6);
1264    
1265                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1266    
1267                    msg.append("groupId=");
1268                    msg.append(groupId);
1269    
1270                    msg.append(", type=");
1271                    msg.append(type);
1272    
1273                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1274    
1275                    throw new NoSuchExportImportConfigurationException(msg.toString());
1276            }
1277    
1278            /**
1279             * Returns the first export import configuration in the ordered set where groupId = &#63; and type = &#63;.
1280             *
1281             * @param groupId the group ID
1282             * @param type the type
1283             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1284             * @return the first matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
1285             */
1286            @Override
1287            public ExportImportConfiguration fetchByG_T_First(long groupId, int type,
1288                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
1289                    List<ExportImportConfiguration> list = findByG_T(groupId, type, 0, 1,
1290                                    orderByComparator);
1291    
1292                    if (!list.isEmpty()) {
1293                            return list.get(0);
1294                    }
1295    
1296                    return null;
1297            }
1298    
1299            /**
1300             * Returns the last export import configuration in the ordered set where groupId = &#63; and type = &#63;.
1301             *
1302             * @param groupId the group ID
1303             * @param type the type
1304             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1305             * @return the last matching export import configuration
1306             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
1307             */
1308            @Override
1309            public ExportImportConfiguration findByG_T_Last(long groupId, int type,
1310                    OrderByComparator<ExportImportConfiguration> orderByComparator)
1311                    throws NoSuchExportImportConfigurationException {
1312                    ExportImportConfiguration exportImportConfiguration = fetchByG_T_Last(groupId,
1313                                    type, orderByComparator);
1314    
1315                    if (exportImportConfiguration != null) {
1316                            return exportImportConfiguration;
1317                    }
1318    
1319                    StringBundler msg = new StringBundler(6);
1320    
1321                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1322    
1323                    msg.append("groupId=");
1324                    msg.append(groupId);
1325    
1326                    msg.append(", type=");
1327                    msg.append(type);
1328    
1329                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1330    
1331                    throw new NoSuchExportImportConfigurationException(msg.toString());
1332            }
1333    
1334            /**
1335             * Returns the last export import configuration in the ordered set where groupId = &#63; and type = &#63;.
1336             *
1337             * @param groupId the group ID
1338             * @param type the type
1339             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1340             * @return the last matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
1341             */
1342            @Override
1343            public ExportImportConfiguration fetchByG_T_Last(long groupId, int type,
1344                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
1345                    int count = countByG_T(groupId, type);
1346    
1347                    if (count == 0) {
1348                            return null;
1349                    }
1350    
1351                    List<ExportImportConfiguration> list = findByG_T(groupId, type,
1352                                    count - 1, count, orderByComparator);
1353    
1354                    if (!list.isEmpty()) {
1355                            return list.get(0);
1356                    }
1357    
1358                    return null;
1359            }
1360    
1361            /**
1362             * Returns the export import configurations before and after the current export import configuration in the ordered set where groupId = &#63; and type = &#63;.
1363             *
1364             * @param exportImportConfigurationId the primary key of the current export import configuration
1365             * @param groupId the group ID
1366             * @param type the type
1367             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1368             * @return the previous, current, and next export import configuration
1369             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
1370             */
1371            @Override
1372            public ExportImportConfiguration[] findByG_T_PrevAndNext(
1373                    long exportImportConfigurationId, long groupId, int type,
1374                    OrderByComparator<ExportImportConfiguration> orderByComparator)
1375                    throws NoSuchExportImportConfigurationException {
1376                    ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
1377    
1378                    Session session = null;
1379    
1380                    try {
1381                            session = openSession();
1382    
1383                            ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
1384    
1385                            array[0] = getByG_T_PrevAndNext(session, exportImportConfiguration,
1386                                            groupId, type, orderByComparator, true);
1387    
1388                            array[1] = exportImportConfiguration;
1389    
1390                            array[2] = getByG_T_PrevAndNext(session, exportImportConfiguration,
1391                                            groupId, type, orderByComparator, false);
1392    
1393                            return array;
1394                    }
1395                    catch (Exception e) {
1396                            throw processException(e);
1397                    }
1398                    finally {
1399                            closeSession(session);
1400                    }
1401            }
1402    
1403            protected ExportImportConfiguration getByG_T_PrevAndNext(Session session,
1404                    ExportImportConfiguration exportImportConfiguration, long groupId,
1405                    int type,
1406                    OrderByComparator<ExportImportConfiguration> orderByComparator,
1407                    boolean previous) {
1408                    StringBundler query = null;
1409    
1410                    if (orderByComparator != null) {
1411                            query = new StringBundler(6 +
1412                                            (orderByComparator.getOrderByFields().length * 6));
1413                    }
1414                    else {
1415                            query = new StringBundler(3);
1416                    }
1417    
1418                    query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
1419    
1420                    query.append(_FINDER_COLUMN_G_T_GROUPID_2);
1421    
1422                    query.append(_FINDER_COLUMN_G_T_TYPE_2);
1423    
1424                    if (orderByComparator != null) {
1425                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1426    
1427                            if (orderByConditionFields.length > 0) {
1428                                    query.append(WHERE_AND);
1429                            }
1430    
1431                            for (int i = 0; i < orderByConditionFields.length; i++) {
1432                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1433                                    query.append(orderByConditionFields[i]);
1434    
1435                                    if ((i + 1) < orderByConditionFields.length) {
1436                                            if (orderByComparator.isAscending() ^ previous) {
1437                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1438                                            }
1439                                            else {
1440                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1441                                            }
1442                                    }
1443                                    else {
1444                                            if (orderByComparator.isAscending() ^ previous) {
1445                                                    query.append(WHERE_GREATER_THAN);
1446                                            }
1447                                            else {
1448                                                    query.append(WHERE_LESSER_THAN);
1449                                            }
1450                                    }
1451                            }
1452    
1453                            query.append(ORDER_BY_CLAUSE);
1454    
1455                            String[] orderByFields = orderByComparator.getOrderByFields();
1456    
1457                            for (int i = 0; i < orderByFields.length; i++) {
1458                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1459                                    query.append(orderByFields[i]);
1460    
1461                                    if ((i + 1) < orderByFields.length) {
1462                                            if (orderByComparator.isAscending() ^ previous) {
1463                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1464                                            }
1465                                            else {
1466                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1467                                            }
1468                                    }
1469                                    else {
1470                                            if (orderByComparator.isAscending() ^ previous) {
1471                                                    query.append(ORDER_BY_ASC);
1472                                            }
1473                                            else {
1474                                                    query.append(ORDER_BY_DESC);
1475                                            }
1476                                    }
1477                            }
1478                    }
1479                    else {
1480                            query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
1481                    }
1482    
1483                    String sql = query.toString();
1484    
1485                    Query q = session.createQuery(sql);
1486    
1487                    q.setFirstResult(0);
1488                    q.setMaxResults(2);
1489    
1490                    QueryPos qPos = QueryPos.getInstance(q);
1491    
1492                    qPos.add(groupId);
1493    
1494                    qPos.add(type);
1495    
1496                    if (orderByComparator != null) {
1497                            Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
1498    
1499                            for (Object value : values) {
1500                                    qPos.add(value);
1501                            }
1502                    }
1503    
1504                    List<ExportImportConfiguration> list = q.list();
1505    
1506                    if (list.size() == 2) {
1507                            return list.get(1);
1508                    }
1509                    else {
1510                            return null;
1511                    }
1512            }
1513    
1514            /**
1515             * Removes all the export import configurations where groupId = &#63; and type = &#63; from the database.
1516             *
1517             * @param groupId the group ID
1518             * @param type the type
1519             */
1520            @Override
1521            public void removeByG_T(long groupId, int type) {
1522                    for (ExportImportConfiguration exportImportConfiguration : findByG_T(
1523                                    groupId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1524                            remove(exportImportConfiguration);
1525                    }
1526            }
1527    
1528            /**
1529             * Returns the number of export import configurations where groupId = &#63; and type = &#63;.
1530             *
1531             * @param groupId the group ID
1532             * @param type the type
1533             * @return the number of matching export import configurations
1534             */
1535            @Override
1536            public int countByG_T(long groupId, int type) {
1537                    FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T;
1538    
1539                    Object[] finderArgs = new Object[] { groupId, type };
1540    
1541                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
1542                                    this);
1543    
1544                    if (count == null) {
1545                            StringBundler query = new StringBundler(3);
1546    
1547                            query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
1548    
1549                            query.append(_FINDER_COLUMN_G_T_GROUPID_2);
1550    
1551                            query.append(_FINDER_COLUMN_G_T_TYPE_2);
1552    
1553                            String sql = query.toString();
1554    
1555                            Session session = null;
1556    
1557                            try {
1558                                    session = openSession();
1559    
1560                                    Query q = session.createQuery(sql);
1561    
1562                                    QueryPos qPos = QueryPos.getInstance(q);
1563    
1564                                    qPos.add(groupId);
1565    
1566                                    qPos.add(type);
1567    
1568                                    count = (Long)q.uniqueResult();
1569    
1570                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
1571                            }
1572                            catch (Exception e) {
1573                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1574    
1575                                    throw processException(e);
1576                            }
1577                            finally {
1578                                    closeSession(session);
1579                            }
1580                    }
1581    
1582                    return count.intValue();
1583            }
1584    
1585            private static final String _FINDER_COLUMN_G_T_GROUPID_2 = "exportImportConfiguration.groupId = ? AND ";
1586            private static final String _FINDER_COLUMN_G_T_TYPE_2 = "exportImportConfiguration.type = ?";
1587            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1588                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1589                            ExportImportConfigurationImpl.class,
1590                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_S",
1591                            new String[] {
1592                                    Long.class.getName(), Integer.class.getName(),
1593                                    
1594                            Integer.class.getName(), Integer.class.getName(),
1595                                    OrderByComparator.class.getName()
1596                            });
1597            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1598                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1599                            ExportImportConfigurationImpl.class,
1600                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S",
1601                            new String[] { Long.class.getName(), Integer.class.getName() },
1602                            ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
1603                            ExportImportConfigurationModelImpl.STATUS_COLUMN_BITMASK |
1604                            ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
1605            public static final FinderPath FINDER_PATH_COUNT_BY_G_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
1606                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
1607                            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
1608                            "countByG_S",
1609                            new String[] { Long.class.getName(), Integer.class.getName() });
1610    
1611            /**
1612             * Returns all the export import configurations where groupId = &#63; and status = &#63;.
1613             *
1614             * @param groupId the group ID
1615             * @param status the status
1616             * @return the matching export import configurations
1617             */
1618            @Override
1619            public List<ExportImportConfiguration> findByG_S(long groupId, int status) {
1620                    return findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1621                            null);
1622            }
1623    
1624            /**
1625             * Returns a range of all the export import configurations where groupId = &#63; and status = &#63;.
1626             *
1627             * <p>
1628             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1629             * </p>
1630             *
1631             * @param groupId the group ID
1632             * @param status the status
1633             * @param start the lower bound of the range of export import configurations
1634             * @param end the upper bound of the range of export import configurations (not inclusive)
1635             * @return the range of matching export import configurations
1636             */
1637            @Override
1638            public List<ExportImportConfiguration> findByG_S(long groupId, int status,
1639                    int start, int end) {
1640                    return findByG_S(groupId, status, start, end, null);
1641            }
1642    
1643            /**
1644             * Returns an ordered range of all the export import configurations where groupId = &#63; and status = &#63;.
1645             *
1646             * <p>
1647             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1648             * </p>
1649             *
1650             * @param groupId the group ID
1651             * @param status the status
1652             * @param start the lower bound of the range of export import configurations
1653             * @param end the upper bound of the range of export import configurations (not inclusive)
1654             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1655             * @return the ordered range of matching export import configurations
1656             */
1657            @Override
1658            public List<ExportImportConfiguration> findByG_S(long groupId, int status,
1659                    int start, int end,
1660                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
1661                    boolean pagination = true;
1662                    FinderPath finderPath = null;
1663                    Object[] finderArgs = null;
1664    
1665                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1666                                    (orderByComparator == null)) {
1667                            pagination = false;
1668                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S;
1669                            finderArgs = new Object[] { groupId, status };
1670                    }
1671                    else {
1672                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_S;
1673                            finderArgs = new Object[] {
1674                                            groupId, status,
1675                                            
1676                                            start, end, orderByComparator
1677                                    };
1678                    }
1679    
1680                    List<ExportImportConfiguration> list = (List<ExportImportConfiguration>)FinderCacheUtil.getResult(finderPath,
1681                                    finderArgs, this);
1682    
1683                    if ((list != null) && !list.isEmpty()) {
1684                            for (ExportImportConfiguration exportImportConfiguration : list) {
1685                                    if ((groupId != exportImportConfiguration.getGroupId()) ||
1686                                                    (status != exportImportConfiguration.getStatus())) {
1687                                            list = null;
1688    
1689                                            break;
1690                                    }
1691                            }
1692                    }
1693    
1694                    if (list == null) {
1695                            StringBundler query = null;
1696    
1697                            if (orderByComparator != null) {
1698                                    query = new StringBundler(4 +
1699                                                    (orderByComparator.getOrderByFields().length * 3));
1700                            }
1701                            else {
1702                                    query = new StringBundler(4);
1703                            }
1704    
1705                            query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
1706    
1707                            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
1708    
1709                            query.append(_FINDER_COLUMN_G_S_STATUS_2);
1710    
1711                            if (orderByComparator != null) {
1712                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1713                                            orderByComparator);
1714                            }
1715                            else
1716                             if (pagination) {
1717                                    query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
1718                            }
1719    
1720                            String sql = query.toString();
1721    
1722                            Session session = null;
1723    
1724                            try {
1725                                    session = openSession();
1726    
1727                                    Query q = session.createQuery(sql);
1728    
1729                                    QueryPos qPos = QueryPos.getInstance(q);
1730    
1731                                    qPos.add(groupId);
1732    
1733                                    qPos.add(status);
1734    
1735                                    if (!pagination) {
1736                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1737                                                            getDialect(), start, end, false);
1738    
1739                                            Collections.sort(list);
1740    
1741                                            list = Collections.unmodifiableList(list);
1742                                    }
1743                                    else {
1744                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
1745                                                            getDialect(), start, end);
1746                                    }
1747    
1748                                    cacheResult(list);
1749    
1750                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1751                            }
1752                            catch (Exception e) {
1753                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1754    
1755                                    throw processException(e);
1756                            }
1757                            finally {
1758                                    closeSession(session);
1759                            }
1760                    }
1761    
1762                    return list;
1763            }
1764    
1765            /**
1766             * Returns the first export import configuration in the ordered set where groupId = &#63; and status = &#63;.
1767             *
1768             * @param groupId the group ID
1769             * @param status the status
1770             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1771             * @return the first matching export import configuration
1772             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
1773             */
1774            @Override
1775            public ExportImportConfiguration findByG_S_First(long groupId, int status,
1776                    OrderByComparator<ExportImportConfiguration> orderByComparator)
1777                    throws NoSuchExportImportConfigurationException {
1778                    ExportImportConfiguration exportImportConfiguration = fetchByG_S_First(groupId,
1779                                    status, orderByComparator);
1780    
1781                    if (exportImportConfiguration != null) {
1782                            return exportImportConfiguration;
1783                    }
1784    
1785                    StringBundler msg = new StringBundler(6);
1786    
1787                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1788    
1789                    msg.append("groupId=");
1790                    msg.append(groupId);
1791    
1792                    msg.append(", status=");
1793                    msg.append(status);
1794    
1795                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1796    
1797                    throw new NoSuchExportImportConfigurationException(msg.toString());
1798            }
1799    
1800            /**
1801             * Returns the first export import configuration in the ordered set where groupId = &#63; and status = &#63;.
1802             *
1803             * @param groupId the group ID
1804             * @param status the status
1805             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1806             * @return the first matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
1807             */
1808            @Override
1809            public ExportImportConfiguration fetchByG_S_First(long groupId, int status,
1810                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
1811                    List<ExportImportConfiguration> list = findByG_S(groupId, status, 0, 1,
1812                                    orderByComparator);
1813    
1814                    if (!list.isEmpty()) {
1815                            return list.get(0);
1816                    }
1817    
1818                    return null;
1819            }
1820    
1821            /**
1822             * Returns the last export import configuration in the ordered set where groupId = &#63; and status = &#63;.
1823             *
1824             * @param groupId the group ID
1825             * @param status the status
1826             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1827             * @return the last matching export import configuration
1828             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
1829             */
1830            @Override
1831            public ExportImportConfiguration findByG_S_Last(long groupId, int status,
1832                    OrderByComparator<ExportImportConfiguration> orderByComparator)
1833                    throws NoSuchExportImportConfigurationException {
1834                    ExportImportConfiguration exportImportConfiguration = fetchByG_S_Last(groupId,
1835                                    status, orderByComparator);
1836    
1837                    if (exportImportConfiguration != null) {
1838                            return exportImportConfiguration;
1839                    }
1840    
1841                    StringBundler msg = new StringBundler(6);
1842    
1843                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1844    
1845                    msg.append("groupId=");
1846                    msg.append(groupId);
1847    
1848                    msg.append(", status=");
1849                    msg.append(status);
1850    
1851                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1852    
1853                    throw new NoSuchExportImportConfigurationException(msg.toString());
1854            }
1855    
1856            /**
1857             * Returns the last export import configuration in the ordered set where groupId = &#63; and status = &#63;.
1858             *
1859             * @param groupId the group ID
1860             * @param status the status
1861             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1862             * @return the last matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
1863             */
1864            @Override
1865            public ExportImportConfiguration fetchByG_S_Last(long groupId, int status,
1866                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
1867                    int count = countByG_S(groupId, status);
1868    
1869                    if (count == 0) {
1870                            return null;
1871                    }
1872    
1873                    List<ExportImportConfiguration> list = findByG_S(groupId, status,
1874                                    count - 1, count, orderByComparator);
1875    
1876                    if (!list.isEmpty()) {
1877                            return list.get(0);
1878                    }
1879    
1880                    return null;
1881            }
1882    
1883            /**
1884             * Returns the export import configurations before and after the current export import configuration in the ordered set where groupId = &#63; and status = &#63;.
1885             *
1886             * @param exportImportConfigurationId the primary key of the current export import configuration
1887             * @param groupId the group ID
1888             * @param status the status
1889             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1890             * @return the previous, current, and next export import configuration
1891             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
1892             */
1893            @Override
1894            public ExportImportConfiguration[] findByG_S_PrevAndNext(
1895                    long exportImportConfigurationId, long groupId, int status,
1896                    OrderByComparator<ExportImportConfiguration> orderByComparator)
1897                    throws NoSuchExportImportConfigurationException {
1898                    ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
1899    
1900                    Session session = null;
1901    
1902                    try {
1903                            session = openSession();
1904    
1905                            ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
1906    
1907                            array[0] = getByG_S_PrevAndNext(session, exportImportConfiguration,
1908                                            groupId, status, orderByComparator, true);
1909    
1910                            array[1] = exportImportConfiguration;
1911    
1912                            array[2] = getByG_S_PrevAndNext(session, exportImportConfiguration,
1913                                            groupId, status, orderByComparator, false);
1914    
1915                            return array;
1916                    }
1917                    catch (Exception e) {
1918                            throw processException(e);
1919                    }
1920                    finally {
1921                            closeSession(session);
1922                    }
1923            }
1924    
1925            protected ExportImportConfiguration getByG_S_PrevAndNext(Session session,
1926                    ExportImportConfiguration exportImportConfiguration, long groupId,
1927                    int status,
1928                    OrderByComparator<ExportImportConfiguration> orderByComparator,
1929                    boolean previous) {
1930                    StringBundler query = null;
1931    
1932                    if (orderByComparator != null) {
1933                            query = new StringBundler(6 +
1934                                            (orderByComparator.getOrderByFields().length * 6));
1935                    }
1936                    else {
1937                            query = new StringBundler(3);
1938                    }
1939    
1940                    query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
1941    
1942                    query.append(_FINDER_COLUMN_G_S_GROUPID_2);
1943    
1944                    query.append(_FINDER_COLUMN_G_S_STATUS_2);
1945    
1946                    if (orderByComparator != null) {
1947                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1948    
1949                            if (orderByConditionFields.length > 0) {
1950                                    query.append(WHERE_AND);
1951                            }
1952    
1953                            for (int i = 0; i < orderByConditionFields.length; i++) {
1954                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1955                                    query.append(orderByConditionFields[i]);
1956    
1957                                    if ((i + 1) < orderByConditionFields.length) {
1958                                            if (orderByComparator.isAscending() ^ previous) {
1959                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1960                                            }
1961                                            else {
1962                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1963                                            }
1964                                    }
1965                                    else {
1966                                            if (orderByComparator.isAscending() ^ previous) {
1967                                                    query.append(WHERE_GREATER_THAN);
1968                                            }
1969                                            else {
1970                                                    query.append(WHERE_LESSER_THAN);
1971                                            }
1972                                    }
1973                            }
1974    
1975                            query.append(ORDER_BY_CLAUSE);
1976    
1977                            String[] orderByFields = orderByComparator.getOrderByFields();
1978    
1979                            for (int i = 0; i < orderByFields.length; i++) {
1980                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1981                                    query.append(orderByFields[i]);
1982    
1983                                    if ((i + 1) < orderByFields.length) {
1984                                            if (orderByComparator.isAscending() ^ previous) {
1985                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1986                                            }
1987                                            else {
1988                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1989                                            }
1990                                    }
1991                                    else {
1992                                            if (orderByComparator.isAscending() ^ previous) {
1993                                                    query.append(ORDER_BY_ASC);
1994                                            }
1995                                            else {
1996                                                    query.append(ORDER_BY_DESC);
1997                                            }
1998                                    }
1999                            }
2000                    }
2001                    else {
2002                            query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
2003                    }
2004    
2005                    String sql = query.toString();
2006    
2007                    Query q = session.createQuery(sql);
2008    
2009                    q.setFirstResult(0);
2010                    q.setMaxResults(2);
2011    
2012                    QueryPos qPos = QueryPos.getInstance(q);
2013    
2014                    qPos.add(groupId);
2015    
2016                    qPos.add(status);
2017    
2018                    if (orderByComparator != null) {
2019                            Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
2020    
2021                            for (Object value : values) {
2022                                    qPos.add(value);
2023                            }
2024                    }
2025    
2026                    List<ExportImportConfiguration> list = q.list();
2027    
2028                    if (list.size() == 2) {
2029                            return list.get(1);
2030                    }
2031                    else {
2032                            return null;
2033                    }
2034            }
2035    
2036            /**
2037             * Removes all the export import configurations where groupId = &#63; and status = &#63; from the database.
2038             *
2039             * @param groupId the group ID
2040             * @param status the status
2041             */
2042            @Override
2043            public void removeByG_S(long groupId, int status) {
2044                    for (ExportImportConfiguration exportImportConfiguration : findByG_S(
2045                                    groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
2046                            remove(exportImportConfiguration);
2047                    }
2048            }
2049    
2050            /**
2051             * Returns the number of export import configurations where groupId = &#63; and status = &#63;.
2052             *
2053             * @param groupId the group ID
2054             * @param status the status
2055             * @return the number of matching export import configurations
2056             */
2057            @Override
2058            public int countByG_S(long groupId, int status) {
2059                    FinderPath finderPath = FINDER_PATH_COUNT_BY_G_S;
2060    
2061                    Object[] finderArgs = new Object[] { groupId, status };
2062    
2063                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2064                                    this);
2065    
2066                    if (count == null) {
2067                            StringBundler query = new StringBundler(3);
2068    
2069                            query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
2070    
2071                            query.append(_FINDER_COLUMN_G_S_GROUPID_2);
2072    
2073                            query.append(_FINDER_COLUMN_G_S_STATUS_2);
2074    
2075                            String sql = query.toString();
2076    
2077                            Session session = null;
2078    
2079                            try {
2080                                    session = openSession();
2081    
2082                                    Query q = session.createQuery(sql);
2083    
2084                                    QueryPos qPos = QueryPos.getInstance(q);
2085    
2086                                    qPos.add(groupId);
2087    
2088                                    qPos.add(status);
2089    
2090                                    count = (Long)q.uniqueResult();
2091    
2092                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
2093                            }
2094                            catch (Exception e) {
2095                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
2096    
2097                                    throw processException(e);
2098                            }
2099                            finally {
2100                                    closeSession(session);
2101                            }
2102                    }
2103    
2104                    return count.intValue();
2105            }
2106    
2107            private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "exportImportConfiguration.groupId = ? AND ";
2108            private static final String _FINDER_COLUMN_G_S_STATUS_2 = "exportImportConfiguration.status = ?";
2109            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2110                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
2111                            ExportImportConfigurationImpl.class,
2112                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_T_S",
2113                            new String[] {
2114                                    Long.class.getName(), Integer.class.getName(),
2115                                    Integer.class.getName(),
2116                                    
2117                            Integer.class.getName(), Integer.class.getName(),
2118                                    OrderByComparator.class.getName()
2119                            });
2120            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2121                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
2122                            ExportImportConfigurationImpl.class,
2123                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_T_S",
2124                            new String[] {
2125                                    Long.class.getName(), Integer.class.getName(),
2126                                    Integer.class.getName()
2127                            },
2128                            ExportImportConfigurationModelImpl.GROUPID_COLUMN_BITMASK |
2129                            ExportImportConfigurationModelImpl.TYPE_COLUMN_BITMASK |
2130                            ExportImportConfigurationModelImpl.STATUS_COLUMN_BITMASK |
2131                            ExportImportConfigurationModelImpl.CREATEDATE_COLUMN_BITMASK);
2132            public static final FinderPath FINDER_PATH_COUNT_BY_G_T_S = new FinderPath(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2133                            ExportImportConfigurationModelImpl.FINDER_CACHE_ENABLED,
2134                            Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
2135                            "countByG_T_S",
2136                            new String[] {
2137                                    Long.class.getName(), Integer.class.getName(),
2138                                    Integer.class.getName()
2139                            });
2140    
2141            /**
2142             * Returns all the export import configurations where groupId = &#63; and type = &#63; and status = &#63;.
2143             *
2144             * @param groupId the group ID
2145             * @param type the type
2146             * @param status the status
2147             * @return the matching export import configurations
2148             */
2149            @Override
2150            public List<ExportImportConfiguration> findByG_T_S(long groupId, int type,
2151                    int status) {
2152                    return findByG_T_S(groupId, type, status, QueryUtil.ALL_POS,
2153                            QueryUtil.ALL_POS, null);
2154            }
2155    
2156            /**
2157             * Returns a range of all the export import configurations where groupId = &#63; and type = &#63; and status = &#63;.
2158             *
2159             * <p>
2160             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
2161             * </p>
2162             *
2163             * @param groupId the group ID
2164             * @param type the type
2165             * @param status the status
2166             * @param start the lower bound of the range of export import configurations
2167             * @param end the upper bound of the range of export import configurations (not inclusive)
2168             * @return the range of matching export import configurations
2169             */
2170            @Override
2171            public List<ExportImportConfiguration> findByG_T_S(long groupId, int type,
2172                    int status, int start, int end) {
2173                    return findByG_T_S(groupId, type, status, start, end, null);
2174            }
2175    
2176            /**
2177             * Returns an ordered range of all the export import configurations where groupId = &#63; and type = &#63; and status = &#63;.
2178             *
2179             * <p>
2180             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
2181             * </p>
2182             *
2183             * @param groupId the group ID
2184             * @param type the type
2185             * @param status the status
2186             * @param start the lower bound of the range of export import configurations
2187             * @param end the upper bound of the range of export import configurations (not inclusive)
2188             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
2189             * @return the ordered range of matching export import configurations
2190             */
2191            @Override
2192            public List<ExportImportConfiguration> findByG_T_S(long groupId, int type,
2193                    int status, int start, int end,
2194                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
2195                    boolean pagination = true;
2196                    FinderPath finderPath = null;
2197                    Object[] finderArgs = null;
2198    
2199                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2200                                    (orderByComparator == null)) {
2201                            pagination = false;
2202                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S;
2203                            finderArgs = new Object[] { groupId, type, status };
2204                    }
2205                    else {
2206                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_G_T_S;
2207                            finderArgs = new Object[] {
2208                                            groupId, type, status,
2209                                            
2210                                            start, end, orderByComparator
2211                                    };
2212                    }
2213    
2214                    List<ExportImportConfiguration> list = (List<ExportImportConfiguration>)FinderCacheUtil.getResult(finderPath,
2215                                    finderArgs, this);
2216    
2217                    if ((list != null) && !list.isEmpty()) {
2218                            for (ExportImportConfiguration exportImportConfiguration : list) {
2219                                    if ((groupId != exportImportConfiguration.getGroupId()) ||
2220                                                    (type != exportImportConfiguration.getType()) ||
2221                                                    (status != exportImportConfiguration.getStatus())) {
2222                                            list = null;
2223    
2224                                            break;
2225                                    }
2226                            }
2227                    }
2228    
2229                    if (list == null) {
2230                            StringBundler query = null;
2231    
2232                            if (orderByComparator != null) {
2233                                    query = new StringBundler(5 +
2234                                                    (orderByComparator.getOrderByFields().length * 3));
2235                            }
2236                            else {
2237                                    query = new StringBundler(5);
2238                            }
2239    
2240                            query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
2241    
2242                            query.append(_FINDER_COLUMN_G_T_S_GROUPID_2);
2243    
2244                            query.append(_FINDER_COLUMN_G_T_S_TYPE_2);
2245    
2246                            query.append(_FINDER_COLUMN_G_T_S_STATUS_2);
2247    
2248                            if (orderByComparator != null) {
2249                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2250                                            orderByComparator);
2251                            }
2252                            else
2253                             if (pagination) {
2254                                    query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
2255                            }
2256    
2257                            String sql = query.toString();
2258    
2259                            Session session = null;
2260    
2261                            try {
2262                                    session = openSession();
2263    
2264                                    Query q = session.createQuery(sql);
2265    
2266                                    QueryPos qPos = QueryPos.getInstance(q);
2267    
2268                                    qPos.add(groupId);
2269    
2270                                    qPos.add(type);
2271    
2272                                    qPos.add(status);
2273    
2274                                    if (!pagination) {
2275                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
2276                                                            getDialect(), start, end, false);
2277    
2278                                            Collections.sort(list);
2279    
2280                                            list = Collections.unmodifiableList(list);
2281                                    }
2282                                    else {
2283                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
2284                                                            getDialect(), start, end);
2285                                    }
2286    
2287                                    cacheResult(list);
2288    
2289                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
2290                            }
2291                            catch (Exception e) {
2292                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
2293    
2294                                    throw processException(e);
2295                            }
2296                            finally {
2297                                    closeSession(session);
2298                            }
2299                    }
2300    
2301                    return list;
2302            }
2303    
2304            /**
2305             * Returns the first export import configuration in the ordered set where groupId = &#63; and type = &#63; and status = &#63;.
2306             *
2307             * @param groupId the group ID
2308             * @param type the type
2309             * @param status the status
2310             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2311             * @return the first matching export import configuration
2312             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
2313             */
2314            @Override
2315            public ExportImportConfiguration findByG_T_S_First(long groupId, int type,
2316                    int status,
2317                    OrderByComparator<ExportImportConfiguration> orderByComparator)
2318                    throws NoSuchExportImportConfigurationException {
2319                    ExportImportConfiguration exportImportConfiguration = fetchByG_T_S_First(groupId,
2320                                    type, status, orderByComparator);
2321    
2322                    if (exportImportConfiguration != null) {
2323                            return exportImportConfiguration;
2324                    }
2325    
2326                    StringBundler msg = new StringBundler(8);
2327    
2328                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2329    
2330                    msg.append("groupId=");
2331                    msg.append(groupId);
2332    
2333                    msg.append(", type=");
2334                    msg.append(type);
2335    
2336                    msg.append(", status=");
2337                    msg.append(status);
2338    
2339                    msg.append(StringPool.CLOSE_CURLY_BRACE);
2340    
2341                    throw new NoSuchExportImportConfigurationException(msg.toString());
2342            }
2343    
2344            /**
2345             * Returns the first export import configuration in the ordered set where groupId = &#63; and type = &#63; and status = &#63;.
2346             *
2347             * @param groupId the group ID
2348             * @param type the type
2349             * @param status the status
2350             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2351             * @return the first matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
2352             */
2353            @Override
2354            public ExportImportConfiguration fetchByG_T_S_First(long groupId, int type,
2355                    int status,
2356                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
2357                    List<ExportImportConfiguration> list = findByG_T_S(groupId, type,
2358                                    status, 0, 1, orderByComparator);
2359    
2360                    if (!list.isEmpty()) {
2361                            return list.get(0);
2362                    }
2363    
2364                    return null;
2365            }
2366    
2367            /**
2368             * Returns the last export import configuration in the ordered set where groupId = &#63; and type = &#63; and status = &#63;.
2369             *
2370             * @param groupId the group ID
2371             * @param type the type
2372             * @param status the status
2373             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2374             * @return the last matching export import configuration
2375             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a matching export import configuration could not be found
2376             */
2377            @Override
2378            public ExportImportConfiguration findByG_T_S_Last(long groupId, int type,
2379                    int status,
2380                    OrderByComparator<ExportImportConfiguration> orderByComparator)
2381                    throws NoSuchExportImportConfigurationException {
2382                    ExportImportConfiguration exportImportConfiguration = fetchByG_T_S_Last(groupId,
2383                                    type, status, orderByComparator);
2384    
2385                    if (exportImportConfiguration != null) {
2386                            return exportImportConfiguration;
2387                    }
2388    
2389                    StringBundler msg = new StringBundler(8);
2390    
2391                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2392    
2393                    msg.append("groupId=");
2394                    msg.append(groupId);
2395    
2396                    msg.append(", type=");
2397                    msg.append(type);
2398    
2399                    msg.append(", status=");
2400                    msg.append(status);
2401    
2402                    msg.append(StringPool.CLOSE_CURLY_BRACE);
2403    
2404                    throw new NoSuchExportImportConfigurationException(msg.toString());
2405            }
2406    
2407            /**
2408             * Returns the last export import configuration in the ordered set where groupId = &#63; and type = &#63; and status = &#63;.
2409             *
2410             * @param groupId the group ID
2411             * @param type the type
2412             * @param status the status
2413             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2414             * @return the last matching export import configuration, or <code>null</code> if a matching export import configuration could not be found
2415             */
2416            @Override
2417            public ExportImportConfiguration fetchByG_T_S_Last(long groupId, int type,
2418                    int status,
2419                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
2420                    int count = countByG_T_S(groupId, type, status);
2421    
2422                    if (count == 0) {
2423                            return null;
2424                    }
2425    
2426                    List<ExportImportConfiguration> list = findByG_T_S(groupId, type,
2427                                    status, count - 1, count, orderByComparator);
2428    
2429                    if (!list.isEmpty()) {
2430                            return list.get(0);
2431                    }
2432    
2433                    return null;
2434            }
2435    
2436            /**
2437             * Returns the export import configurations before and after the current export import configuration in the ordered set where groupId = &#63; and type = &#63; and status = &#63;.
2438             *
2439             * @param exportImportConfigurationId the primary key of the current export import configuration
2440             * @param groupId the group ID
2441             * @param type the type
2442             * @param status the status
2443             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
2444             * @return the previous, current, and next export import configuration
2445             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
2446             */
2447            @Override
2448            public ExportImportConfiguration[] findByG_T_S_PrevAndNext(
2449                    long exportImportConfigurationId, long groupId, int type, int status,
2450                    OrderByComparator<ExportImportConfiguration> orderByComparator)
2451                    throws NoSuchExportImportConfigurationException {
2452                    ExportImportConfiguration exportImportConfiguration = findByPrimaryKey(exportImportConfigurationId);
2453    
2454                    Session session = null;
2455    
2456                    try {
2457                            session = openSession();
2458    
2459                            ExportImportConfiguration[] array = new ExportImportConfigurationImpl[3];
2460    
2461                            array[0] = getByG_T_S_PrevAndNext(session,
2462                                            exportImportConfiguration, groupId, type, status,
2463                                            orderByComparator, true);
2464    
2465                            array[1] = exportImportConfiguration;
2466    
2467                            array[2] = getByG_T_S_PrevAndNext(session,
2468                                            exportImportConfiguration, groupId, type, status,
2469                                            orderByComparator, false);
2470    
2471                            return array;
2472                    }
2473                    catch (Exception e) {
2474                            throw processException(e);
2475                    }
2476                    finally {
2477                            closeSession(session);
2478                    }
2479            }
2480    
2481            protected ExportImportConfiguration getByG_T_S_PrevAndNext(
2482                    Session session, ExportImportConfiguration exportImportConfiguration,
2483                    long groupId, int type, int status,
2484                    OrderByComparator<ExportImportConfiguration> orderByComparator,
2485                    boolean previous) {
2486                    StringBundler query = null;
2487    
2488                    if (orderByComparator != null) {
2489                            query = new StringBundler(6 +
2490                                            (orderByComparator.getOrderByFields().length * 6));
2491                    }
2492                    else {
2493                            query = new StringBundler(3);
2494                    }
2495    
2496                    query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE);
2497    
2498                    query.append(_FINDER_COLUMN_G_T_S_GROUPID_2);
2499    
2500                    query.append(_FINDER_COLUMN_G_T_S_TYPE_2);
2501    
2502                    query.append(_FINDER_COLUMN_G_T_S_STATUS_2);
2503    
2504                    if (orderByComparator != null) {
2505                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2506    
2507                            if (orderByConditionFields.length > 0) {
2508                                    query.append(WHERE_AND);
2509                            }
2510    
2511                            for (int i = 0; i < orderByConditionFields.length; i++) {
2512                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2513                                    query.append(orderByConditionFields[i]);
2514    
2515                                    if ((i + 1) < orderByConditionFields.length) {
2516                                            if (orderByComparator.isAscending() ^ previous) {
2517                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2518                                            }
2519                                            else {
2520                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2521                                            }
2522                                    }
2523                                    else {
2524                                            if (orderByComparator.isAscending() ^ previous) {
2525                                                    query.append(WHERE_GREATER_THAN);
2526                                            }
2527                                            else {
2528                                                    query.append(WHERE_LESSER_THAN);
2529                                            }
2530                                    }
2531                            }
2532    
2533                            query.append(ORDER_BY_CLAUSE);
2534    
2535                            String[] orderByFields = orderByComparator.getOrderByFields();
2536    
2537                            for (int i = 0; i < orderByFields.length; i++) {
2538                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2539                                    query.append(orderByFields[i]);
2540    
2541                                    if ((i + 1) < orderByFields.length) {
2542                                            if (orderByComparator.isAscending() ^ previous) {
2543                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2544                                            }
2545                                            else {
2546                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2547                                            }
2548                                    }
2549                                    else {
2550                                            if (orderByComparator.isAscending() ^ previous) {
2551                                                    query.append(ORDER_BY_ASC);
2552                                            }
2553                                            else {
2554                                                    query.append(ORDER_BY_DESC);
2555                                            }
2556                                    }
2557                            }
2558                    }
2559                    else {
2560                            query.append(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
2561                    }
2562    
2563                    String sql = query.toString();
2564    
2565                    Query q = session.createQuery(sql);
2566    
2567                    q.setFirstResult(0);
2568                    q.setMaxResults(2);
2569    
2570                    QueryPos qPos = QueryPos.getInstance(q);
2571    
2572                    qPos.add(groupId);
2573    
2574                    qPos.add(type);
2575    
2576                    qPos.add(status);
2577    
2578                    if (orderByComparator != null) {
2579                            Object[] values = orderByComparator.getOrderByConditionValues(exportImportConfiguration);
2580    
2581                            for (Object value : values) {
2582                                    qPos.add(value);
2583                            }
2584                    }
2585    
2586                    List<ExportImportConfiguration> list = q.list();
2587    
2588                    if (list.size() == 2) {
2589                            return list.get(1);
2590                    }
2591                    else {
2592                            return null;
2593                    }
2594            }
2595    
2596            /**
2597             * Removes all the export import configurations where groupId = &#63; and type = &#63; and status = &#63; from the database.
2598             *
2599             * @param groupId the group ID
2600             * @param type the type
2601             * @param status the status
2602             */
2603            @Override
2604            public void removeByG_T_S(long groupId, int type, int status) {
2605                    for (ExportImportConfiguration exportImportConfiguration : findByG_T_S(
2606                                    groupId, type, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2607                                    null)) {
2608                            remove(exportImportConfiguration);
2609                    }
2610            }
2611    
2612            /**
2613             * Returns the number of export import configurations where groupId = &#63; and type = &#63; and status = &#63;.
2614             *
2615             * @param groupId the group ID
2616             * @param type the type
2617             * @param status the status
2618             * @return the number of matching export import configurations
2619             */
2620            @Override
2621            public int countByG_T_S(long groupId, int type, int status) {
2622                    FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T_S;
2623    
2624                    Object[] finderArgs = new Object[] { groupId, type, status };
2625    
2626                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
2627                                    this);
2628    
2629                    if (count == null) {
2630                            StringBundler query = new StringBundler(4);
2631    
2632                            query.append(_SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE);
2633    
2634                            query.append(_FINDER_COLUMN_G_T_S_GROUPID_2);
2635    
2636                            query.append(_FINDER_COLUMN_G_T_S_TYPE_2);
2637    
2638                            query.append(_FINDER_COLUMN_G_T_S_STATUS_2);
2639    
2640                            String sql = query.toString();
2641    
2642                            Session session = null;
2643    
2644                            try {
2645                                    session = openSession();
2646    
2647                                    Query q = session.createQuery(sql);
2648    
2649                                    QueryPos qPos = QueryPos.getInstance(q);
2650    
2651                                    qPos.add(groupId);
2652    
2653                                    qPos.add(type);
2654    
2655                                    qPos.add(status);
2656    
2657                                    count = (Long)q.uniqueResult();
2658    
2659                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
2660                            }
2661                            catch (Exception e) {
2662                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
2663    
2664                                    throw processException(e);
2665                            }
2666                            finally {
2667                                    closeSession(session);
2668                            }
2669                    }
2670    
2671                    return count.intValue();
2672            }
2673    
2674            private static final String _FINDER_COLUMN_G_T_S_GROUPID_2 = "exportImportConfiguration.groupId = ? AND ";
2675            private static final String _FINDER_COLUMN_G_T_S_TYPE_2 = "exportImportConfiguration.type = ? AND ";
2676            private static final String _FINDER_COLUMN_G_T_S_STATUS_2 = "exportImportConfiguration.status = ?";
2677    
2678            public ExportImportConfigurationPersistenceImpl() {
2679                    setModelClass(ExportImportConfiguration.class);
2680            }
2681    
2682            /**
2683             * Caches the export import configuration in the entity cache if it is enabled.
2684             *
2685             * @param exportImportConfiguration the export import configuration
2686             */
2687            @Override
2688            public void cacheResult(ExportImportConfiguration exportImportConfiguration) {
2689                    EntityCacheUtil.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2690                            ExportImportConfigurationImpl.class,
2691                            exportImportConfiguration.getPrimaryKey(), exportImportConfiguration);
2692    
2693                    exportImportConfiguration.resetOriginalValues();
2694            }
2695    
2696            /**
2697             * Caches the export import configurations in the entity cache if it is enabled.
2698             *
2699             * @param exportImportConfigurations the export import configurations
2700             */
2701            @Override
2702            public void cacheResult(
2703                    List<ExportImportConfiguration> exportImportConfigurations) {
2704                    for (ExportImportConfiguration exportImportConfiguration : exportImportConfigurations) {
2705                            if (EntityCacheUtil.getResult(
2706                                                    ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2707                                                    ExportImportConfigurationImpl.class,
2708                                                    exportImportConfiguration.getPrimaryKey()) == null) {
2709                                    cacheResult(exportImportConfiguration);
2710                            }
2711                            else {
2712                                    exportImportConfiguration.resetOriginalValues();
2713                            }
2714                    }
2715            }
2716    
2717            /**
2718             * Clears the cache for all export import configurations.
2719             *
2720             * <p>
2721             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
2722             * </p>
2723             */
2724            @Override
2725            public void clearCache() {
2726                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
2727                            CacheRegistryUtil.clear(ExportImportConfigurationImpl.class.getName());
2728                    }
2729    
2730                    EntityCacheUtil.clearCache(ExportImportConfigurationImpl.class);
2731    
2732                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
2733                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2734                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2735            }
2736    
2737            /**
2738             * Clears the cache for the export import configuration.
2739             *
2740             * <p>
2741             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
2742             * </p>
2743             */
2744            @Override
2745            public void clearCache(ExportImportConfiguration exportImportConfiguration) {
2746                    EntityCacheUtil.removeResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2747                            ExportImportConfigurationImpl.class,
2748                            exportImportConfiguration.getPrimaryKey());
2749    
2750                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2751                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2752            }
2753    
2754            @Override
2755            public void clearCache(
2756                    List<ExportImportConfiguration> exportImportConfigurations) {
2757                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2758                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2759    
2760                    for (ExportImportConfiguration exportImportConfiguration : exportImportConfigurations) {
2761                            EntityCacheUtil.removeResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
2762                                    ExportImportConfigurationImpl.class,
2763                                    exportImportConfiguration.getPrimaryKey());
2764                    }
2765            }
2766    
2767            /**
2768             * Creates a new export import configuration with the primary key. Does not add the export import configuration to the database.
2769             *
2770             * @param exportImportConfigurationId the primary key for the new export import configuration
2771             * @return the new export import configuration
2772             */
2773            @Override
2774            public ExportImportConfiguration create(long exportImportConfigurationId) {
2775                    ExportImportConfiguration exportImportConfiguration = new ExportImportConfigurationImpl();
2776    
2777                    exportImportConfiguration.setNew(true);
2778                    exportImportConfiguration.setPrimaryKey(exportImportConfigurationId);
2779    
2780                    return exportImportConfiguration;
2781            }
2782    
2783            /**
2784             * Removes the export import configuration with the primary key from the database. Also notifies the appropriate model listeners.
2785             *
2786             * @param exportImportConfigurationId the primary key of the export import configuration
2787             * @return the export import configuration that was removed
2788             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
2789             */
2790            @Override
2791            public ExportImportConfiguration remove(long exportImportConfigurationId)
2792                    throws NoSuchExportImportConfigurationException {
2793                    return remove((Serializable)exportImportConfigurationId);
2794            }
2795    
2796            /**
2797             * Removes the export import configuration with the primary key from the database. Also notifies the appropriate model listeners.
2798             *
2799             * @param primaryKey the primary key of the export import configuration
2800             * @return the export import configuration that was removed
2801             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
2802             */
2803            @Override
2804            public ExportImportConfiguration remove(Serializable primaryKey)
2805                    throws NoSuchExportImportConfigurationException {
2806                    Session session = null;
2807    
2808                    try {
2809                            session = openSession();
2810    
2811                            ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration)session.get(ExportImportConfigurationImpl.class,
2812                                            primaryKey);
2813    
2814                            if (exportImportConfiguration == null) {
2815                                    if (_log.isWarnEnabled()) {
2816                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
2817                                    }
2818    
2819                                    throw new NoSuchExportImportConfigurationException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
2820                                            primaryKey);
2821                            }
2822    
2823                            return remove(exportImportConfiguration);
2824                    }
2825                    catch (NoSuchExportImportConfigurationException nsee) {
2826                            throw nsee;
2827                    }
2828                    catch (Exception e) {
2829                            throw processException(e);
2830                    }
2831                    finally {
2832                            closeSession(session);
2833                    }
2834            }
2835    
2836            @Override
2837            protected ExportImportConfiguration removeImpl(
2838                    ExportImportConfiguration exportImportConfiguration) {
2839                    exportImportConfiguration = toUnwrappedModel(exportImportConfiguration);
2840    
2841                    Session session = null;
2842    
2843                    try {
2844                            session = openSession();
2845    
2846                            if (!session.contains(exportImportConfiguration)) {
2847                                    exportImportConfiguration = (ExportImportConfiguration)session.get(ExportImportConfigurationImpl.class,
2848                                                    exportImportConfiguration.getPrimaryKeyObj());
2849                            }
2850    
2851                            if (exportImportConfiguration != null) {
2852                                    session.delete(exportImportConfiguration);
2853                            }
2854                    }
2855                    catch (Exception e) {
2856                            throw processException(e);
2857                    }
2858                    finally {
2859                            closeSession(session);
2860                    }
2861    
2862                    if (exportImportConfiguration != null) {
2863                            clearCache(exportImportConfiguration);
2864                    }
2865    
2866                    return exportImportConfiguration;
2867            }
2868    
2869            @Override
2870            public ExportImportConfiguration updateImpl(
2871                    com.liferay.portal.model.ExportImportConfiguration exportImportConfiguration) {
2872                    exportImportConfiguration = toUnwrappedModel(exportImportConfiguration);
2873    
2874                    boolean isNew = exportImportConfiguration.isNew();
2875    
2876                    ExportImportConfigurationModelImpl exportImportConfigurationModelImpl = (ExportImportConfigurationModelImpl)exportImportConfiguration;
2877    
2878                    Session session = null;
2879    
2880                    try {
2881                            session = openSession();
2882    
2883                            if (exportImportConfiguration.isNew()) {
2884                                    session.save(exportImportConfiguration);
2885    
2886                                    exportImportConfiguration.setNew(false);
2887                            }
2888                            else {
2889                                    session.merge(exportImportConfiguration);
2890                            }
2891                    }
2892                    catch (Exception e) {
2893                            throw processException(e);
2894                    }
2895                    finally {
2896                            closeSession(session);
2897                    }
2898    
2899                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2900    
2901                    if (isNew ||
2902                                    !ExportImportConfigurationModelImpl.COLUMN_BITMASK_ENABLED) {
2903                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2904                    }
2905    
2906                    else {
2907                            if ((exportImportConfigurationModelImpl.getColumnBitmask() &
2908                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
2909                                    Object[] args = new Object[] {
2910                                                    exportImportConfigurationModelImpl.getOriginalGroupId()
2911                                            };
2912    
2913                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2914                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2915                                            args);
2916    
2917                                    args = new Object[] {
2918                                                    exportImportConfigurationModelImpl.getGroupId()
2919                                            };
2920    
2921                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
2922                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
2923                                            args);
2924                            }
2925    
2926                            if ((exportImportConfigurationModelImpl.getColumnBitmask() &
2927                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID.getColumnBitmask()) != 0) {
2928                                    Object[] args = new Object[] {
2929                                                    exportImportConfigurationModelImpl.getOriginalCompanyId()
2930                                            };
2931    
2932                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
2933                                            args);
2934                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
2935                                            args);
2936    
2937                                    args = new Object[] {
2938                                                    exportImportConfigurationModelImpl.getCompanyId()
2939                                            };
2940    
2941                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_COMPANYID,
2942                                            args);
2943                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_COMPANYID,
2944                                            args);
2945                            }
2946    
2947                            if ((exportImportConfigurationModelImpl.getColumnBitmask() &
2948                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T.getColumnBitmask()) != 0) {
2949                                    Object[] args = new Object[] {
2950                                                    exportImportConfigurationModelImpl.getOriginalGroupId(),
2951                                                    exportImportConfigurationModelImpl.getOriginalType()
2952                                            };
2953    
2954                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_T, args);
2955                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T,
2956                                            args);
2957    
2958                                    args = new Object[] {
2959                                                    exportImportConfigurationModelImpl.getGroupId(),
2960                                                    exportImportConfigurationModelImpl.getType()
2961                                            };
2962    
2963                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_T, args);
2964                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T,
2965                                            args);
2966                            }
2967    
2968                            if ((exportImportConfigurationModelImpl.getColumnBitmask() &
2969                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S.getColumnBitmask()) != 0) {
2970                                    Object[] args = new Object[] {
2971                                                    exportImportConfigurationModelImpl.getOriginalGroupId(),
2972                                                    exportImportConfigurationModelImpl.getOriginalStatus()
2973                                            };
2974    
2975                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
2976                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
2977                                            args);
2978    
2979                                    args = new Object[] {
2980                                                    exportImportConfigurationModelImpl.getGroupId(),
2981                                                    exportImportConfigurationModelImpl.getStatus()
2982                                            };
2983    
2984                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_S, args);
2985                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_S,
2986                                            args);
2987                            }
2988    
2989                            if ((exportImportConfigurationModelImpl.getColumnBitmask() &
2990                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S.getColumnBitmask()) != 0) {
2991                                    Object[] args = new Object[] {
2992                                                    exportImportConfigurationModelImpl.getOriginalGroupId(),
2993                                                    exportImportConfigurationModelImpl.getOriginalType(),
2994                                                    exportImportConfigurationModelImpl.getOriginalStatus()
2995                                            };
2996    
2997                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_T_S, args);
2998                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S,
2999                                            args);
3000    
3001                                    args = new Object[] {
3002                                                    exportImportConfigurationModelImpl.getGroupId(),
3003                                                    exportImportConfigurationModelImpl.getType(),
3004                                                    exportImportConfigurationModelImpl.getStatus()
3005                                            };
3006    
3007                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_T_S, args);
3008                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_G_T_S,
3009                                            args);
3010                            }
3011                    }
3012    
3013                    EntityCacheUtil.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3014                            ExportImportConfigurationImpl.class,
3015                            exportImportConfiguration.getPrimaryKey(),
3016                            exportImportConfiguration, false);
3017    
3018                    exportImportConfiguration.resetOriginalValues();
3019    
3020                    return exportImportConfiguration;
3021            }
3022    
3023            protected ExportImportConfiguration toUnwrappedModel(
3024                    ExportImportConfiguration exportImportConfiguration) {
3025                    if (exportImportConfiguration instanceof ExportImportConfigurationImpl) {
3026                            return exportImportConfiguration;
3027                    }
3028    
3029                    ExportImportConfigurationImpl exportImportConfigurationImpl = new ExportImportConfigurationImpl();
3030    
3031                    exportImportConfigurationImpl.setNew(exportImportConfiguration.isNew());
3032                    exportImportConfigurationImpl.setPrimaryKey(exportImportConfiguration.getPrimaryKey());
3033    
3034                    exportImportConfigurationImpl.setMvccVersion(exportImportConfiguration.getMvccVersion());
3035                    exportImportConfigurationImpl.setExportImportConfigurationId(exportImportConfiguration.getExportImportConfigurationId());
3036                    exportImportConfigurationImpl.setGroupId(exportImportConfiguration.getGroupId());
3037                    exportImportConfigurationImpl.setCompanyId(exportImportConfiguration.getCompanyId());
3038                    exportImportConfigurationImpl.setUserId(exportImportConfiguration.getUserId());
3039                    exportImportConfigurationImpl.setUserName(exportImportConfiguration.getUserName());
3040                    exportImportConfigurationImpl.setCreateDate(exportImportConfiguration.getCreateDate());
3041                    exportImportConfigurationImpl.setModifiedDate(exportImportConfiguration.getModifiedDate());
3042                    exportImportConfigurationImpl.setName(exportImportConfiguration.getName());
3043                    exportImportConfigurationImpl.setDescription(exportImportConfiguration.getDescription());
3044                    exportImportConfigurationImpl.setType(exportImportConfiguration.getType());
3045                    exportImportConfigurationImpl.setSettings(exportImportConfiguration.getSettings());
3046                    exportImportConfigurationImpl.setStatus(exportImportConfiguration.getStatus());
3047                    exportImportConfigurationImpl.setStatusByUserId(exportImportConfiguration.getStatusByUserId());
3048                    exportImportConfigurationImpl.setStatusByUserName(exportImportConfiguration.getStatusByUserName());
3049                    exportImportConfigurationImpl.setStatusDate(exportImportConfiguration.getStatusDate());
3050    
3051                    return exportImportConfigurationImpl;
3052            }
3053    
3054            /**
3055             * Returns the export import configuration with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
3056             *
3057             * @param primaryKey the primary key of the export import configuration
3058             * @return the export import configuration
3059             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
3060             */
3061            @Override
3062            public ExportImportConfiguration findByPrimaryKey(Serializable primaryKey)
3063                    throws NoSuchExportImportConfigurationException {
3064                    ExportImportConfiguration exportImportConfiguration = fetchByPrimaryKey(primaryKey);
3065    
3066                    if (exportImportConfiguration == null) {
3067                            if (_log.isWarnEnabled()) {
3068                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
3069                            }
3070    
3071                            throw new NoSuchExportImportConfigurationException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
3072                                    primaryKey);
3073                    }
3074    
3075                    return exportImportConfiguration;
3076            }
3077    
3078            /**
3079             * Returns the export import configuration with the primary key or throws a {@link com.liferay.portal.NoSuchExportImportConfigurationException} if it could not be found.
3080             *
3081             * @param exportImportConfigurationId the primary key of the export import configuration
3082             * @return the export import configuration
3083             * @throws com.liferay.portal.NoSuchExportImportConfigurationException if a export import configuration with the primary key could not be found
3084             */
3085            @Override
3086            public ExportImportConfiguration findByPrimaryKey(
3087                    long exportImportConfigurationId)
3088                    throws NoSuchExportImportConfigurationException {
3089                    return findByPrimaryKey((Serializable)exportImportConfigurationId);
3090            }
3091    
3092            /**
3093             * Returns the export import configuration with the primary key or returns <code>null</code> if it could not be found.
3094             *
3095             * @param primaryKey the primary key of the export import configuration
3096             * @return the export import configuration, or <code>null</code> if a export import configuration with the primary key could not be found
3097             */
3098            @Override
3099            public ExportImportConfiguration fetchByPrimaryKey(Serializable primaryKey) {
3100                    ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration)EntityCacheUtil.getResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3101                                    ExportImportConfigurationImpl.class, primaryKey);
3102    
3103                    if (exportImportConfiguration == _nullExportImportConfiguration) {
3104                            return null;
3105                    }
3106    
3107                    if (exportImportConfiguration == null) {
3108                            Session session = null;
3109    
3110                            try {
3111                                    session = openSession();
3112    
3113                                    exportImportConfiguration = (ExportImportConfiguration)session.get(ExportImportConfigurationImpl.class,
3114                                                    primaryKey);
3115    
3116                                    if (exportImportConfiguration != null) {
3117                                            cacheResult(exportImportConfiguration);
3118                                    }
3119                                    else {
3120                                            EntityCacheUtil.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3121                                                    ExportImportConfigurationImpl.class, primaryKey,
3122                                                    _nullExportImportConfiguration);
3123                                    }
3124                            }
3125                            catch (Exception e) {
3126                                    EntityCacheUtil.removeResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3127                                            ExportImportConfigurationImpl.class, primaryKey);
3128    
3129                                    throw processException(e);
3130                            }
3131                            finally {
3132                                    closeSession(session);
3133                            }
3134                    }
3135    
3136                    return exportImportConfiguration;
3137            }
3138    
3139            /**
3140             * Returns the export import configuration with the primary key or returns <code>null</code> if it could not be found.
3141             *
3142             * @param exportImportConfigurationId the primary key of the export import configuration
3143             * @return the export import configuration, or <code>null</code> if a export import configuration with the primary key could not be found
3144             */
3145            @Override
3146            public ExportImportConfiguration fetchByPrimaryKey(
3147                    long exportImportConfigurationId) {
3148                    return fetchByPrimaryKey((Serializable)exportImportConfigurationId);
3149            }
3150    
3151            @Override
3152            public Map<Serializable, ExportImportConfiguration> fetchByPrimaryKeys(
3153                    Set<Serializable> primaryKeys) {
3154                    if (primaryKeys.isEmpty()) {
3155                            return Collections.emptyMap();
3156                    }
3157    
3158                    Map<Serializable, ExportImportConfiguration> map = new HashMap<Serializable, ExportImportConfiguration>();
3159    
3160                    if (primaryKeys.size() == 1) {
3161                            Iterator<Serializable> iterator = primaryKeys.iterator();
3162    
3163                            Serializable primaryKey = iterator.next();
3164    
3165                            ExportImportConfiguration exportImportConfiguration = fetchByPrimaryKey(primaryKey);
3166    
3167                            if (exportImportConfiguration != null) {
3168                                    map.put(primaryKey, exportImportConfiguration);
3169                            }
3170    
3171                            return map;
3172                    }
3173    
3174                    Set<Serializable> uncachedPrimaryKeys = null;
3175    
3176                    for (Serializable primaryKey : primaryKeys) {
3177                            ExportImportConfiguration exportImportConfiguration = (ExportImportConfiguration)EntityCacheUtil.getResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3178                                            ExportImportConfigurationImpl.class, primaryKey);
3179    
3180                            if (exportImportConfiguration == null) {
3181                                    if (uncachedPrimaryKeys == null) {
3182                                            uncachedPrimaryKeys = new HashSet<Serializable>();
3183                                    }
3184    
3185                                    uncachedPrimaryKeys.add(primaryKey);
3186                            }
3187                            else {
3188                                    map.put(primaryKey, exportImportConfiguration);
3189                            }
3190                    }
3191    
3192                    if (uncachedPrimaryKeys == null) {
3193                            return map;
3194                    }
3195    
3196                    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
3197                                    1);
3198    
3199                    query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE_PKS_IN);
3200    
3201                    for (Serializable primaryKey : uncachedPrimaryKeys) {
3202                            query.append(String.valueOf(primaryKey));
3203    
3204                            query.append(StringPool.COMMA);
3205                    }
3206    
3207                    query.setIndex(query.index() - 1);
3208    
3209                    query.append(StringPool.CLOSE_PARENTHESIS);
3210    
3211                    String sql = query.toString();
3212    
3213                    Session session = null;
3214    
3215                    try {
3216                            session = openSession();
3217    
3218                            Query q = session.createQuery(sql);
3219    
3220                            for (ExportImportConfiguration exportImportConfiguration : (List<ExportImportConfiguration>)q.list()) {
3221                                    map.put(exportImportConfiguration.getPrimaryKeyObj(),
3222                                            exportImportConfiguration);
3223    
3224                                    cacheResult(exportImportConfiguration);
3225    
3226                                    uncachedPrimaryKeys.remove(exportImportConfiguration.getPrimaryKeyObj());
3227                            }
3228    
3229                            for (Serializable primaryKey : uncachedPrimaryKeys) {
3230                                    EntityCacheUtil.putResult(ExportImportConfigurationModelImpl.ENTITY_CACHE_ENABLED,
3231                                            ExportImportConfigurationImpl.class, primaryKey,
3232                                            _nullExportImportConfiguration);
3233                            }
3234                    }
3235                    catch (Exception e) {
3236                            throw processException(e);
3237                    }
3238                    finally {
3239                            closeSession(session);
3240                    }
3241    
3242                    return map;
3243            }
3244    
3245            /**
3246             * Returns all the export import configurations.
3247             *
3248             * @return the export import configurations
3249             */
3250            @Override
3251            public List<ExportImportConfiguration> findAll() {
3252                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3253            }
3254    
3255            /**
3256             * Returns a range of all the export import configurations.
3257             *
3258             * <p>
3259             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
3260             * </p>
3261             *
3262             * @param start the lower bound of the range of export import configurations
3263             * @param end the upper bound of the range of export import configurations (not inclusive)
3264             * @return the range of export import configurations
3265             */
3266            @Override
3267            public List<ExportImportConfiguration> findAll(int start, int end) {
3268                    return findAll(start, end, null);
3269            }
3270    
3271            /**
3272             * Returns an ordered range of all the export import configurations.
3273             *
3274             * <p>
3275             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.ExportImportConfigurationModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
3276             * </p>
3277             *
3278             * @param start the lower bound of the range of export import configurations
3279             * @param end the upper bound of the range of export import configurations (not inclusive)
3280             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
3281             * @return the ordered range of export import configurations
3282             */
3283            @Override
3284            public List<ExportImportConfiguration> findAll(int start, int end,
3285                    OrderByComparator<ExportImportConfiguration> orderByComparator) {
3286                    boolean pagination = true;
3287                    FinderPath finderPath = null;
3288                    Object[] finderArgs = null;
3289    
3290                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3291                                    (orderByComparator == null)) {
3292                            pagination = false;
3293                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3294                            finderArgs = FINDER_ARGS_EMPTY;
3295                    }
3296                    else {
3297                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3298                            finderArgs = new Object[] { start, end, orderByComparator };
3299                    }
3300    
3301                    List<ExportImportConfiguration> list = (List<ExportImportConfiguration>)FinderCacheUtil.getResult(finderPath,
3302                                    finderArgs, this);
3303    
3304                    if (list == null) {
3305                            StringBundler query = null;
3306                            String sql = null;
3307    
3308                            if (orderByComparator != null) {
3309                                    query = new StringBundler(2 +
3310                                                    (orderByComparator.getOrderByFields().length * 3));
3311    
3312                                    query.append(_SQL_SELECT_EXPORTIMPORTCONFIGURATION);
3313    
3314                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3315                                            orderByComparator);
3316    
3317                                    sql = query.toString();
3318                            }
3319                            else {
3320                                    sql = _SQL_SELECT_EXPORTIMPORTCONFIGURATION;
3321    
3322                                    if (pagination) {
3323                                            sql = sql.concat(ExportImportConfigurationModelImpl.ORDER_BY_JPQL);
3324                                    }
3325                            }
3326    
3327                            Session session = null;
3328    
3329                            try {
3330                                    session = openSession();
3331    
3332                                    Query q = session.createQuery(sql);
3333    
3334                                    if (!pagination) {
3335                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
3336                                                            getDialect(), start, end, false);
3337    
3338                                            Collections.sort(list);
3339    
3340                                            list = Collections.unmodifiableList(list);
3341                                    }
3342                                    else {
3343                                            list = (List<ExportImportConfiguration>)QueryUtil.list(q,
3344                                                            getDialect(), start, end);
3345                                    }
3346    
3347                                    cacheResult(list);
3348    
3349                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
3350                            }
3351                            catch (Exception e) {
3352                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
3353    
3354                                    throw processException(e);
3355                            }
3356                            finally {
3357                                    closeSession(session);
3358                            }
3359                    }
3360    
3361                    return list;
3362            }
3363    
3364            /**
3365             * Removes all the export import configurations from the database.
3366             *
3367             */
3368            @Override
3369            public void removeAll() {
3370                    for (ExportImportConfiguration exportImportConfiguration : findAll()) {
3371                            remove(exportImportConfiguration);
3372                    }
3373            }
3374    
3375            /**
3376             * Returns the number of export import configurations.
3377             *
3378             * @return the number of export import configurations
3379             */
3380            @Override
3381            public int countAll() {
3382                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3383                                    FINDER_ARGS_EMPTY, this);
3384    
3385                    if (count == null) {
3386                            Session session = null;
3387    
3388                            try {
3389                                    session = openSession();
3390    
3391                                    Query q = session.createQuery(_SQL_COUNT_EXPORTIMPORTCONFIGURATION);
3392    
3393                                    count = (Long)q.uniqueResult();
3394    
3395                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
3396                                            FINDER_ARGS_EMPTY, count);
3397                            }
3398                            catch (Exception e) {
3399                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
3400                                            FINDER_ARGS_EMPTY);
3401    
3402                                    throw processException(e);
3403                            }
3404                            finally {
3405                                    closeSession(session);
3406                            }
3407                    }
3408    
3409                    return count.intValue();
3410            }
3411    
3412            @Override
3413            protected Set<String> getBadColumnNames() {
3414                    return _badColumnNames;
3415            }
3416    
3417            /**
3418             * Initializes the export import configuration persistence.
3419             */
3420            public void afterPropertiesSet() {
3421            }
3422    
3423            public void destroy() {
3424                    EntityCacheUtil.removeCache(ExportImportConfigurationImpl.class.getName());
3425                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3426                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
3427                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
3428            }
3429    
3430            private static final String _SQL_SELECT_EXPORTIMPORTCONFIGURATION = "SELECT exportImportConfiguration FROM ExportImportConfiguration exportImportConfiguration";
3431            private static final String _SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE_PKS_IN =
3432                    "SELECT exportImportConfiguration FROM ExportImportConfiguration exportImportConfiguration WHERE exportImportConfigurationId IN (";
3433            private static final String _SQL_SELECT_EXPORTIMPORTCONFIGURATION_WHERE = "SELECT exportImportConfiguration FROM ExportImportConfiguration exportImportConfiguration WHERE ";
3434            private static final String _SQL_COUNT_EXPORTIMPORTCONFIGURATION = "SELECT COUNT(exportImportConfiguration) FROM ExportImportConfiguration exportImportConfiguration";
3435            private static final String _SQL_COUNT_EXPORTIMPORTCONFIGURATION_WHERE = "SELECT COUNT(exportImportConfiguration) FROM ExportImportConfiguration exportImportConfiguration WHERE ";
3436            private static final String _ORDER_BY_ENTITY_ALIAS = "exportImportConfiguration.";
3437            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No ExportImportConfiguration exists with the primary key ";
3438            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No ExportImportConfiguration exists with the key {";
3439            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
3440            private static final Log _log = LogFactoryUtil.getLog(ExportImportConfigurationPersistenceImpl.class);
3441            private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
3442                                    "type", "settings"
3443                            });
3444            private static final ExportImportConfiguration _nullExportImportConfiguration =
3445                    new ExportImportConfigurationImpl() {
3446                            @Override
3447                            public Object clone() {
3448                                    return this;
3449                            }
3450    
3451                            @Override
3452                            public CacheModel<ExportImportConfiguration> toCacheModel() {
3453                                    return _nullExportImportConfigurationCacheModel;
3454                            }
3455                    };
3456    
3457            private static final CacheModel<ExportImportConfiguration> _nullExportImportConfigurationCacheModel =
3458                    new NullCacheModel();
3459    
3460            private static class NullCacheModel implements CacheModel<ExportImportConfiguration>,
3461                    MVCCModel {
3462                    @Override
3463                    public long getMvccVersion() {
3464                            return -1;
3465                    }
3466    
3467                    @Override
3468                    public void setMvccVersion(long mvccVersion) {
3469                    }
3470    
3471                    @Override
3472                    public ExportImportConfiguration toEntityModel() {
3473                            return _nullExportImportConfiguration;
3474                    }
3475            }
3476    }