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