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