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