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