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