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