001    /**
002     * Copyright (c) 2000-2010 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;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.kernel.annotation.BeanReference;
019    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020    import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
021    import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
022    import com.liferay.portal.kernel.dao.jdbc.RowMapper;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
026    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
027    import com.liferay.portal.kernel.dao.orm.FinderPath;
028    import com.liferay.portal.kernel.dao.orm.Query;
029    import com.liferay.portal.kernel.dao.orm.QueryPos;
030    import com.liferay.portal.kernel.dao.orm.QueryUtil;
031    import com.liferay.portal.kernel.dao.orm.SQLQuery;
032    import com.liferay.portal.kernel.dao.orm.Session;
033    import com.liferay.portal.kernel.exception.SystemException;
034    import com.liferay.portal.kernel.log.Log;
035    import com.liferay.portal.kernel.log.LogFactoryUtil;
036    import com.liferay.portal.kernel.util.GetterUtil;
037    import com.liferay.portal.kernel.util.InstanceFactory;
038    import com.liferay.portal.kernel.util.OrderByComparator;
039    import com.liferay.portal.kernel.util.SetUtil;
040    import com.liferay.portal.kernel.util.StringBundler;
041    import com.liferay.portal.kernel.util.StringPool;
042    import com.liferay.portal.kernel.util.StringUtil;
043    import com.liferay.portal.model.ModelListener;
044    import com.liferay.portal.security.permission.InlineSQLHelperUtil;
045    import com.liferay.portal.service.persistence.BatchSessionUtil;
046    import com.liferay.portal.service.persistence.ResourcePersistence;
047    import com.liferay.portal.service.persistence.UserPersistence;
048    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
049    
050    import com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException;
051    import com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion;
052    import com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl;
053    import com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl;
054    
055    import java.io.Serializable;
056    
057    import java.util.ArrayList;
058    import java.util.Collections;
059    import java.util.List;
060    import java.util.Set;
061    
062    /**
063     * The persistence implementation for the s c framework version service.
064     *
065     * <p>
066     * 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.
067     * </p>
068     *
069     * <p>
070     * Caching information and settings can be found in <code>portal.properties</code>
071     * </p>
072     *
073     * @author Brian Wing Shun Chan
074     * @see SCFrameworkVersionPersistence
075     * @see SCFrameworkVersionUtil
076     * @generated
077     */
078    public class SCFrameworkVersionPersistenceImpl extends BasePersistenceImpl<SCFrameworkVersion>
079            implements SCFrameworkVersionPersistence {
080            public static final String FINDER_CLASS_NAME_ENTITY = SCFrameworkVersionImpl.class.getName();
081            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
082                    ".List";
083            public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
084                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
085                            FINDER_CLASS_NAME_LIST, "findByGroupId",
086                            new String[] {
087                                    Long.class.getName(),
088                                    
089                            "java.lang.Integer", "java.lang.Integer",
090                                    "com.liferay.portal.kernel.util.OrderByComparator"
091                            });
092            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
093                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
094                            FINDER_CLASS_NAME_LIST, "countByGroupId",
095                            new String[] { Long.class.getName() });
096            public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
097                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
098                            FINDER_CLASS_NAME_LIST, "findByCompanyId",
099                            new String[] {
100                                    Long.class.getName(),
101                                    
102                            "java.lang.Integer", "java.lang.Integer",
103                                    "com.liferay.portal.kernel.util.OrderByComparator"
104                            });
105            public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
106                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
107                            FINDER_CLASS_NAME_LIST, "countByCompanyId",
108                            new String[] { Long.class.getName() });
109            public static final FinderPath FINDER_PATH_FIND_BY_G_A = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
110                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
111                            FINDER_CLASS_NAME_LIST, "findByG_A",
112                            new String[] {
113                                    Long.class.getName(), Boolean.class.getName(),
114                                    
115                            "java.lang.Integer", "java.lang.Integer",
116                                    "com.liferay.portal.kernel.util.OrderByComparator"
117                            });
118            public static final FinderPath FINDER_PATH_COUNT_BY_G_A = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
119                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
120                            FINDER_CLASS_NAME_LIST, "countByG_A",
121                            new String[] { Long.class.getName(), Boolean.class.getName() });
122            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
123                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
124                            FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
125            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
126                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED,
127                            FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
128    
129            /**
130             * Caches the s c framework version in the entity cache if it is enabled.
131             *
132             * @param scFrameworkVersion the s c framework version to cache
133             */
134            public void cacheResult(SCFrameworkVersion scFrameworkVersion) {
135                    EntityCacheUtil.putResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
136                            SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey(),
137                            scFrameworkVersion);
138            }
139    
140            /**
141             * Caches the s c framework versions in the entity cache if it is enabled.
142             *
143             * @param scFrameworkVersions the s c framework versions to cache
144             */
145            public void cacheResult(List<SCFrameworkVersion> scFrameworkVersions) {
146                    for (SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
147                            if (EntityCacheUtil.getResult(
148                                                    SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
149                                                    SCFrameworkVersionImpl.class,
150                                                    scFrameworkVersion.getPrimaryKey(), this) == null) {
151                                    cacheResult(scFrameworkVersion);
152                            }
153                    }
154            }
155    
156            /**
157             * Clears the cache for all s c framework versions.
158             *
159             * <p>
160             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
161             * </p>
162             */
163            public void clearCache() {
164                    CacheRegistryUtil.clear(SCFrameworkVersionImpl.class.getName());
165                    EntityCacheUtil.clearCache(SCFrameworkVersionImpl.class.getName());
166                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
167                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
168            }
169    
170            /**
171             * Clears the cache for the s c framework version.
172             *
173             * <p>
174             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
175             * </p>
176             */
177            public void clearCache(SCFrameworkVersion scFrameworkVersion) {
178                    EntityCacheUtil.removeResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
179                            SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey());
180            }
181    
182            /**
183             * Creates a new s c framework version with the primary key. Does not add the s c framework version to the database.
184             *
185             * @param frameworkVersionId the primary key for the new s c framework version
186             * @return the new s c framework version
187             */
188            public SCFrameworkVersion create(long frameworkVersionId) {
189                    SCFrameworkVersion scFrameworkVersion = new SCFrameworkVersionImpl();
190    
191                    scFrameworkVersion.setNew(true);
192                    scFrameworkVersion.setPrimaryKey(frameworkVersionId);
193    
194                    return scFrameworkVersion;
195            }
196    
197            /**
198             * Removes the s c framework version with the primary key from the database. Also notifies the appropriate model listeners.
199             *
200             * @param primaryKey the primary key of the s c framework version to remove
201             * @return the s c framework version that was removed
202             * @throws com.liferay.portal.NoSuchModelException if a s c framework version with the primary key could not be found
203             * @throws SystemException if a system exception occurred
204             */
205            public SCFrameworkVersion remove(Serializable primaryKey)
206                    throws NoSuchModelException, SystemException {
207                    return remove(((Long)primaryKey).longValue());
208            }
209    
210            /**
211             * Removes the s c framework version with the primary key from the database. Also notifies the appropriate model listeners.
212             *
213             * @param frameworkVersionId the primary key of the s c framework version to remove
214             * @return the s c framework version that was removed
215             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a s c framework version with the primary key could not be found
216             * @throws SystemException if a system exception occurred
217             */
218            public SCFrameworkVersion remove(long frameworkVersionId)
219                    throws NoSuchFrameworkVersionException, SystemException {
220                    Session session = null;
221    
222                    try {
223                            session = openSession();
224    
225                            SCFrameworkVersion scFrameworkVersion = (SCFrameworkVersion)session.get(SCFrameworkVersionImpl.class,
226                                            new Long(frameworkVersionId));
227    
228                            if (scFrameworkVersion == null) {
229                                    if (_log.isWarnEnabled()) {
230                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
231                                                    frameworkVersionId);
232                                    }
233    
234                                    throw new NoSuchFrameworkVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
235                                            frameworkVersionId);
236                            }
237    
238                            return remove(scFrameworkVersion);
239                    }
240                    catch (NoSuchFrameworkVersionException nsee) {
241                            throw nsee;
242                    }
243                    catch (Exception e) {
244                            throw processException(e);
245                    }
246                    finally {
247                            closeSession(session);
248                    }
249            }
250    
251            protected SCFrameworkVersion removeImpl(
252                    SCFrameworkVersion scFrameworkVersion) throws SystemException {
253                    scFrameworkVersion = toUnwrappedModel(scFrameworkVersion);
254    
255                    try {
256                            clearSCProductVersions.clear(scFrameworkVersion.getPrimaryKey());
257                    }
258                    catch (Exception e) {
259                            throw processException(e);
260                    }
261                    finally {
262                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
263                    }
264    
265                    Session session = null;
266    
267                    try {
268                            session = openSession();
269    
270                            if (scFrameworkVersion.isCachedModel() ||
271                                            BatchSessionUtil.isEnabled()) {
272                                    Object staleObject = session.get(SCFrameworkVersionImpl.class,
273                                                    scFrameworkVersion.getPrimaryKeyObj());
274    
275                                    if (staleObject != null) {
276                                            session.evict(staleObject);
277                                    }
278                            }
279    
280                            session.delete(scFrameworkVersion);
281    
282                            session.flush();
283                    }
284                    catch (Exception e) {
285                            throw processException(e);
286                    }
287                    finally {
288                            closeSession(session);
289                    }
290    
291                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
292    
293                    EntityCacheUtil.removeResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
294                            SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey());
295    
296                    return scFrameworkVersion;
297            }
298    
299            public SCFrameworkVersion updateImpl(
300                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion,
301                    boolean merge) throws SystemException {
302                    scFrameworkVersion = toUnwrappedModel(scFrameworkVersion);
303    
304                    Session session = null;
305    
306                    try {
307                            session = openSession();
308    
309                            BatchSessionUtil.update(session, scFrameworkVersion, merge);
310    
311                            scFrameworkVersion.setNew(false);
312                    }
313                    catch (Exception e) {
314                            throw processException(e);
315                    }
316                    finally {
317                            closeSession(session);
318                    }
319    
320                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
321    
322                    EntityCacheUtil.putResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
323                            SCFrameworkVersionImpl.class, scFrameworkVersion.getPrimaryKey(),
324                            scFrameworkVersion);
325    
326                    return scFrameworkVersion;
327            }
328    
329            protected SCFrameworkVersion toUnwrappedModel(
330                    SCFrameworkVersion scFrameworkVersion) {
331                    if (scFrameworkVersion instanceof SCFrameworkVersionImpl) {
332                            return scFrameworkVersion;
333                    }
334    
335                    SCFrameworkVersionImpl scFrameworkVersionImpl = new SCFrameworkVersionImpl();
336    
337                    scFrameworkVersionImpl.setNew(scFrameworkVersion.isNew());
338                    scFrameworkVersionImpl.setPrimaryKey(scFrameworkVersion.getPrimaryKey());
339    
340                    scFrameworkVersionImpl.setFrameworkVersionId(scFrameworkVersion.getFrameworkVersionId());
341                    scFrameworkVersionImpl.setGroupId(scFrameworkVersion.getGroupId());
342                    scFrameworkVersionImpl.setCompanyId(scFrameworkVersion.getCompanyId());
343                    scFrameworkVersionImpl.setUserId(scFrameworkVersion.getUserId());
344                    scFrameworkVersionImpl.setUserName(scFrameworkVersion.getUserName());
345                    scFrameworkVersionImpl.setCreateDate(scFrameworkVersion.getCreateDate());
346                    scFrameworkVersionImpl.setModifiedDate(scFrameworkVersion.getModifiedDate());
347                    scFrameworkVersionImpl.setName(scFrameworkVersion.getName());
348                    scFrameworkVersionImpl.setUrl(scFrameworkVersion.getUrl());
349                    scFrameworkVersionImpl.setActive(scFrameworkVersion.isActive());
350                    scFrameworkVersionImpl.setPriority(scFrameworkVersion.getPriority());
351    
352                    return scFrameworkVersionImpl;
353            }
354    
355            /**
356             * Finds the s c framework version with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
357             *
358             * @param primaryKey the primary key of the s c framework version to find
359             * @return the s c framework version
360             * @throws com.liferay.portal.NoSuchModelException if a s c framework version with the primary key could not be found
361             * @throws SystemException if a system exception occurred
362             */
363            public SCFrameworkVersion findByPrimaryKey(Serializable primaryKey)
364                    throws NoSuchModelException, SystemException {
365                    return findByPrimaryKey(((Long)primaryKey).longValue());
366            }
367    
368            /**
369             * Finds the s c framework version with the primary key or throws a {@link com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException} if it could not be found.
370             *
371             * @param frameworkVersionId the primary key of the s c framework version to find
372             * @return the s c framework version
373             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a s c framework version with the primary key could not be found
374             * @throws SystemException if a system exception occurred
375             */
376            public SCFrameworkVersion findByPrimaryKey(long frameworkVersionId)
377                    throws NoSuchFrameworkVersionException, SystemException {
378                    SCFrameworkVersion scFrameworkVersion = fetchByPrimaryKey(frameworkVersionId);
379    
380                    if (scFrameworkVersion == null) {
381                            if (_log.isWarnEnabled()) {
382                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
383                                            frameworkVersionId);
384                            }
385    
386                            throw new NoSuchFrameworkVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
387                                    frameworkVersionId);
388                    }
389    
390                    return scFrameworkVersion;
391            }
392    
393            /**
394             * Finds the s c framework version with the primary key or returns <code>null</code> if it could not be found.
395             *
396             * @param primaryKey the primary key of the s c framework version to find
397             * @return the s c framework version, or <code>null</code> if a s c framework version with the primary key could not be found
398             * @throws SystemException if a system exception occurred
399             */
400            public SCFrameworkVersion fetchByPrimaryKey(Serializable primaryKey)
401                    throws SystemException {
402                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
403            }
404    
405            /**
406             * Finds the s c framework version with the primary key or returns <code>null</code> if it could not be found.
407             *
408             * @param frameworkVersionId the primary key of the s c framework version to find
409             * @return the s c framework version, or <code>null</code> if a s c framework version with the primary key could not be found
410             * @throws SystemException if a system exception occurred
411             */
412            public SCFrameworkVersion fetchByPrimaryKey(long frameworkVersionId)
413                    throws SystemException {
414                    SCFrameworkVersion scFrameworkVersion = (SCFrameworkVersion)EntityCacheUtil.getResult(SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
415                                    SCFrameworkVersionImpl.class, frameworkVersionId, this);
416    
417                    if (scFrameworkVersion == null) {
418                            Session session = null;
419    
420                            try {
421                                    session = openSession();
422    
423                                    scFrameworkVersion = (SCFrameworkVersion)session.get(SCFrameworkVersionImpl.class,
424                                                    new Long(frameworkVersionId));
425                            }
426                            catch (Exception e) {
427                                    throw processException(e);
428                            }
429                            finally {
430                                    if (scFrameworkVersion != null) {
431                                            cacheResult(scFrameworkVersion);
432                                    }
433    
434                                    closeSession(session);
435                            }
436                    }
437    
438                    return scFrameworkVersion;
439            }
440    
441            /**
442             * Finds all the s c framework versions where groupId = &#63;.
443             *
444             * @param groupId the group id to search with
445             * @return the matching s c framework versions
446             * @throws SystemException if a system exception occurred
447             */
448            public List<SCFrameworkVersion> findByGroupId(long groupId)
449                    throws SystemException {
450                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
451            }
452    
453            /**
454             * Finds a range of all the s c framework versions where groupId = &#63;.
455             *
456             * <p>
457             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
458             * </p>
459             *
460             * @param groupId the group id to search with
461             * @param start the lower bound of the range of s c framework versions to return
462             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
463             * @return the range of matching s c framework versions
464             * @throws SystemException if a system exception occurred
465             */
466            public List<SCFrameworkVersion> findByGroupId(long groupId, int start,
467                    int end) throws SystemException {
468                    return findByGroupId(groupId, start, end, null);
469            }
470    
471            /**
472             * Finds an ordered range of all the s c framework versions where groupId = &#63;.
473             *
474             * <p>
475             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
476             * </p>
477             *
478             * @param groupId the group id to search with
479             * @param start the lower bound of the range of s c framework versions to return
480             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
481             * @param orderByComparator the comparator to order the results by
482             * @return the ordered range of matching s c framework versions
483             * @throws SystemException if a system exception occurred
484             */
485            public List<SCFrameworkVersion> findByGroupId(long groupId, int start,
486                    int end, OrderByComparator orderByComparator) throws SystemException {
487                    Object[] finderArgs = new Object[] {
488                                    groupId,
489                                    
490                                    String.valueOf(start), String.valueOf(end),
491                                    String.valueOf(orderByComparator)
492                            };
493    
494                    List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
495                                    finderArgs, this);
496    
497                    if (list == null) {
498                            Session session = null;
499    
500                            try {
501                                    session = openSession();
502    
503                                    StringBundler query = null;
504    
505                                    if (orderByComparator != null) {
506                                            query = new StringBundler(3 +
507                                                            (orderByComparator.getOrderByFields().length * 3));
508                                    }
509                                    else {
510                                            query = new StringBundler(3);
511                                    }
512    
513                                    query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
514    
515                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
516    
517                                    if (orderByComparator != null) {
518                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
519                                                    orderByComparator);
520                                    }
521    
522                                    else {
523                                            query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
524                                    }
525    
526                                    String sql = query.toString();
527    
528                                    Query q = session.createQuery(sql);
529    
530                                    QueryPos qPos = QueryPos.getInstance(q);
531    
532                                    qPos.add(groupId);
533    
534                                    list = (List<SCFrameworkVersion>)QueryUtil.list(q,
535                                                    getDialect(), start, end);
536                            }
537                            catch (Exception e) {
538                                    throw processException(e);
539                            }
540                            finally {
541                                    if (list == null) {
542                                            list = new ArrayList<SCFrameworkVersion>();
543                                    }
544    
545                                    cacheResult(list);
546    
547                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
548                                            finderArgs, list);
549    
550                                    closeSession(session);
551                            }
552                    }
553    
554                    return list;
555            }
556    
557            /**
558             * Finds the first s c framework version in the ordered set where groupId = &#63;.
559             *
560             * <p>
561             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
562             * </p>
563             *
564             * @param groupId the group id to search with
565             * @param orderByComparator the comparator to order the set by
566             * @return the first matching s c framework version
567             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a matching s c framework version could not be found
568             * @throws SystemException if a system exception occurred
569             */
570            public SCFrameworkVersion findByGroupId_First(long groupId,
571                    OrderByComparator orderByComparator)
572                    throws NoSuchFrameworkVersionException, SystemException {
573                    List<SCFrameworkVersion> list = findByGroupId(groupId, 0, 1,
574                                    orderByComparator);
575    
576                    if (list.isEmpty()) {
577                            StringBundler msg = new StringBundler(4);
578    
579                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
580    
581                            msg.append("groupId=");
582                            msg.append(groupId);
583    
584                            msg.append(StringPool.CLOSE_CURLY_BRACE);
585    
586                            throw new NoSuchFrameworkVersionException(msg.toString());
587                    }
588                    else {
589                            return list.get(0);
590                    }
591            }
592    
593            /**
594             * Finds the last s c framework version in the ordered set where groupId = &#63;.
595             *
596             * <p>
597             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
598             * </p>
599             *
600             * @param groupId the group id to search with
601             * @param orderByComparator the comparator to order the set by
602             * @return the last matching s c framework version
603             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a matching s c framework version could not be found
604             * @throws SystemException if a system exception occurred
605             */
606            public SCFrameworkVersion findByGroupId_Last(long groupId,
607                    OrderByComparator orderByComparator)
608                    throws NoSuchFrameworkVersionException, SystemException {
609                    int count = countByGroupId(groupId);
610    
611                    List<SCFrameworkVersion> list = findByGroupId(groupId, count - 1,
612                                    count, orderByComparator);
613    
614                    if (list.isEmpty()) {
615                            StringBundler msg = new StringBundler(4);
616    
617                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
618    
619                            msg.append("groupId=");
620                            msg.append(groupId);
621    
622                            msg.append(StringPool.CLOSE_CURLY_BRACE);
623    
624                            throw new NoSuchFrameworkVersionException(msg.toString());
625                    }
626                    else {
627                            return list.get(0);
628                    }
629            }
630    
631            /**
632             * Finds the s c framework versions before and after the current s c framework version in the ordered set where groupId = &#63;.
633             *
634             * <p>
635             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
636             * </p>
637             *
638             * @param frameworkVersionId the primary key of the current s c framework version
639             * @param groupId the group id to search with
640             * @param orderByComparator the comparator to order the set by
641             * @return the previous, current, and next s c framework version
642             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a s c framework version with the primary key could not be found
643             * @throws SystemException if a system exception occurred
644             */
645            public SCFrameworkVersion[] findByGroupId_PrevAndNext(
646                    long frameworkVersionId, long groupId,
647                    OrderByComparator orderByComparator)
648                    throws NoSuchFrameworkVersionException, SystemException {
649                    SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
650    
651                    Session session = null;
652    
653                    try {
654                            session = openSession();
655    
656                            SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
657    
658                            array[0] = getByGroupId_PrevAndNext(session, scFrameworkVersion,
659                                            groupId, orderByComparator, true);
660    
661                            array[1] = scFrameworkVersion;
662    
663                            array[2] = getByGroupId_PrevAndNext(session, scFrameworkVersion,
664                                            groupId, orderByComparator, false);
665    
666                            return array;
667                    }
668                    catch (Exception e) {
669                            throw processException(e);
670                    }
671                    finally {
672                            closeSession(session);
673                    }
674            }
675    
676            protected SCFrameworkVersion getByGroupId_PrevAndNext(Session session,
677                    SCFrameworkVersion scFrameworkVersion, long groupId,
678                    OrderByComparator orderByComparator, boolean previous) {
679                    StringBundler query = null;
680    
681                    if (orderByComparator != null) {
682                            query = new StringBundler(6 +
683                                            (orderByComparator.getOrderByFields().length * 6));
684                    }
685                    else {
686                            query = new StringBundler(3);
687                    }
688    
689                    query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
690    
691                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
692    
693                    if (orderByComparator != null) {
694                            String[] orderByFields = orderByComparator.getOrderByFields();
695    
696                            if (orderByFields.length > 0) {
697                                    query.append(WHERE_AND);
698                            }
699    
700                            for (int i = 0; i < orderByFields.length; i++) {
701                                    query.append(_ORDER_BY_ENTITY_ALIAS);
702                                    query.append(orderByFields[i]);
703    
704                                    if ((i + 1) < orderByFields.length) {
705                                            if (orderByComparator.isAscending() ^ previous) {
706                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
707                                            }
708                                            else {
709                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
710                                            }
711                                    }
712                                    else {
713                                            if (orderByComparator.isAscending() ^ previous) {
714                                                    query.append(WHERE_GREATER_THAN);
715                                            }
716                                            else {
717                                                    query.append(WHERE_LESSER_THAN);
718                                            }
719                                    }
720                            }
721    
722                            query.append(ORDER_BY_CLAUSE);
723    
724                            for (int i = 0; i < orderByFields.length; i++) {
725                                    query.append(_ORDER_BY_ENTITY_ALIAS);
726                                    query.append(orderByFields[i]);
727    
728                                    if ((i + 1) < orderByFields.length) {
729                                            if (orderByComparator.isAscending() ^ previous) {
730                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
731                                            }
732                                            else {
733                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
734                                            }
735                                    }
736                                    else {
737                                            if (orderByComparator.isAscending() ^ previous) {
738                                                    query.append(ORDER_BY_ASC);
739                                            }
740                                            else {
741                                                    query.append(ORDER_BY_DESC);
742                                            }
743                                    }
744                            }
745                    }
746    
747                    else {
748                            query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
749                    }
750    
751                    String sql = query.toString();
752    
753                    Query q = session.createQuery(sql);
754    
755                    q.setFirstResult(0);
756                    q.setMaxResults(2);
757    
758                    QueryPos qPos = QueryPos.getInstance(q);
759    
760                    qPos.add(groupId);
761    
762                    if (orderByComparator != null) {
763                            Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
764    
765                            for (Object value : values) {
766                                    qPos.add(value);
767                            }
768                    }
769    
770                    List<SCFrameworkVersion> list = q.list();
771    
772                    if (list.size() == 2) {
773                            return list.get(1);
774                    }
775                    else {
776                            return null;
777                    }
778            }
779    
780            /**
781             * Filters by the user's permissions and finds all the s c framework versions where groupId = &#63;.
782             *
783             * @param groupId the group id to search with
784             * @return the matching s c framework versions that the user has permission to view
785             * @throws SystemException if a system exception occurred
786             */
787            public List<SCFrameworkVersion> filterFindByGroupId(long groupId)
788                    throws SystemException {
789                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
790                            QueryUtil.ALL_POS, null);
791            }
792    
793            /**
794             * Filters by the user's permissions and finds a range of all the s c framework versions where groupId = &#63;.
795             *
796             * <p>
797             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
798             * </p>
799             *
800             * @param groupId the group id to search with
801             * @param start the lower bound of the range of s c framework versions to return
802             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
803             * @return the range of matching s c framework versions that the user has permission to view
804             * @throws SystemException if a system exception occurred
805             */
806            public List<SCFrameworkVersion> filterFindByGroupId(long groupId,
807                    int start, int end) throws SystemException {
808                    return filterFindByGroupId(groupId, start, end, null);
809            }
810    
811            /**
812             * Filters by the user's permissions and finds an ordered range of all the s c framework versions where groupId = &#63;.
813             *
814             * <p>
815             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
816             * </p>
817             *
818             * @param groupId the group id to search with
819             * @param start the lower bound of the range of s c framework versions to return
820             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
821             * @param orderByComparator the comparator to order the results by
822             * @return the ordered range of matching s c framework versions that the user has permission to view
823             * @throws SystemException if a system exception occurred
824             */
825            public List<SCFrameworkVersion> filterFindByGroupId(long groupId,
826                    int start, int end, OrderByComparator orderByComparator)
827                    throws SystemException {
828                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
829                            return findByGroupId(groupId, start, end, orderByComparator);
830                    }
831    
832                    Session session = null;
833    
834                    try {
835                            session = openSession();
836    
837                            StringBundler query = null;
838    
839                            if (orderByComparator != null) {
840                                    query = new StringBundler(3 +
841                                                    (orderByComparator.getOrderByFields().length * 3));
842                            }
843                            else {
844                                    query = new StringBundler(3);
845                            }
846    
847                            query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
848    
849                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
850    
851                            if (orderByComparator != null) {
852                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
853                                            orderByComparator);
854                            }
855    
856                            else {
857                                    query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
858                            }
859    
860                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
861                                            SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
862                                            _FILTER_COLUMN_USERID, groupId);
863    
864                            SQLQuery q = session.createSQLQuery(sql);
865    
866                            q.addEntity(_FILTER_ENTITY_ALIAS, SCFrameworkVersionImpl.class);
867    
868                            QueryPos qPos = QueryPos.getInstance(q);
869    
870                            qPos.add(groupId);
871    
872                            return (List<SCFrameworkVersion>)QueryUtil.list(q, getDialect(),
873                                    start, end);
874                    }
875                    catch (Exception e) {
876                            throw processException(e);
877                    }
878                    finally {
879                            closeSession(session);
880                    }
881            }
882    
883            /**
884             * Finds all the s c framework versions where companyId = &#63;.
885             *
886             * @param companyId the company id to search with
887             * @return the matching s c framework versions
888             * @throws SystemException if a system exception occurred
889             */
890            public List<SCFrameworkVersion> findByCompanyId(long companyId)
891                    throws SystemException {
892                    return findByCompanyId(companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
893                            null);
894            }
895    
896            /**
897             * Finds a range of all the s c framework versions where companyId = &#63;.
898             *
899             * <p>
900             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
901             * </p>
902             *
903             * @param companyId the company id to search with
904             * @param start the lower bound of the range of s c framework versions to return
905             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
906             * @return the range of matching s c framework versions
907             * @throws SystemException if a system exception occurred
908             */
909            public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
910                    int end) throws SystemException {
911                    return findByCompanyId(companyId, start, end, null);
912            }
913    
914            /**
915             * Finds an ordered range of all the s c framework versions where companyId = &#63;.
916             *
917             * <p>
918             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
919             * </p>
920             *
921             * @param companyId the company id to search with
922             * @param start the lower bound of the range of s c framework versions to return
923             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
924             * @param orderByComparator the comparator to order the results by
925             * @return the ordered range of matching s c framework versions
926             * @throws SystemException if a system exception occurred
927             */
928            public List<SCFrameworkVersion> findByCompanyId(long companyId, int start,
929                    int end, OrderByComparator orderByComparator) throws SystemException {
930                    Object[] finderArgs = new Object[] {
931                                    companyId,
932                                    
933                                    String.valueOf(start), String.valueOf(end),
934                                    String.valueOf(orderByComparator)
935                            };
936    
937                    List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
938                                    finderArgs, this);
939    
940                    if (list == null) {
941                            Session session = null;
942    
943                            try {
944                                    session = openSession();
945    
946                                    StringBundler query = null;
947    
948                                    if (orderByComparator != null) {
949                                            query = new StringBundler(3 +
950                                                            (orderByComparator.getOrderByFields().length * 3));
951                                    }
952                                    else {
953                                            query = new StringBundler(3);
954                                    }
955    
956                                    query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
957    
958                                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
959    
960                                    if (orderByComparator != null) {
961                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
962                                                    orderByComparator);
963                                    }
964    
965                                    else {
966                                            query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
967                                    }
968    
969                                    String sql = query.toString();
970    
971                                    Query q = session.createQuery(sql);
972    
973                                    QueryPos qPos = QueryPos.getInstance(q);
974    
975                                    qPos.add(companyId);
976    
977                                    list = (List<SCFrameworkVersion>)QueryUtil.list(q,
978                                                    getDialect(), start, end);
979                            }
980                            catch (Exception e) {
981                                    throw processException(e);
982                            }
983                            finally {
984                                    if (list == null) {
985                                            list = new ArrayList<SCFrameworkVersion>();
986                                    }
987    
988                                    cacheResult(list);
989    
990                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
991                                            finderArgs, list);
992    
993                                    closeSession(session);
994                            }
995                    }
996    
997                    return list;
998            }
999    
1000            /**
1001             * Finds the first s c framework version in the ordered set where companyId = &#63;.
1002             *
1003             * <p>
1004             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1005             * </p>
1006             *
1007             * @param companyId the company id to search with
1008             * @param orderByComparator the comparator to order the set by
1009             * @return the first matching s c framework version
1010             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a matching s c framework version could not be found
1011             * @throws SystemException if a system exception occurred
1012             */
1013            public SCFrameworkVersion findByCompanyId_First(long companyId,
1014                    OrderByComparator orderByComparator)
1015                    throws NoSuchFrameworkVersionException, SystemException {
1016                    List<SCFrameworkVersion> list = findByCompanyId(companyId, 0, 1,
1017                                    orderByComparator);
1018    
1019                    if (list.isEmpty()) {
1020                            StringBundler msg = new StringBundler(4);
1021    
1022                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1023    
1024                            msg.append("companyId=");
1025                            msg.append(companyId);
1026    
1027                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1028    
1029                            throw new NoSuchFrameworkVersionException(msg.toString());
1030                    }
1031                    else {
1032                            return list.get(0);
1033                    }
1034            }
1035    
1036            /**
1037             * Finds the last s c framework version in the ordered set where companyId = &#63;.
1038             *
1039             * <p>
1040             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1041             * </p>
1042             *
1043             * @param companyId the company id to search with
1044             * @param orderByComparator the comparator to order the set by
1045             * @return the last matching s c framework version
1046             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a matching s c framework version could not be found
1047             * @throws SystemException if a system exception occurred
1048             */
1049            public SCFrameworkVersion findByCompanyId_Last(long companyId,
1050                    OrderByComparator orderByComparator)
1051                    throws NoSuchFrameworkVersionException, SystemException {
1052                    int count = countByCompanyId(companyId);
1053    
1054                    List<SCFrameworkVersion> list = findByCompanyId(companyId, count - 1,
1055                                    count, orderByComparator);
1056    
1057                    if (list.isEmpty()) {
1058                            StringBundler msg = new StringBundler(4);
1059    
1060                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1061    
1062                            msg.append("companyId=");
1063                            msg.append(companyId);
1064    
1065                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1066    
1067                            throw new NoSuchFrameworkVersionException(msg.toString());
1068                    }
1069                    else {
1070                            return list.get(0);
1071                    }
1072            }
1073    
1074            /**
1075             * Finds the s c framework versions before and after the current s c framework version in the ordered set where companyId = &#63;.
1076             *
1077             * <p>
1078             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1079             * </p>
1080             *
1081             * @param frameworkVersionId the primary key of the current s c framework version
1082             * @param companyId the company id to search with
1083             * @param orderByComparator the comparator to order the set by
1084             * @return the previous, current, and next s c framework version
1085             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a s c framework version with the primary key could not be found
1086             * @throws SystemException if a system exception occurred
1087             */
1088            public SCFrameworkVersion[] findByCompanyId_PrevAndNext(
1089                    long frameworkVersionId, long companyId,
1090                    OrderByComparator orderByComparator)
1091                    throws NoSuchFrameworkVersionException, SystemException {
1092                    SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
1093    
1094                    Session session = null;
1095    
1096                    try {
1097                            session = openSession();
1098    
1099                            SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
1100    
1101                            array[0] = getByCompanyId_PrevAndNext(session, scFrameworkVersion,
1102                                            companyId, orderByComparator, true);
1103    
1104                            array[1] = scFrameworkVersion;
1105    
1106                            array[2] = getByCompanyId_PrevAndNext(session, scFrameworkVersion,
1107                                            companyId, orderByComparator, false);
1108    
1109                            return array;
1110                    }
1111                    catch (Exception e) {
1112                            throw processException(e);
1113                    }
1114                    finally {
1115                            closeSession(session);
1116                    }
1117            }
1118    
1119            protected SCFrameworkVersion getByCompanyId_PrevAndNext(Session session,
1120                    SCFrameworkVersion scFrameworkVersion, long companyId,
1121                    OrderByComparator orderByComparator, boolean previous) {
1122                    StringBundler query = null;
1123    
1124                    if (orderByComparator != null) {
1125                            query = new StringBundler(6 +
1126                                            (orderByComparator.getOrderByFields().length * 6));
1127                    }
1128                    else {
1129                            query = new StringBundler(3);
1130                    }
1131    
1132                    query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1133    
1134                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1135    
1136                    if (orderByComparator != null) {
1137                            String[] orderByFields = orderByComparator.getOrderByFields();
1138    
1139                            if (orderByFields.length > 0) {
1140                                    query.append(WHERE_AND);
1141                            }
1142    
1143                            for (int i = 0; i < orderByFields.length; i++) {
1144                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1145                                    query.append(orderByFields[i]);
1146    
1147                                    if ((i + 1) < orderByFields.length) {
1148                                            if (orderByComparator.isAscending() ^ previous) {
1149                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1150                                            }
1151                                            else {
1152                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1153                                            }
1154                                    }
1155                                    else {
1156                                            if (orderByComparator.isAscending() ^ previous) {
1157                                                    query.append(WHERE_GREATER_THAN);
1158                                            }
1159                                            else {
1160                                                    query.append(WHERE_LESSER_THAN);
1161                                            }
1162                                    }
1163                            }
1164    
1165                            query.append(ORDER_BY_CLAUSE);
1166    
1167                            for (int i = 0; i < orderByFields.length; i++) {
1168                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1169                                    query.append(orderByFields[i]);
1170    
1171                                    if ((i + 1) < orderByFields.length) {
1172                                            if (orderByComparator.isAscending() ^ previous) {
1173                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1174                                            }
1175                                            else {
1176                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1177                                            }
1178                                    }
1179                                    else {
1180                                            if (orderByComparator.isAscending() ^ previous) {
1181                                                    query.append(ORDER_BY_ASC);
1182                                            }
1183                                            else {
1184                                                    query.append(ORDER_BY_DESC);
1185                                            }
1186                                    }
1187                            }
1188                    }
1189    
1190                    else {
1191                            query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1192                    }
1193    
1194                    String sql = query.toString();
1195    
1196                    Query q = session.createQuery(sql);
1197    
1198                    q.setFirstResult(0);
1199                    q.setMaxResults(2);
1200    
1201                    QueryPos qPos = QueryPos.getInstance(q);
1202    
1203                    qPos.add(companyId);
1204    
1205                    if (orderByComparator != null) {
1206                            Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
1207    
1208                            for (Object value : values) {
1209                                    qPos.add(value);
1210                            }
1211                    }
1212    
1213                    List<SCFrameworkVersion> list = q.list();
1214    
1215                    if (list.size() == 2) {
1216                            return list.get(1);
1217                    }
1218                    else {
1219                            return null;
1220                    }
1221            }
1222    
1223            /**
1224             * Finds all the s c framework versions where groupId = &#63; and active = &#63;.
1225             *
1226             * @param groupId the group id to search with
1227             * @param active the active to search with
1228             * @return the matching s c framework versions
1229             * @throws SystemException if a system exception occurred
1230             */
1231            public List<SCFrameworkVersion> findByG_A(long groupId, boolean active)
1232                    throws SystemException {
1233                    return findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1234                            null);
1235            }
1236    
1237            /**
1238             * Finds a range of all the s c framework versions where groupId = &#63; and active = &#63;.
1239             *
1240             * <p>
1241             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1242             * </p>
1243             *
1244             * @param groupId the group id to search with
1245             * @param active the active to search with
1246             * @param start the lower bound of the range of s c framework versions to return
1247             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
1248             * @return the range of matching s c framework versions
1249             * @throws SystemException if a system exception occurred
1250             */
1251            public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
1252                    int start, int end) throws SystemException {
1253                    return findByG_A(groupId, active, start, end, null);
1254            }
1255    
1256            /**
1257             * Finds an ordered range of all the s c framework versions where groupId = &#63; and active = &#63;.
1258             *
1259             * <p>
1260             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1261             * </p>
1262             *
1263             * @param groupId the group id to search with
1264             * @param active the active to search with
1265             * @param start the lower bound of the range of s c framework versions to return
1266             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
1267             * @param orderByComparator the comparator to order the results by
1268             * @return the ordered range of matching s c framework versions
1269             * @throws SystemException if a system exception occurred
1270             */
1271            public List<SCFrameworkVersion> findByG_A(long groupId, boolean active,
1272                    int start, int end, OrderByComparator orderByComparator)
1273                    throws SystemException {
1274                    Object[] finderArgs = new Object[] {
1275                                    groupId, active,
1276                                    
1277                                    String.valueOf(start), String.valueOf(end),
1278                                    String.valueOf(orderByComparator)
1279                            };
1280    
1281                    List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_A,
1282                                    finderArgs, this);
1283    
1284                    if (list == null) {
1285                            Session session = null;
1286    
1287                            try {
1288                                    session = openSession();
1289    
1290                                    StringBundler query = null;
1291    
1292                                    if (orderByComparator != null) {
1293                                            query = new StringBundler(4 +
1294                                                            (orderByComparator.getOrderByFields().length * 3));
1295                                    }
1296                                    else {
1297                                            query = new StringBundler(4);
1298                                    }
1299    
1300                                    query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1301    
1302                                    query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1303    
1304                                    query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1305    
1306                                    if (orderByComparator != null) {
1307                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1308                                                    orderByComparator);
1309                                    }
1310    
1311                                    else {
1312                                            query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1313                                    }
1314    
1315                                    String sql = query.toString();
1316    
1317                                    Query q = session.createQuery(sql);
1318    
1319                                    QueryPos qPos = QueryPos.getInstance(q);
1320    
1321                                    qPos.add(groupId);
1322    
1323                                    qPos.add(active);
1324    
1325                                    list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1326                                                    getDialect(), start, end);
1327                            }
1328                            catch (Exception e) {
1329                                    throw processException(e);
1330                            }
1331                            finally {
1332                                    if (list == null) {
1333                                            list = new ArrayList<SCFrameworkVersion>();
1334                                    }
1335    
1336                                    cacheResult(list);
1337    
1338                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_A, finderArgs,
1339                                            list);
1340    
1341                                    closeSession(session);
1342                            }
1343                    }
1344    
1345                    return list;
1346            }
1347    
1348            /**
1349             * Finds the first s c framework version in the ordered set where groupId = &#63; and active = &#63;.
1350             *
1351             * <p>
1352             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1353             * </p>
1354             *
1355             * @param groupId the group id to search with
1356             * @param active the active to search with
1357             * @param orderByComparator the comparator to order the set by
1358             * @return the first matching s c framework version
1359             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a matching s c framework version could not be found
1360             * @throws SystemException if a system exception occurred
1361             */
1362            public SCFrameworkVersion findByG_A_First(long groupId, boolean active,
1363                    OrderByComparator orderByComparator)
1364                    throws NoSuchFrameworkVersionException, SystemException {
1365                    List<SCFrameworkVersion> list = findByG_A(groupId, active, 0, 1,
1366                                    orderByComparator);
1367    
1368                    if (list.isEmpty()) {
1369                            StringBundler msg = new StringBundler(6);
1370    
1371                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1372    
1373                            msg.append("groupId=");
1374                            msg.append(groupId);
1375    
1376                            msg.append(", active=");
1377                            msg.append(active);
1378    
1379                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1380    
1381                            throw new NoSuchFrameworkVersionException(msg.toString());
1382                    }
1383                    else {
1384                            return list.get(0);
1385                    }
1386            }
1387    
1388            /**
1389             * Finds the last s c framework version in the ordered set where groupId = &#63; and active = &#63;.
1390             *
1391             * <p>
1392             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1393             * </p>
1394             *
1395             * @param groupId the group id to search with
1396             * @param active the active to search with
1397             * @param orderByComparator the comparator to order the set by
1398             * @return the last matching s c framework version
1399             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a matching s c framework version could not be found
1400             * @throws SystemException if a system exception occurred
1401             */
1402            public SCFrameworkVersion findByG_A_Last(long groupId, boolean active,
1403                    OrderByComparator orderByComparator)
1404                    throws NoSuchFrameworkVersionException, SystemException {
1405                    int count = countByG_A(groupId, active);
1406    
1407                    List<SCFrameworkVersion> list = findByG_A(groupId, active, count - 1,
1408                                    count, orderByComparator);
1409    
1410                    if (list.isEmpty()) {
1411                            StringBundler msg = new StringBundler(6);
1412    
1413                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1414    
1415                            msg.append("groupId=");
1416                            msg.append(groupId);
1417    
1418                            msg.append(", active=");
1419                            msg.append(active);
1420    
1421                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1422    
1423                            throw new NoSuchFrameworkVersionException(msg.toString());
1424                    }
1425                    else {
1426                            return list.get(0);
1427                    }
1428            }
1429    
1430            /**
1431             * Finds the s c framework versions before and after the current s c framework version in the ordered set where groupId = &#63; and active = &#63;.
1432             *
1433             * <p>
1434             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1435             * </p>
1436             *
1437             * @param frameworkVersionId the primary key of the current s c framework version
1438             * @param groupId the group id to search with
1439             * @param active the active to search with
1440             * @param orderByComparator the comparator to order the set by
1441             * @return the previous, current, and next s c framework version
1442             * @throws com.liferay.portlet.softwarecatalog.NoSuchFrameworkVersionException if a s c framework version with the primary key could not be found
1443             * @throws SystemException if a system exception occurred
1444             */
1445            public SCFrameworkVersion[] findByG_A_PrevAndNext(long frameworkVersionId,
1446                    long groupId, boolean active, OrderByComparator orderByComparator)
1447                    throws NoSuchFrameworkVersionException, SystemException {
1448                    SCFrameworkVersion scFrameworkVersion = findByPrimaryKey(frameworkVersionId);
1449    
1450                    Session session = null;
1451    
1452                    try {
1453                            session = openSession();
1454    
1455                            SCFrameworkVersion[] array = new SCFrameworkVersionImpl[3];
1456    
1457                            array[0] = getByG_A_PrevAndNext(session, scFrameworkVersion,
1458                                            groupId, active, orderByComparator, true);
1459    
1460                            array[1] = scFrameworkVersion;
1461    
1462                            array[2] = getByG_A_PrevAndNext(session, scFrameworkVersion,
1463                                            groupId, active, orderByComparator, false);
1464    
1465                            return array;
1466                    }
1467                    catch (Exception e) {
1468                            throw processException(e);
1469                    }
1470                    finally {
1471                            closeSession(session);
1472                    }
1473            }
1474    
1475            protected SCFrameworkVersion getByG_A_PrevAndNext(Session session,
1476                    SCFrameworkVersion scFrameworkVersion, long groupId, boolean active,
1477                    OrderByComparator orderByComparator, boolean previous) {
1478                    StringBundler query = null;
1479    
1480                    if (orderByComparator != null) {
1481                            query = new StringBundler(6 +
1482                                            (orderByComparator.getOrderByFields().length * 6));
1483                    }
1484                    else {
1485                            query = new StringBundler(3);
1486                    }
1487    
1488                    query.append(_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1489    
1490                    query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1491    
1492                    query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1493    
1494                    if (orderByComparator != null) {
1495                            String[] orderByFields = orderByComparator.getOrderByFields();
1496    
1497                            if (orderByFields.length > 0) {
1498                                    query.append(WHERE_AND);
1499                            }
1500    
1501                            for (int i = 0; i < orderByFields.length; i++) {
1502                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1503                                    query.append(orderByFields[i]);
1504    
1505                                    if ((i + 1) < orderByFields.length) {
1506                                            if (orderByComparator.isAscending() ^ previous) {
1507                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1508                                            }
1509                                            else {
1510                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1511                                            }
1512                                    }
1513                                    else {
1514                                            if (orderByComparator.isAscending() ^ previous) {
1515                                                    query.append(WHERE_GREATER_THAN);
1516                                            }
1517                                            else {
1518                                                    query.append(WHERE_LESSER_THAN);
1519                                            }
1520                                    }
1521                            }
1522    
1523                            query.append(ORDER_BY_CLAUSE);
1524    
1525                            for (int i = 0; i < orderByFields.length; i++) {
1526                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1527                                    query.append(orderByFields[i]);
1528    
1529                                    if ((i + 1) < orderByFields.length) {
1530                                            if (orderByComparator.isAscending() ^ previous) {
1531                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1532                                            }
1533                                            else {
1534                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1535                                            }
1536                                    }
1537                                    else {
1538                                            if (orderByComparator.isAscending() ^ previous) {
1539                                                    query.append(ORDER_BY_ASC);
1540                                            }
1541                                            else {
1542                                                    query.append(ORDER_BY_DESC);
1543                                            }
1544                                    }
1545                            }
1546                    }
1547    
1548                    else {
1549                            query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1550                    }
1551    
1552                    String sql = query.toString();
1553    
1554                    Query q = session.createQuery(sql);
1555    
1556                    q.setFirstResult(0);
1557                    q.setMaxResults(2);
1558    
1559                    QueryPos qPos = QueryPos.getInstance(q);
1560    
1561                    qPos.add(groupId);
1562    
1563                    qPos.add(active);
1564    
1565                    if (orderByComparator != null) {
1566                            Object[] values = orderByComparator.getOrderByValues(scFrameworkVersion);
1567    
1568                            for (Object value : values) {
1569                                    qPos.add(value);
1570                            }
1571                    }
1572    
1573                    List<SCFrameworkVersion> list = q.list();
1574    
1575                    if (list.size() == 2) {
1576                            return list.get(1);
1577                    }
1578                    else {
1579                            return null;
1580                    }
1581            }
1582    
1583            /**
1584             * Filters by the user's permissions and finds all the s c framework versions where groupId = &#63; and active = &#63;.
1585             *
1586             * @param groupId the group id to search with
1587             * @param active the active to search with
1588             * @return the matching s c framework versions that the user has permission to view
1589             * @throws SystemException if a system exception occurred
1590             */
1591            public List<SCFrameworkVersion> filterFindByG_A(long groupId, boolean active)
1592                    throws SystemException {
1593                    return filterFindByG_A(groupId, active, QueryUtil.ALL_POS,
1594                            QueryUtil.ALL_POS, null);
1595            }
1596    
1597            /**
1598             * Filters by the user's permissions and finds a range of all the s c framework versions where groupId = &#63; and active = &#63;.
1599             *
1600             * <p>
1601             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1602             * </p>
1603             *
1604             * @param groupId the group id to search with
1605             * @param active the active to search with
1606             * @param start the lower bound of the range of s c framework versions to return
1607             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
1608             * @return the range of matching s c framework versions that the user has permission to view
1609             * @throws SystemException if a system exception occurred
1610             */
1611            public List<SCFrameworkVersion> filterFindByG_A(long groupId,
1612                    boolean active, int start, int end) throws SystemException {
1613                    return filterFindByG_A(groupId, active, start, end, null);
1614            }
1615    
1616            /**
1617             * Filters by the user's permissions and finds an ordered range of all the s c framework versions where groupId = &#63; and active = &#63;.
1618             *
1619             * <p>
1620             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1621             * </p>
1622             *
1623             * @param groupId the group id to search with
1624             * @param active the active to search with
1625             * @param start the lower bound of the range of s c framework versions to return
1626             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
1627             * @param orderByComparator the comparator to order the results by
1628             * @return the ordered range of matching s c framework versions that the user has permission to view
1629             * @throws SystemException if a system exception occurred
1630             */
1631            public List<SCFrameworkVersion> filterFindByG_A(long groupId,
1632                    boolean active, int start, int end, OrderByComparator orderByComparator)
1633                    throws SystemException {
1634                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1635                            return findByG_A(groupId, active, start, end, orderByComparator);
1636                    }
1637    
1638                    Session session = null;
1639    
1640                    try {
1641                            session = openSession();
1642    
1643                            StringBundler query = null;
1644    
1645                            if (orderByComparator != null) {
1646                                    query = new StringBundler(4 +
1647                                                    (orderByComparator.getOrderByFields().length * 3));
1648                            }
1649                            else {
1650                                    query = new StringBundler(4);
1651                            }
1652    
1653                            query.append(_FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE);
1654    
1655                            query.append(_FINDER_COLUMN_G_A_GROUPID_2);
1656    
1657                            query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
1658    
1659                            if (orderByComparator != null) {
1660                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1661                                            orderByComparator);
1662                            }
1663    
1664                            else {
1665                                    query.append(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1666                            }
1667    
1668                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1669                                            SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
1670                                            _FILTER_COLUMN_USERID, groupId);
1671    
1672                            SQLQuery q = session.createSQLQuery(sql);
1673    
1674                            q.addEntity(_FILTER_ENTITY_ALIAS, SCFrameworkVersionImpl.class);
1675    
1676                            QueryPos qPos = QueryPos.getInstance(q);
1677    
1678                            qPos.add(groupId);
1679    
1680                            qPos.add(active);
1681    
1682                            return (List<SCFrameworkVersion>)QueryUtil.list(q, getDialect(),
1683                                    start, end);
1684                    }
1685                    catch (Exception e) {
1686                            throw processException(e);
1687                    }
1688                    finally {
1689                            closeSession(session);
1690                    }
1691            }
1692    
1693            /**
1694             * Finds all the s c framework versions.
1695             *
1696             * @return the s c framework versions
1697             * @throws SystemException if a system exception occurred
1698             */
1699            public List<SCFrameworkVersion> findAll() throws SystemException {
1700                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1701            }
1702    
1703            /**
1704             * Finds a range of all the s c framework versions.
1705             *
1706             * <p>
1707             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1708             * </p>
1709             *
1710             * @param start the lower bound of the range of s c framework versions to return
1711             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
1712             * @return the range of s c framework versions
1713             * @throws SystemException if a system exception occurred
1714             */
1715            public List<SCFrameworkVersion> findAll(int start, int end)
1716                    throws SystemException {
1717                    return findAll(start, end, null);
1718            }
1719    
1720            /**
1721             * Finds an ordered range of all the s c framework versions.
1722             *
1723             * <p>
1724             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1725             * </p>
1726             *
1727             * @param start the lower bound of the range of s c framework versions to return
1728             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
1729             * @param orderByComparator the comparator to order the results by
1730             * @return the ordered range of s c framework versions
1731             * @throws SystemException if a system exception occurred
1732             */
1733            public List<SCFrameworkVersion> findAll(int start, int end,
1734                    OrderByComparator orderByComparator) throws SystemException {
1735                    Object[] finderArgs = new Object[] {
1736                                    String.valueOf(start), String.valueOf(end),
1737                                    String.valueOf(orderByComparator)
1738                            };
1739    
1740                    List<SCFrameworkVersion> list = (List<SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1741                                    finderArgs, this);
1742    
1743                    if (list == null) {
1744                            Session session = null;
1745    
1746                            try {
1747                                    session = openSession();
1748    
1749                                    StringBundler query = null;
1750                                    String sql = null;
1751    
1752                                    if (orderByComparator != null) {
1753                                            query = new StringBundler(2 +
1754                                                            (orderByComparator.getOrderByFields().length * 3));
1755    
1756                                            query.append(_SQL_SELECT_SCFRAMEWORKVERSION);
1757    
1758                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1759                                                    orderByComparator);
1760    
1761                                            sql = query.toString();
1762                                    }
1763                                    else {
1764                                            sql = _SQL_SELECT_SCFRAMEWORKVERSION.concat(SCFrameworkVersionModelImpl.ORDER_BY_JPQL);
1765                                    }
1766    
1767                                    Query q = session.createQuery(sql);
1768    
1769                                    if (orderByComparator == null) {
1770                                            list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1771                                                            getDialect(), start, end, false);
1772    
1773                                            Collections.sort(list);
1774                                    }
1775                                    else {
1776                                            list = (List<SCFrameworkVersion>)QueryUtil.list(q,
1777                                                            getDialect(), start, end);
1778                                    }
1779                            }
1780                            catch (Exception e) {
1781                                    throw processException(e);
1782                            }
1783                            finally {
1784                                    if (list == null) {
1785                                            list = new ArrayList<SCFrameworkVersion>();
1786                                    }
1787    
1788                                    cacheResult(list);
1789    
1790                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1791    
1792                                    closeSession(session);
1793                            }
1794                    }
1795    
1796                    return list;
1797            }
1798    
1799            /**
1800             * Removes all the s c framework versions where groupId = &#63; from the database.
1801             *
1802             * @param groupId the group id to search with
1803             * @throws SystemException if a system exception occurred
1804             */
1805            public void removeByGroupId(long groupId) throws SystemException {
1806                    for (SCFrameworkVersion scFrameworkVersion : findByGroupId(groupId)) {
1807                            remove(scFrameworkVersion);
1808                    }
1809            }
1810    
1811            /**
1812             * Removes all the s c framework versions where companyId = &#63; from the database.
1813             *
1814             * @param companyId the company id to search with
1815             * @throws SystemException if a system exception occurred
1816             */
1817            public void removeByCompanyId(long companyId) throws SystemException {
1818                    for (SCFrameworkVersion scFrameworkVersion : findByCompanyId(companyId)) {
1819                            remove(scFrameworkVersion);
1820                    }
1821            }
1822    
1823            /**
1824             * Removes all the s c framework versions where groupId = &#63; and active = &#63; from the database.
1825             *
1826             * @param groupId the group id to search with
1827             * @param active the active to search with
1828             * @throws SystemException if a system exception occurred
1829             */
1830            public void removeByG_A(long groupId, boolean active)
1831                    throws SystemException {
1832                    for (SCFrameworkVersion scFrameworkVersion : findByG_A(groupId, active)) {
1833                            remove(scFrameworkVersion);
1834                    }
1835            }
1836    
1837            /**
1838             * Removes all the s c framework versions from the database.
1839             *
1840             * @throws SystemException if a system exception occurred
1841             */
1842            public void removeAll() throws SystemException {
1843                    for (SCFrameworkVersion scFrameworkVersion : findAll()) {
1844                            remove(scFrameworkVersion);
1845                    }
1846            }
1847    
1848            /**
1849             * Counts all the s c framework versions where groupId = &#63;.
1850             *
1851             * @param groupId the group id to search with
1852             * @return the number of matching s c framework versions
1853             * @throws SystemException if a system exception occurred
1854             */
1855            public int countByGroupId(long groupId) throws SystemException {
1856                    Object[] finderArgs = new Object[] { groupId };
1857    
1858                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1859                                    finderArgs, this);
1860    
1861                    if (count == null) {
1862                            Session session = null;
1863    
1864                            try {
1865                                    session = openSession();
1866    
1867                                    StringBundler query = new StringBundler(2);
1868    
1869                                    query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1870    
1871                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1872    
1873                                    String sql = query.toString();
1874    
1875                                    Query q = session.createQuery(sql);
1876    
1877                                    QueryPos qPos = QueryPos.getInstance(q);
1878    
1879                                    qPos.add(groupId);
1880    
1881                                    count = (Long)q.uniqueResult();
1882                            }
1883                            catch (Exception e) {
1884                                    throw processException(e);
1885                            }
1886                            finally {
1887                                    if (count == null) {
1888                                            count = Long.valueOf(0);
1889                                    }
1890    
1891                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1892                                            finderArgs, count);
1893    
1894                                    closeSession(session);
1895                            }
1896                    }
1897    
1898                    return count.intValue();
1899            }
1900    
1901            /**
1902             * Filters by the user's permissions and counts all the s c framework versions where groupId = &#63;.
1903             *
1904             * @param groupId the group id to search with
1905             * @return the number of matching s c framework versions that the user has permission to view
1906             * @throws SystemException if a system exception occurred
1907             */
1908            public int filterCountByGroupId(long groupId) throws SystemException {
1909                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1910                            return countByGroupId(groupId);
1911                    }
1912    
1913                    Session session = null;
1914    
1915                    try {
1916                            session = openSession();
1917    
1918                            StringBundler query = new StringBundler(2);
1919    
1920                            query.append(_FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1921    
1922                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1923    
1924                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1925                                            SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
1926                                            _FILTER_COLUMN_USERID, groupId);
1927    
1928                            SQLQuery q = session.createSQLQuery(sql);
1929    
1930                            q.addScalar(COUNT_COLUMN_NAME,
1931                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
1932    
1933                            QueryPos qPos = QueryPos.getInstance(q);
1934    
1935                            qPos.add(groupId);
1936    
1937                            Long count = (Long)q.uniqueResult();
1938    
1939                            return count.intValue();
1940                    }
1941                    catch (Exception e) {
1942                            throw processException(e);
1943                    }
1944                    finally {
1945                            closeSession(session);
1946                    }
1947            }
1948    
1949            /**
1950             * Counts all the s c framework versions where companyId = &#63;.
1951             *
1952             * @param companyId the company id to search with
1953             * @return the number of matching s c framework versions
1954             * @throws SystemException if a system exception occurred
1955             */
1956            public int countByCompanyId(long companyId) throws SystemException {
1957                    Object[] finderArgs = new Object[] { companyId };
1958    
1959                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1960                                    finderArgs, this);
1961    
1962                    if (count == null) {
1963                            Session session = null;
1964    
1965                            try {
1966                                    session = openSession();
1967    
1968                                    StringBundler query = new StringBundler(2);
1969    
1970                                    query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
1971    
1972                                    query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
1973    
1974                                    String sql = query.toString();
1975    
1976                                    Query q = session.createQuery(sql);
1977    
1978                                    QueryPos qPos = QueryPos.getInstance(q);
1979    
1980                                    qPos.add(companyId);
1981    
1982                                    count = (Long)q.uniqueResult();
1983                            }
1984                            catch (Exception e) {
1985                                    throw processException(e);
1986                            }
1987                            finally {
1988                                    if (count == null) {
1989                                            count = Long.valueOf(0);
1990                                    }
1991    
1992                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1993                                            finderArgs, count);
1994    
1995                                    closeSession(session);
1996                            }
1997                    }
1998    
1999                    return count.intValue();
2000            }
2001    
2002            /**
2003             * Counts all the s c framework versions where groupId = &#63; and active = &#63;.
2004             *
2005             * @param groupId the group id to search with
2006             * @param active the active to search with
2007             * @return the number of matching s c framework versions
2008             * @throws SystemException if a system exception occurred
2009             */
2010            public int countByG_A(long groupId, boolean active)
2011                    throws SystemException {
2012                    Object[] finderArgs = new Object[] { groupId, active };
2013    
2014                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_A,
2015                                    finderArgs, this);
2016    
2017                    if (count == null) {
2018                            Session session = null;
2019    
2020                            try {
2021                                    session = openSession();
2022    
2023                                    StringBundler query = new StringBundler(3);
2024    
2025                                    query.append(_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
2026    
2027                                    query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2028    
2029                                    query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
2030    
2031                                    String sql = query.toString();
2032    
2033                                    Query q = session.createQuery(sql);
2034    
2035                                    QueryPos qPos = QueryPos.getInstance(q);
2036    
2037                                    qPos.add(groupId);
2038    
2039                                    qPos.add(active);
2040    
2041                                    count = (Long)q.uniqueResult();
2042                            }
2043                            catch (Exception e) {
2044                                    throw processException(e);
2045                            }
2046                            finally {
2047                                    if (count == null) {
2048                                            count = Long.valueOf(0);
2049                                    }
2050    
2051                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_A, finderArgs,
2052                                            count);
2053    
2054                                    closeSession(session);
2055                            }
2056                    }
2057    
2058                    return count.intValue();
2059            }
2060    
2061            /**
2062             * Filters by the user's permissions and counts all the s c framework versions where groupId = &#63; and active = &#63;.
2063             *
2064             * @param groupId the group id to search with
2065             * @param active the active to search with
2066             * @return the number of matching s c framework versions that the user has permission to view
2067             * @throws SystemException if a system exception occurred
2068             */
2069            public int filterCountByG_A(long groupId, boolean active)
2070                    throws SystemException {
2071                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2072                            return countByG_A(groupId, active);
2073                    }
2074    
2075                    Session session = null;
2076    
2077                    try {
2078                            session = openSession();
2079    
2080                            StringBundler query = new StringBundler(3);
2081    
2082                            query.append(_FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE);
2083    
2084                            query.append(_FINDER_COLUMN_G_A_GROUPID_2);
2085    
2086                            query.append(_FINDER_COLUMN_G_A_ACTIVE_2);
2087    
2088                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2089                                            SCFrameworkVersion.class.getName(), _FILTER_COLUMN_PK,
2090                                            _FILTER_COLUMN_USERID, groupId);
2091    
2092                            SQLQuery q = session.createSQLQuery(sql);
2093    
2094                            q.addScalar(COUNT_COLUMN_NAME,
2095                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
2096    
2097                            QueryPos qPos = QueryPos.getInstance(q);
2098    
2099                            qPos.add(groupId);
2100    
2101                            qPos.add(active);
2102    
2103                            Long count = (Long)q.uniqueResult();
2104    
2105                            return count.intValue();
2106                    }
2107                    catch (Exception e) {
2108                            throw processException(e);
2109                    }
2110                    finally {
2111                            closeSession(session);
2112                    }
2113            }
2114    
2115            /**
2116             * Counts all the s c framework versions.
2117             *
2118             * @return the number of s c framework versions
2119             * @throws SystemException if a system exception occurred
2120             */
2121            public int countAll() throws SystemException {
2122                    Object[] finderArgs = new Object[0];
2123    
2124                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2125                                    finderArgs, this);
2126    
2127                    if (count == null) {
2128                            Session session = null;
2129    
2130                            try {
2131                                    session = openSession();
2132    
2133                                    Query q = session.createQuery(_SQL_COUNT_SCFRAMEWORKVERSION);
2134    
2135                                    count = (Long)q.uniqueResult();
2136                            }
2137                            catch (Exception e) {
2138                                    throw processException(e);
2139                            }
2140                            finally {
2141                                    if (count == null) {
2142                                            count = Long.valueOf(0);
2143                                    }
2144    
2145                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
2146                                            count);
2147    
2148                                    closeSession(session);
2149                            }
2150                    }
2151    
2152                    return count.intValue();
2153            }
2154    
2155            /**
2156             * Gets all the s c product versions associated with the s c framework version.
2157             *
2158             * @param pk the primary key of the s c framework version to get the associated s c product versions for
2159             * @return the s c product versions associated with the s c framework version
2160             * @throws SystemException if a system exception occurred
2161             */
2162            public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2163                    long pk) throws SystemException {
2164                    return getSCProductVersions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
2165            }
2166    
2167            /**
2168             * Gets a range of all the s c product versions associated with the s c framework version.
2169             *
2170             * <p>
2171             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2172             * </p>
2173             *
2174             * @param pk the primary key of the s c framework version to get the associated s c product versions for
2175             * @param start the lower bound of the range of s c framework versions to return
2176             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
2177             * @return the range of s c product versions associated with the s c framework version
2178             * @throws SystemException if a system exception occurred
2179             */
2180            public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2181                    long pk, int start, int end) throws SystemException {
2182                    return getSCProductVersions(pk, start, end, null);
2183            }
2184    
2185            public static final FinderPath FINDER_PATH_GET_SCPRODUCTVERSIONS = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2186                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2187                            SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2188                            "getSCProductVersions",
2189                            new String[] {
2190                                    Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
2191                                    "com.liferay.portal.kernel.util.OrderByComparator"
2192                            });
2193    
2194            /**
2195             * Gets an ordered range of all the s c product versions associated with the s c framework version.
2196             *
2197             * <p>
2198             * 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2199             * </p>
2200             *
2201             * @param pk the primary key of the s c framework version to get the associated s c product versions for
2202             * @param start the lower bound of the range of s c framework versions to return
2203             * @param end the upper bound of the range of s c framework versions to return (not inclusive)
2204             * @param orderByComparator the comparator to order the results by
2205             * @return the ordered range of s c product versions associated with the s c framework version
2206             * @throws SystemException if a system exception occurred
2207             */
2208            public List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getSCProductVersions(
2209                    long pk, int start, int end, OrderByComparator orderByComparator)
2210                    throws SystemException {
2211                    Object[] finderArgs = new Object[] {
2212                                    pk, String.valueOf(start), String.valueOf(end),
2213                                    String.valueOf(orderByComparator)
2214                            };
2215    
2216                    List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> list = (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCPRODUCTVERSIONS,
2217                                    finderArgs, this);
2218    
2219                    if (list == null) {
2220                            Session session = null;
2221    
2222                            try {
2223                                    session = openSession();
2224    
2225                                    String sql = null;
2226    
2227                                    if (orderByComparator != null) {
2228                                            sql = _SQL_GETSCPRODUCTVERSIONS.concat(ORDER_BY_CLAUSE)
2229                                                                                                       .concat(orderByComparator.getOrderBy());
2230                                    }
2231                                    else {
2232                                            sql = _SQL_GETSCPRODUCTVERSIONS.concat(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ORDER_BY_SQL);
2233                                    }
2234    
2235                                    SQLQuery q = session.createSQLQuery(sql);
2236    
2237                                    q.addEntity("SCProductVersion",
2238                                            com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionImpl.class);
2239    
2240                                    QueryPos qPos = QueryPos.getInstance(q);
2241    
2242                                    qPos.add(pk);
2243    
2244                                    list = (List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)QueryUtil.list(q,
2245                                                    getDialect(), start, end);
2246                            }
2247                            catch (Exception e) {
2248                                    throw processException(e);
2249                            }
2250                            finally {
2251                                    if (list == null) {
2252                                            list = new ArrayList<com.liferay.portlet.softwarecatalog.model.SCProductVersion>();
2253                                    }
2254    
2255                                    scProductVersionPersistence.cacheResult(list);
2256    
2257                                    FinderCacheUtil.putResult(FINDER_PATH_GET_SCPRODUCTVERSIONS,
2258                                            finderArgs, list);
2259    
2260                                    closeSession(session);
2261                            }
2262                    }
2263    
2264                    return list;
2265            }
2266    
2267            public static final FinderPath FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2268                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2269                            SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2270                            "getSCProductVersionsSize", new String[] { Long.class.getName() });
2271    
2272            /**
2273             * Gets the number of s c product versions associated with the s c framework version.
2274             *
2275             * @param pk the primary key of the s c framework version to get the number of associated s c product versions for
2276             * @return the number of s c product versions associated with the s c framework version
2277             * @throws SystemException if a system exception occurred
2278             */
2279            public int getSCProductVersionsSize(long pk) throws SystemException {
2280                    Object[] finderArgs = new Object[] { pk };
2281    
2282                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE,
2283                                    finderArgs, this);
2284    
2285                    if (count == null) {
2286                            Session session = null;
2287    
2288                            try {
2289                                    session = openSession();
2290    
2291                                    SQLQuery q = session.createSQLQuery(_SQL_GETSCPRODUCTVERSIONSSIZE);
2292    
2293                                    q.addScalar(COUNT_COLUMN_NAME,
2294                                            com.liferay.portal.kernel.dao.orm.Type.LONG);
2295    
2296                                    QueryPos qPos = QueryPos.getInstance(q);
2297    
2298                                    qPos.add(pk);
2299    
2300                                    count = (Long)q.uniqueResult();
2301                            }
2302                            catch (Exception e) {
2303                                    throw processException(e);
2304                            }
2305                            finally {
2306                                    if (count == null) {
2307                                            count = Long.valueOf(0);
2308                                    }
2309    
2310                                    FinderCacheUtil.putResult(FINDER_PATH_GET_SCPRODUCTVERSIONS_SIZE,
2311                                            finderArgs, count);
2312    
2313                                    closeSession(session);
2314                            }
2315                    }
2316    
2317                    return count.intValue();
2318            }
2319    
2320            public static final FinderPath FINDER_PATH_CONTAINS_SCPRODUCTVERSION = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
2321                            SCFrameworkVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
2322                            SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
2323                            "containsSCProductVersion",
2324                            new String[] { Long.class.getName(), Long.class.getName() });
2325    
2326            /**
2327             * Determines whether the s c product version is associated with the s c framework version.
2328             *
2329             * @param pk the primary key of the s c framework version
2330             * @param scProductVersionPK the primary key of the s c product version
2331             * @return whether the s c product version is associated with the s c framework version
2332             * @throws SystemException if a system exception occurred
2333             */
2334            public boolean containsSCProductVersion(long pk, long scProductVersionPK)
2335                    throws SystemException {
2336                    Object[] finderArgs = new Object[] { pk, scProductVersionPK };
2337    
2338                    Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCPRODUCTVERSION,
2339                                    finderArgs, this);
2340    
2341                    if (value == null) {
2342                            try {
2343                                    value = Boolean.valueOf(containsSCProductVersion.contains(pk,
2344                                                            scProductVersionPK));
2345                            }
2346                            catch (Exception e) {
2347                                    throw processException(e);
2348                            }
2349                            finally {
2350                                    if (value == null) {
2351                                            value = Boolean.FALSE;
2352                                    }
2353    
2354                                    FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCPRODUCTVERSION,
2355                                            finderArgs, value);
2356                            }
2357                    }
2358    
2359                    return value.booleanValue();
2360            }
2361    
2362            /**
2363             * Determines whether the s c framework version has any s c product versions associated with it.
2364             *
2365             * @param pk the primary key of the s c framework version to check for associations with s c product versions
2366             * @return whether the s c framework version has any s c product versions associated with it
2367             * @throws SystemException if a system exception occurred
2368             */
2369            public boolean containsSCProductVersions(long pk) throws SystemException {
2370                    if (getSCProductVersionsSize(pk) > 0) {
2371                            return true;
2372                    }
2373                    else {
2374                            return false;
2375                    }
2376            }
2377    
2378            /**
2379             * 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.
2380             *
2381             * @param pk the primary key of the s c framework version
2382             * @param scProductVersionPK the primary key of the s c product version
2383             * @throws SystemException if a system exception occurred
2384             */
2385            public void addSCProductVersion(long pk, long scProductVersionPK)
2386                    throws SystemException {
2387                    try {
2388                            addSCProductVersion.add(pk, scProductVersionPK);
2389                    }
2390                    catch (Exception e) {
2391                            throw processException(e);
2392                    }
2393                    finally {
2394                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2395                    }
2396            }
2397    
2398            /**
2399             * 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.
2400             *
2401             * @param pk the primary key of the s c framework version
2402             * @param scProductVersion the s c product version
2403             * @throws SystemException if a system exception occurred
2404             */
2405            public void addSCProductVersion(long pk,
2406                    com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
2407                    throws SystemException {
2408                    try {
2409                            addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
2410                    }
2411                    catch (Exception e) {
2412                            throw processException(e);
2413                    }
2414                    finally {
2415                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2416                    }
2417            }
2418    
2419            /**
2420             * 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.
2421             *
2422             * @param pk the primary key of the s c framework version
2423             * @param scProductVersionPKs the primary keys of the s c product versions
2424             * @throws SystemException if a system exception occurred
2425             */
2426            public void addSCProductVersions(long pk, long[] scProductVersionPKs)
2427                    throws SystemException {
2428                    try {
2429                            for (long scProductVersionPK : scProductVersionPKs) {
2430                                    addSCProductVersion.add(pk, scProductVersionPK);
2431                            }
2432                    }
2433                    catch (Exception e) {
2434                            throw processException(e);
2435                    }
2436                    finally {
2437                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2438                    }
2439            }
2440    
2441            /**
2442             * 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.
2443             *
2444             * @param pk the primary key of the s c framework version
2445             * @param scProductVersions the s c product versions
2446             * @throws SystemException if a system exception occurred
2447             */
2448            public void addSCProductVersions(long pk,
2449                    List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2450                    throws SystemException {
2451                    try {
2452                            for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2453                                    addSCProductVersion.add(pk, scProductVersion.getPrimaryKey());
2454                            }
2455                    }
2456                    catch (Exception e) {
2457                            throw processException(e);
2458                    }
2459                    finally {
2460                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2461                    }
2462            }
2463    
2464            /**
2465             * 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.
2466             *
2467             * @param pk the primary key of the s c framework version to clear the associated s c product versions from
2468             * @throws SystemException if a system exception occurred
2469             */
2470            public void clearSCProductVersions(long pk) throws SystemException {
2471                    try {
2472                            clearSCProductVersions.clear(pk);
2473                    }
2474                    catch (Exception e) {
2475                            throw processException(e);
2476                    }
2477                    finally {
2478                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2479                    }
2480            }
2481    
2482            /**
2483             * 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.
2484             *
2485             * @param pk the primary key of the s c framework version
2486             * @param scProductVersionPK the primary key of the s c product version
2487             * @throws SystemException if a system exception occurred
2488             */
2489            public void removeSCProductVersion(long pk, long scProductVersionPK)
2490                    throws SystemException {
2491                    try {
2492                            removeSCProductVersion.remove(pk, scProductVersionPK);
2493                    }
2494                    catch (Exception e) {
2495                            throw processException(e);
2496                    }
2497                    finally {
2498                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2499                    }
2500            }
2501    
2502            /**
2503             * 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.
2504             *
2505             * @param pk the primary key of the s c framework version
2506             * @param scProductVersion the s c product version
2507             * @throws SystemException if a system exception occurred
2508             */
2509            public void removeSCProductVersion(long pk,
2510                    com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
2511                    throws SystemException {
2512                    try {
2513                            removeSCProductVersion.remove(pk, scProductVersion.getPrimaryKey());
2514                    }
2515                    catch (Exception e) {
2516                            throw processException(e);
2517                    }
2518                    finally {
2519                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2520                    }
2521            }
2522    
2523            /**
2524             * 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.
2525             *
2526             * @param pk the primary key of the s c framework version
2527             * @param scProductVersionPKs the primary keys of the s c product versions
2528             * @throws SystemException if a system exception occurred
2529             */
2530            public void removeSCProductVersions(long pk, long[] scProductVersionPKs)
2531                    throws SystemException {
2532                    try {
2533                            for (long scProductVersionPK : scProductVersionPKs) {
2534                                    removeSCProductVersion.remove(pk, scProductVersionPK);
2535                            }
2536                    }
2537                    catch (Exception e) {
2538                            throw processException(e);
2539                    }
2540                    finally {
2541                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2542                    }
2543            }
2544    
2545            /**
2546             * 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.
2547             *
2548             * @param pk the primary key of the s c framework version
2549             * @param scProductVersions the s c product versions
2550             * @throws SystemException if a system exception occurred
2551             */
2552            public void removeSCProductVersions(long pk,
2553                    List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2554                    throws SystemException {
2555                    try {
2556                            for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2557                                    removeSCProductVersion.remove(pk,
2558                                            scProductVersion.getPrimaryKey());
2559                            }
2560                    }
2561                    catch (Exception e) {
2562                            throw processException(e);
2563                    }
2564                    finally {
2565                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2566                    }
2567            }
2568    
2569            /**
2570             * 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.
2571             *
2572             * @param pk the primary key of the s c framework version to set the associations for
2573             * @param scProductVersionPKs the primary keys of the s c product versions to be associated with the s c framework version
2574             * @throws SystemException if a system exception occurred
2575             */
2576            public void setSCProductVersions(long pk, long[] scProductVersionPKs)
2577                    throws SystemException {
2578                    try {
2579                            Set<Long> scProductVersionPKSet = SetUtil.fromArray(scProductVersionPKs);
2580    
2581                            List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions =
2582                                    getSCProductVersions(pk);
2583    
2584                            for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2585                                    if (!scProductVersionPKSet.remove(
2586                                                            scProductVersion.getPrimaryKey())) {
2587                                            removeSCProductVersion.remove(pk,
2588                                                    scProductVersion.getPrimaryKey());
2589                                    }
2590                            }
2591    
2592                            for (Long scProductVersionPK : scProductVersionPKSet) {
2593                                    addSCProductVersion.add(pk, scProductVersionPK);
2594                            }
2595                    }
2596                    catch (Exception e) {
2597                            throw processException(e);
2598                    }
2599                    finally {
2600                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2601                    }
2602            }
2603    
2604            /**
2605             * 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.
2606             *
2607             * @param pk the primary key of the s c framework version to set the associations for
2608             * @param scProductVersions the s c product versions to be associated with the s c framework version
2609             * @throws SystemException if a system exception occurred
2610             */
2611            public void setSCProductVersions(long pk,
2612                    List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions)
2613                    throws SystemException {
2614                    try {
2615                            long[] scProductVersionPKs = new long[scProductVersions.size()];
2616    
2617                            for (int i = 0; i < scProductVersions.size(); i++) {
2618                                    com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion =
2619                                            scProductVersions.get(i);
2620    
2621                                    scProductVersionPKs[i] = scProductVersion.getPrimaryKey();
2622                            }
2623    
2624                            setSCProductVersions(pk, scProductVersionPKs);
2625                    }
2626                    catch (Exception e) {
2627                            throw processException(e);
2628                    }
2629                    finally {
2630                            FinderCacheUtil.clearCache(SCFrameworkVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2631                    }
2632            }
2633    
2634            /**
2635             * Initializes the s c framework version persistence.
2636             */
2637            public void afterPropertiesSet() {
2638                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2639                                            com.liferay.portal.util.PropsUtil.get(
2640                                                    "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion")));
2641    
2642                    if (listenerClassNames.length > 0) {
2643                            try {
2644                                    List<ModelListener<SCFrameworkVersion>> listenersList = new ArrayList<ModelListener<SCFrameworkVersion>>();
2645    
2646                                    for (String listenerClassName : listenerClassNames) {
2647                                            listenersList.add((ModelListener<SCFrameworkVersion>)InstanceFactory.newInstance(
2648                                                            listenerClassName));
2649                                    }
2650    
2651                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2652                            }
2653                            catch (Exception e) {
2654                                    _log.error(e);
2655                            }
2656                    }
2657    
2658                    containsSCProductVersion = new ContainsSCProductVersion(this);
2659    
2660                    addSCProductVersion = new AddSCProductVersion(this);
2661                    clearSCProductVersions = new ClearSCProductVersions(this);
2662                    removeSCProductVersion = new RemoveSCProductVersion(this);
2663            }
2664    
2665            @BeanReference(type = SCLicensePersistence.class)
2666            protected SCLicensePersistence scLicensePersistence;
2667            @BeanReference(type = SCFrameworkVersionPersistence.class)
2668            protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
2669            @BeanReference(type = SCProductEntryPersistence.class)
2670            protected SCProductEntryPersistence scProductEntryPersistence;
2671            @BeanReference(type = SCProductScreenshotPersistence.class)
2672            protected SCProductScreenshotPersistence scProductScreenshotPersistence;
2673            @BeanReference(type = SCProductVersionPersistence.class)
2674            protected SCProductVersionPersistence scProductVersionPersistence;
2675            @BeanReference(type = ResourcePersistence.class)
2676            protected ResourcePersistence resourcePersistence;
2677            @BeanReference(type = UserPersistence.class)
2678            protected UserPersistence userPersistence;
2679            protected ContainsSCProductVersion containsSCProductVersion;
2680            protected AddSCProductVersion addSCProductVersion;
2681            protected ClearSCProductVersions clearSCProductVersions;
2682            protected RemoveSCProductVersion removeSCProductVersion;
2683    
2684            protected class ContainsSCProductVersion {
2685                    protected ContainsSCProductVersion(
2686                            SCFrameworkVersionPersistenceImpl persistenceImpl) {
2687                            super();
2688    
2689                            _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2690                                            _SQL_CONTAINSSCPRODUCTVERSION,
2691                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2692                                            RowMapper.COUNT);
2693                    }
2694    
2695                    protected boolean contains(long frameworkVersionId,
2696                            long productVersionId) {
2697                            List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2698                                                    new Long(frameworkVersionId), new Long(productVersionId)
2699                                            });
2700    
2701                            if (results.size() > 0) {
2702                                    Integer count = results.get(0);
2703    
2704                                    if (count.intValue() > 0) {
2705                                            return true;
2706                                    }
2707                            }
2708    
2709                            return false;
2710                    }
2711    
2712                    private MappingSqlQuery<Integer> _mappingSqlQuery;
2713            }
2714    
2715            protected class AddSCProductVersion {
2716                    protected AddSCProductVersion(
2717                            SCFrameworkVersionPersistenceImpl persistenceImpl) {
2718                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2719                                            "INSERT INTO SCFrameworkVersi_SCProductVers (frameworkVersionId, productVersionId) VALUES (?, ?)",
2720                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2721                            _persistenceImpl = persistenceImpl;
2722                    }
2723    
2724                    protected void add(long frameworkVersionId, long productVersionId)
2725                            throws SystemException {
2726                            if (!_persistenceImpl.containsSCProductVersion.contains(
2727                                                    frameworkVersionId, productVersionId)) {
2728                                    ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2729                                            scProductVersionPersistence.getListeners();
2730    
2731                                    for (ModelListener<SCFrameworkVersion> listener : listeners) {
2732                                            listener.onBeforeAddAssociation(frameworkVersionId,
2733                                                    com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2734                                                    productVersionId);
2735                                    }
2736    
2737                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2738                                            listener.onBeforeAddAssociation(productVersionId,
2739                                                    SCFrameworkVersion.class.getName(), frameworkVersionId);
2740                                    }
2741    
2742                                    _sqlUpdate.update(new Object[] {
2743                                                    new Long(frameworkVersionId), new Long(productVersionId)
2744                                            });
2745    
2746                                    for (ModelListener<SCFrameworkVersion> listener : listeners) {
2747                                            listener.onAfterAddAssociation(frameworkVersionId,
2748                                                    com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2749                                                    productVersionId);
2750                                    }
2751    
2752                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2753                                            listener.onAfterAddAssociation(productVersionId,
2754                                                    SCFrameworkVersion.class.getName(), frameworkVersionId);
2755                                    }
2756                            }
2757                    }
2758    
2759                    private SqlUpdate _sqlUpdate;
2760                    private SCFrameworkVersionPersistenceImpl _persistenceImpl;
2761            }
2762    
2763            protected class ClearSCProductVersions {
2764                    protected ClearSCProductVersions(
2765                            SCFrameworkVersionPersistenceImpl persistenceImpl) {
2766                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2767                                            "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?",
2768                                            new int[] { java.sql.Types.BIGINT });
2769                    }
2770    
2771                    protected void clear(long frameworkVersionId) throws SystemException {
2772                            ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2773                                    scProductVersionPersistence.getListeners();
2774    
2775                            List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> scProductVersions =
2776                                    null;
2777    
2778                            if ((listeners.length > 0) ||
2779                                            (scProductVersionListeners.length > 0)) {
2780                                    scProductVersions = getSCProductVersions(frameworkVersionId);
2781    
2782                                    for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2783                                            for (ModelListener<SCFrameworkVersion> listener : listeners) {
2784                                                    listener.onBeforeRemoveAssociation(frameworkVersionId,
2785                                                            com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2786                                                            scProductVersion.getPrimaryKey());
2787                                            }
2788    
2789                                            for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2790                                                    listener.onBeforeRemoveAssociation(scProductVersion.getPrimaryKey(),
2791                                                            SCFrameworkVersion.class.getName(),
2792                                                            frameworkVersionId);
2793                                            }
2794                                    }
2795                            }
2796    
2797                            _sqlUpdate.update(new Object[] { new Long(frameworkVersionId) });
2798    
2799                            if ((listeners.length > 0) ||
2800                                            (scProductVersionListeners.length > 0)) {
2801                                    for (com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion : scProductVersions) {
2802                                            for (ModelListener<SCFrameworkVersion> listener : listeners) {
2803                                                    listener.onAfterRemoveAssociation(frameworkVersionId,
2804                                                            com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2805                                                            scProductVersion.getPrimaryKey());
2806                                            }
2807    
2808                                            for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2809                                                    listener.onAfterRemoveAssociation(scProductVersion.getPrimaryKey(),
2810                                                            SCFrameworkVersion.class.getName(),
2811                                                            frameworkVersionId);
2812                                            }
2813                                    }
2814                            }
2815                    }
2816    
2817                    private SqlUpdate _sqlUpdate;
2818            }
2819    
2820            protected class RemoveSCProductVersion {
2821                    protected RemoveSCProductVersion(
2822                            SCFrameworkVersionPersistenceImpl persistenceImpl) {
2823                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2824                                            "DELETE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?",
2825                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2826                            _persistenceImpl = persistenceImpl;
2827                    }
2828    
2829                    protected void remove(long frameworkVersionId, long productVersionId)
2830                            throws SystemException {
2831                            if (_persistenceImpl.containsSCProductVersion.contains(
2832                                                    frameworkVersionId, productVersionId)) {
2833                                    ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion>[] scProductVersionListeners =
2834                                            scProductVersionPersistence.getListeners();
2835    
2836                                    for (ModelListener<SCFrameworkVersion> listener : listeners) {
2837                                            listener.onBeforeRemoveAssociation(frameworkVersionId,
2838                                                    com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2839                                                    productVersionId);
2840                                    }
2841    
2842                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2843                                            listener.onBeforeRemoveAssociation(productVersionId,
2844                                                    SCFrameworkVersion.class.getName(), frameworkVersionId);
2845                                    }
2846    
2847                                    _sqlUpdate.update(new Object[] {
2848                                                    new Long(frameworkVersionId), new Long(productVersionId)
2849                                            });
2850    
2851                                    for (ModelListener<SCFrameworkVersion> listener : listeners) {
2852                                            listener.onAfterRemoveAssociation(frameworkVersionId,
2853                                                    com.liferay.portlet.softwarecatalog.model.SCProductVersion.class.getName(),
2854                                                    productVersionId);
2855                                    }
2856    
2857                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCProductVersion> listener : scProductVersionListeners) {
2858                                            listener.onAfterRemoveAssociation(productVersionId,
2859                                                    SCFrameworkVersion.class.getName(), frameworkVersionId);
2860                                    }
2861                            }
2862                    }
2863    
2864                    private SqlUpdate _sqlUpdate;
2865                    private SCFrameworkVersionPersistenceImpl _persistenceImpl;
2866            }
2867    
2868            private static final String _SQL_SELECT_SCFRAMEWORKVERSION = "SELECT scFrameworkVersion FROM SCFrameworkVersion scFrameworkVersion";
2869            private static final String _SQL_SELECT_SCFRAMEWORKVERSION_WHERE = "SELECT scFrameworkVersion FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2870            private static final String _SQL_COUNT_SCFRAMEWORKVERSION = "SELECT COUNT(scFrameworkVersion) FROM SCFrameworkVersion scFrameworkVersion";
2871            private static final String _SQL_COUNT_SCFRAMEWORKVERSION_WHERE = "SELECT COUNT(scFrameworkVersion) FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2872            private static final String _SQL_GETSCPRODUCTVERSIONS = "SELECT {SCProductVersion.*} FROM SCProductVersion INNER JOIN SCFrameworkVersi_SCProductVers ON (SCFrameworkVersi_SCProductVers.productVersionId = SCProductVersion.productVersionId) WHERE (SCFrameworkVersi_SCProductVers.frameworkVersionId = ?)";
2873            private static final String _SQL_GETSCPRODUCTVERSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ?";
2874            private static final String _SQL_CONTAINSSCPRODUCTVERSION = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE frameworkVersionId = ? AND productVersionId = ?";
2875            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "scFrameworkVersion.groupId = ?";
2876            private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "scFrameworkVersion.companyId = ?";
2877            private static final String _FINDER_COLUMN_G_A_GROUPID_2 = "scFrameworkVersion.groupId = ? AND ";
2878            private static final String _FINDER_COLUMN_G_A_ACTIVE_2 = "scFrameworkVersion.active = ?";
2879            private static final String _FILTER_SQL_SELECT_SCFRAMEWORKVERSION_WHERE = "SELECT DISTINCT {scFrameworkVersion.*} FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2880            private static final String _FILTER_SQL_COUNT_SCFRAMEWORKVERSION_WHERE = "SELECT COUNT(DISTINCT scFrameworkVersion.frameworkVersionId) AS COUNT_VALUE FROM SCFrameworkVersion scFrameworkVersion WHERE ";
2881            private static final String _FILTER_COLUMN_PK = "scFrameworkVersion.frameworkVersionId";
2882            private static final String _FILTER_COLUMN_USERID = "scFrameworkVersion.userId";
2883            private static final String _FILTER_ENTITY_ALIAS = "scFrameworkVersion";
2884            private static final String _ORDER_BY_ENTITY_ALIAS = "scFrameworkVersion.";
2885            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCFrameworkVersion exists with the primary key ";
2886            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCFrameworkVersion exists with the key {";
2887            private static Log _log = LogFactoryUtil.getLog(SCFrameworkVersionPersistenceImpl.class);
2888    }