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