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