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