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