001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.softwarecatalog.service.persistence;
016    
017    import com.liferay.portal.kernel.bean.BeanReference;
018    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
019    import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
020    import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
021    import com.liferay.portal.kernel.dao.jdbc.RowMapper;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
025    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
026    import com.liferay.portal.kernel.dao.orm.FinderPath;
027    import com.liferay.portal.kernel.dao.orm.Query;
028    import com.liferay.portal.kernel.dao.orm.QueryPos;
029    import com.liferay.portal.kernel.dao.orm.QueryUtil;
030    import com.liferay.portal.kernel.dao.orm.SQLQuery;
031    import com.liferay.portal.kernel.dao.orm.Session;
032    import com.liferay.portal.kernel.exception.SystemException;
033    import com.liferay.portal.kernel.log.Log;
034    import com.liferay.portal.kernel.log.LogFactoryUtil;
035    import com.liferay.portal.kernel.util.GetterUtil;
036    import com.liferay.portal.kernel.util.InstanceFactory;
037    import com.liferay.portal.kernel.util.OrderByComparator;
038    import com.liferay.portal.kernel.util.SetUtil;
039    import com.liferay.portal.kernel.util.StringBundler;
040    import com.liferay.portal.kernel.util.StringPool;
041    import com.liferay.portal.kernel.util.StringUtil;
042    import com.liferay.portal.kernel.util.UnmodifiableList;
043    import com.liferay.portal.kernel.util.Validator;
044    import com.liferay.portal.model.CacheModel;
045    import com.liferay.portal.model.ModelListener;
046    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
047    
048    import com.liferay.portlet.softwarecatalog.NoSuchProductVersionException;
049    import com.liferay.portlet.softwarecatalog.model.SCProductVersion;
050    import com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionImpl;
051    import com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl;
052    
053    import java.io.Serializable;
054    
055    import java.util.ArrayList;
056    import java.util.Collections;
057    import java.util.List;
058    import java.util.Set;
059    
060    /**
061     * The persistence implementation for the s c product version service.
062     *
063     * <p>
064     * Caching information and settings can be found in <code>portal.properties</code>
065     * </p>
066     *
067     * @author Brian Wing Shun Chan
068     * @see SCProductVersionPersistence
069     * @see SCProductVersionUtil
070     * @generated
071     */
072    public class SCProductVersionPersistenceImpl extends BasePersistenceImpl<SCProductVersion>
073            implements SCProductVersionPersistence {
074            /*
075             * NOTE FOR DEVELOPERS:
076             *
077             * Never modify or reference this class directly. Always use {@link SCProductVersionUtil} to access the s c product version persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
078             */
079            public static final String FINDER_CLASS_NAME_ENTITY = SCProductVersionImpl.class.getName();
080            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
081                    ".List1";
082            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
083                    ".List2";
084            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
085                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
086                            SCProductVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
087                            "findAll", new String[0]);
088            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
089                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
090                            SCProductVersionImpl.class,
091                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
092            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
093                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
094                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
095            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PRODUCTENTRYID =
096                    new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
097                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
098                            SCProductVersionImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION,
099                            "findByProductEntryId",
100                            new String[] {
101                                    Long.class.getName(),
102                                    
103                            Integer.class.getName(), Integer.class.getName(),
104                                    OrderByComparator.class.getName()
105                            });
106            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID =
107                    new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
108                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
109                            SCProductVersionImpl.class,
110                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByProductEntryId",
111                            new String[] { Long.class.getName() },
112                            SCProductVersionModelImpl.PRODUCTENTRYID_COLUMN_BITMASK |
113                            SCProductVersionModelImpl.CREATEDATE_COLUMN_BITMASK);
114            public static final FinderPath FINDER_PATH_COUNT_BY_PRODUCTENTRYID = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
115                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
116                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByProductEntryId",
117                            new String[] { Long.class.getName() });
118    
119            /**
120             * Returns all the s c product versions where productEntryId = &#63;.
121             *
122             * @param productEntryId the product entry ID
123             * @return the matching s c product versions
124             * @throws SystemException if a system exception occurred
125             */
126            @Override
127            public List<SCProductVersion> findByProductEntryId(long productEntryId)
128                    throws SystemException {
129                    return findByProductEntryId(productEntryId, QueryUtil.ALL_POS,
130                            QueryUtil.ALL_POS, null);
131            }
132    
133            /**
134             * Returns a range of all the s c product versions where productEntryId = &#63;.
135             *
136             * <p>
137             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
138             * </p>
139             *
140             * @param productEntryId the product entry ID
141             * @param start the lower bound of the range of s c product versions
142             * @param end the upper bound of the range of s c product versions (not inclusive)
143             * @return the range of matching s c product versions
144             * @throws SystemException if a system exception occurred
145             */
146            @Override
147            public List<SCProductVersion> findByProductEntryId(long productEntryId,
148                    int start, int end) throws SystemException {
149                    return findByProductEntryId(productEntryId, start, end, null);
150            }
151    
152            /**
153             * Returns an ordered range of all the s c product versions where productEntryId = &#63;.
154             *
155             * <p>
156             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
157             * </p>
158             *
159             * @param productEntryId the product entry ID
160             * @param start the lower bound of the range of s c product versions
161             * @param end the upper bound of the range of s c product versions (not inclusive)
162             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
163             * @return the ordered range of matching s c product versions
164             * @throws SystemException if a system exception occurred
165             */
166            @Override
167            public List<SCProductVersion> findByProductEntryId(long productEntryId,
168                    int start, int end, OrderByComparator orderByComparator)
169                    throws SystemException {
170                    boolean pagination = true;
171                    FinderPath finderPath = null;
172                    Object[] finderArgs = null;
173    
174                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
175                                    (orderByComparator == null)) {
176                            pagination = false;
177                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID;
178                            finderArgs = new Object[] { productEntryId };
179                    }
180                    else {
181                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PRODUCTENTRYID;
182                            finderArgs = new Object[] {
183                                            productEntryId,
184                                            
185                                            start, end, orderByComparator
186                                    };
187                    }
188    
189                    List<SCProductVersion> list = (List<SCProductVersion>)FinderCacheUtil.getResult(finderPath,
190                                    finderArgs, this);
191    
192                    if ((list != null) && !list.isEmpty()) {
193                            for (SCProductVersion scProductVersion : list) {
194                                    if ((productEntryId != scProductVersion.getProductEntryId())) {
195                                            list = null;
196    
197                                            break;
198                                    }
199                            }
200                    }
201    
202                    if (list == null) {
203                            StringBundler query = null;
204    
205                            if (orderByComparator != null) {
206                                    query = new StringBundler(3 +
207                                                    (orderByComparator.getOrderByFields().length * 3));
208                            }
209                            else {
210                                    query = new StringBundler(3);
211                            }
212    
213                            query.append(_SQL_SELECT_SCPRODUCTVERSION_WHERE);
214    
215                            query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
216    
217                            if (orderByComparator != null) {
218                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
219                                            orderByComparator);
220                            }
221                            else
222                             if (pagination) {
223                                    query.append(SCProductVersionModelImpl.ORDER_BY_JPQL);
224                            }
225    
226                            String sql = query.toString();
227    
228                            Session session = null;
229    
230                            try {
231                                    session = openSession();
232    
233                                    Query q = session.createQuery(sql);
234    
235                                    QueryPos qPos = QueryPos.getInstance(q);
236    
237                                    qPos.add(productEntryId);
238    
239                                    if (!pagination) {
240                                            list = (List<SCProductVersion>)QueryUtil.list(q,
241                                                            getDialect(), start, end, false);
242    
243                                            Collections.sort(list);
244    
245                                            list = new UnmodifiableList<SCProductVersion>(list);
246                                    }
247                                    else {
248                                            list = (List<SCProductVersion>)QueryUtil.list(q,
249                                                            getDialect(), start, end);
250                                    }
251    
252                                    cacheResult(list);
253    
254                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
255                            }
256                            catch (Exception e) {
257                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
258    
259                                    throw processException(e);
260                            }
261                            finally {
262                                    closeSession(session);
263                            }
264                    }
265    
266                    return list;
267            }
268    
269            /**
270             * Returns the first s c product version in the ordered set where productEntryId = &#63;.
271             *
272             * @param productEntryId the product entry ID
273             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
274             * @return the first matching s c product version
275             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a matching s c product version could not be found
276             * @throws SystemException if a system exception occurred
277             */
278            @Override
279            public SCProductVersion findByProductEntryId_First(long productEntryId,
280                    OrderByComparator orderByComparator)
281                    throws NoSuchProductVersionException, SystemException {
282                    SCProductVersion scProductVersion = fetchByProductEntryId_First(productEntryId,
283                                    orderByComparator);
284    
285                    if (scProductVersion != null) {
286                            return scProductVersion;
287                    }
288    
289                    StringBundler msg = new StringBundler(4);
290    
291                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
292    
293                    msg.append("productEntryId=");
294                    msg.append(productEntryId);
295    
296                    msg.append(StringPool.CLOSE_CURLY_BRACE);
297    
298                    throw new NoSuchProductVersionException(msg.toString());
299            }
300    
301            /**
302             * Returns the first s c product version in the ordered set where productEntryId = &#63;.
303             *
304             * @param productEntryId the product entry ID
305             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
306             * @return the first matching s c product version, or <code>null</code> if a matching s c product version could not be found
307             * @throws SystemException if a system exception occurred
308             */
309            @Override
310            public SCProductVersion fetchByProductEntryId_First(long productEntryId,
311                    OrderByComparator orderByComparator) throws SystemException {
312                    List<SCProductVersion> list = findByProductEntryId(productEntryId, 0,
313                                    1, orderByComparator);
314    
315                    if (!list.isEmpty()) {
316                            return list.get(0);
317                    }
318    
319                    return null;
320            }
321    
322            /**
323             * Returns the last s c product version in the ordered set where productEntryId = &#63;.
324             *
325             * @param productEntryId the product entry ID
326             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
327             * @return the last matching s c product version
328             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a matching s c product version could not be found
329             * @throws SystemException if a system exception occurred
330             */
331            @Override
332            public SCProductVersion findByProductEntryId_Last(long productEntryId,
333                    OrderByComparator orderByComparator)
334                    throws NoSuchProductVersionException, SystemException {
335                    SCProductVersion scProductVersion = fetchByProductEntryId_Last(productEntryId,
336                                    orderByComparator);
337    
338                    if (scProductVersion != null) {
339                            return scProductVersion;
340                    }
341    
342                    StringBundler msg = new StringBundler(4);
343    
344                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
345    
346                    msg.append("productEntryId=");
347                    msg.append(productEntryId);
348    
349                    msg.append(StringPool.CLOSE_CURLY_BRACE);
350    
351                    throw new NoSuchProductVersionException(msg.toString());
352            }
353    
354            /**
355             * Returns the last s c product version in the ordered set where productEntryId = &#63;.
356             *
357             * @param productEntryId the product entry ID
358             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
359             * @return the last matching s c product version, or <code>null</code> if a matching s c product version could not be found
360             * @throws SystemException if a system exception occurred
361             */
362            @Override
363            public SCProductVersion fetchByProductEntryId_Last(long productEntryId,
364                    OrderByComparator orderByComparator) throws SystemException {
365                    int count = countByProductEntryId(productEntryId);
366    
367                    if (count == 0) {
368                            return null;
369                    }
370    
371                    List<SCProductVersion> list = findByProductEntryId(productEntryId,
372                                    count - 1, count, orderByComparator);
373    
374                    if (!list.isEmpty()) {
375                            return list.get(0);
376                    }
377    
378                    return null;
379            }
380    
381            /**
382             * Returns the s c product versions before and after the current s c product version in the ordered set where productEntryId = &#63;.
383             *
384             * @param productVersionId the primary key of the current s c product version
385             * @param productEntryId the product entry ID
386             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
387             * @return the previous, current, and next s c product version
388             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
389             * @throws SystemException if a system exception occurred
390             */
391            @Override
392            public SCProductVersion[] findByProductEntryId_PrevAndNext(
393                    long productVersionId, long productEntryId,
394                    OrderByComparator orderByComparator)
395                    throws NoSuchProductVersionException, SystemException {
396                    SCProductVersion scProductVersion = findByPrimaryKey(productVersionId);
397    
398                    Session session = null;
399    
400                    try {
401                            session = openSession();
402    
403                            SCProductVersion[] array = new SCProductVersionImpl[3];
404    
405                            array[0] = getByProductEntryId_PrevAndNext(session,
406                                            scProductVersion, productEntryId, orderByComparator, true);
407    
408                            array[1] = scProductVersion;
409    
410                            array[2] = getByProductEntryId_PrevAndNext(session,
411                                            scProductVersion, productEntryId, orderByComparator, false);
412    
413                            return array;
414                    }
415                    catch (Exception e) {
416                            throw processException(e);
417                    }
418                    finally {
419                            closeSession(session);
420                    }
421            }
422    
423            protected SCProductVersion getByProductEntryId_PrevAndNext(
424                    Session session, SCProductVersion scProductVersion,
425                    long productEntryId, OrderByComparator orderByComparator,
426                    boolean previous) {
427                    StringBundler query = null;
428    
429                    if (orderByComparator != null) {
430                            query = new StringBundler(6 +
431                                            (orderByComparator.getOrderByFields().length * 6));
432                    }
433                    else {
434                            query = new StringBundler(3);
435                    }
436    
437                    query.append(_SQL_SELECT_SCPRODUCTVERSION_WHERE);
438    
439                    query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
440    
441                    if (orderByComparator != null) {
442                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
443    
444                            if (orderByConditionFields.length > 0) {
445                                    query.append(WHERE_AND);
446                            }
447    
448                            for (int i = 0; i < orderByConditionFields.length; i++) {
449                                    query.append(_ORDER_BY_ENTITY_ALIAS);
450                                    query.append(orderByConditionFields[i]);
451    
452                                    if ((i + 1) < orderByConditionFields.length) {
453                                            if (orderByComparator.isAscending() ^ previous) {
454                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
455                                            }
456                                            else {
457                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
458                                            }
459                                    }
460                                    else {
461                                            if (orderByComparator.isAscending() ^ previous) {
462                                                    query.append(WHERE_GREATER_THAN);
463                                            }
464                                            else {
465                                                    query.append(WHERE_LESSER_THAN);
466                                            }
467                                    }
468                            }
469    
470                            query.append(ORDER_BY_CLAUSE);
471    
472                            String[] orderByFields = orderByComparator.getOrderByFields();
473    
474                            for (int i = 0; i < orderByFields.length; i++) {
475                                    query.append(_ORDER_BY_ENTITY_ALIAS);
476                                    query.append(orderByFields[i]);
477    
478                                    if ((i + 1) < orderByFields.length) {
479                                            if (orderByComparator.isAscending() ^ previous) {
480                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
481                                            }
482                                            else {
483                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
484                                            }
485                                    }
486                                    else {
487                                            if (orderByComparator.isAscending() ^ previous) {
488                                                    query.append(ORDER_BY_ASC);
489                                            }
490                                            else {
491                                                    query.append(ORDER_BY_DESC);
492                                            }
493                                    }
494                            }
495                    }
496                    else {
497                            query.append(SCProductVersionModelImpl.ORDER_BY_JPQL);
498                    }
499    
500                    String sql = query.toString();
501    
502                    Query q = session.createQuery(sql);
503    
504                    q.setFirstResult(0);
505                    q.setMaxResults(2);
506    
507                    QueryPos qPos = QueryPos.getInstance(q);
508    
509                    qPos.add(productEntryId);
510    
511                    if (orderByComparator != null) {
512                            Object[] values = orderByComparator.getOrderByConditionValues(scProductVersion);
513    
514                            for (Object value : values) {
515                                    qPos.add(value);
516                            }
517                    }
518    
519                    List<SCProductVersion> list = q.list();
520    
521                    if (list.size() == 2) {
522                            return list.get(1);
523                    }
524                    else {
525                            return null;
526                    }
527            }
528    
529            /**
530             * Removes all the s c product versions where productEntryId = &#63; from the database.
531             *
532             * @param productEntryId the product entry ID
533             * @throws SystemException if a system exception occurred
534             */
535            @Override
536            public void removeByProductEntryId(long productEntryId)
537                    throws SystemException {
538                    for (SCProductVersion scProductVersion : findByProductEntryId(
539                                    productEntryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
540                            remove(scProductVersion);
541                    }
542            }
543    
544            /**
545             * Returns the number of s c product versions where productEntryId = &#63;.
546             *
547             * @param productEntryId the product entry ID
548             * @return the number of matching s c product versions
549             * @throws SystemException if a system exception occurred
550             */
551            @Override
552            public int countByProductEntryId(long productEntryId)
553                    throws SystemException {
554                    FinderPath finderPath = FINDER_PATH_COUNT_BY_PRODUCTENTRYID;
555    
556                    Object[] finderArgs = new Object[] { productEntryId };
557    
558                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
559                                    this);
560    
561                    if (count == null) {
562                            StringBundler query = new StringBundler(2);
563    
564                            query.append(_SQL_COUNT_SCPRODUCTVERSION_WHERE);
565    
566                            query.append(_FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2);
567    
568                            String sql = query.toString();
569    
570                            Session session = null;
571    
572                            try {
573                                    session = openSession();
574    
575                                    Query q = session.createQuery(sql);
576    
577                                    QueryPos qPos = QueryPos.getInstance(q);
578    
579                                    qPos.add(productEntryId);
580    
581                                    count = (Long)q.uniqueResult();
582    
583                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
584                            }
585                            catch (Exception e) {
586                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
587    
588                                    throw processException(e);
589                            }
590                            finally {
591                                    closeSession(session);
592                            }
593                    }
594    
595                    return count.intValue();
596            }
597    
598            private static final String _FINDER_COLUMN_PRODUCTENTRYID_PRODUCTENTRYID_2 = "scProductVersion.productEntryId = ?";
599            public static final FinderPath FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
600                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED,
601                            SCProductVersionImpl.class, FINDER_CLASS_NAME_ENTITY,
602                            "fetchByDirectDownloadURL",
603                            new String[] { String.class.getName() },
604                            SCProductVersionModelImpl.DIRECTDOWNLOADURL_COLUMN_BITMASK);
605            public static final FinderPath FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL = new FinderPath(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
606                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED, Long.class,
607                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
608                            "countByDirectDownloadURL", new String[] { String.class.getName() });
609    
610            /**
611             * Returns the s c product version where directDownloadURL = &#63; or throws a {@link com.liferay.portlet.softwarecatalog.NoSuchProductVersionException} if it could not be found.
612             *
613             * @param directDownloadURL the direct download u r l
614             * @return the matching s c product version
615             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a matching s c product version could not be found
616             * @throws SystemException if a system exception occurred
617             */
618            @Override
619            public SCProductVersion findByDirectDownloadURL(String directDownloadURL)
620                    throws NoSuchProductVersionException, SystemException {
621                    SCProductVersion scProductVersion = fetchByDirectDownloadURL(directDownloadURL);
622    
623                    if (scProductVersion == null) {
624                            StringBundler msg = new StringBundler(4);
625    
626                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
627    
628                            msg.append("directDownloadURL=");
629                            msg.append(directDownloadURL);
630    
631                            msg.append(StringPool.CLOSE_CURLY_BRACE);
632    
633                            if (_log.isWarnEnabled()) {
634                                    _log.warn(msg.toString());
635                            }
636    
637                            throw new NoSuchProductVersionException(msg.toString());
638                    }
639    
640                    return scProductVersion;
641            }
642    
643            /**
644             * Returns the s c product version where directDownloadURL = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
645             *
646             * @param directDownloadURL the direct download u r l
647             * @return the matching s c product version, or <code>null</code> if a matching s c product version could not be found
648             * @throws SystemException if a system exception occurred
649             */
650            @Override
651            public SCProductVersion fetchByDirectDownloadURL(String directDownloadURL)
652                    throws SystemException {
653                    return fetchByDirectDownloadURL(directDownloadURL, true);
654            }
655    
656            /**
657             * Returns the s c product version where directDownloadURL = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
658             *
659             * @param directDownloadURL the direct download u r l
660             * @param retrieveFromCache whether to use the finder cache
661             * @return the matching s c product version, or <code>null</code> if a matching s c product version could not be found
662             * @throws SystemException if a system exception occurred
663             */
664            @Override
665            public SCProductVersion fetchByDirectDownloadURL(String directDownloadURL,
666                    boolean retrieveFromCache) throws SystemException {
667                    Object[] finderArgs = new Object[] { directDownloadURL };
668    
669                    Object result = null;
670    
671                    if (retrieveFromCache) {
672                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
673                                            finderArgs, this);
674                    }
675    
676                    if (result instanceof SCProductVersion) {
677                            SCProductVersion scProductVersion = (SCProductVersion)result;
678    
679                            if (!Validator.equals(directDownloadURL,
680                                                    scProductVersion.getDirectDownloadURL())) {
681                                    result = null;
682                            }
683                    }
684    
685                    if (result == null) {
686                            StringBundler query = new StringBundler(3);
687    
688                            query.append(_SQL_SELECT_SCPRODUCTVERSION_WHERE);
689    
690                            boolean bindDirectDownloadURL = false;
691    
692                            if (directDownloadURL == null) {
693                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_1);
694                            }
695                            else if (directDownloadURL.equals(StringPool.BLANK)) {
696                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_3);
697                            }
698                            else {
699                                    bindDirectDownloadURL = true;
700    
701                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_2);
702                            }
703    
704                            String sql = query.toString();
705    
706                            Session session = null;
707    
708                            try {
709                                    session = openSession();
710    
711                                    Query q = session.createQuery(sql);
712    
713                                    QueryPos qPos = QueryPos.getInstance(q);
714    
715                                    if (bindDirectDownloadURL) {
716                                            qPos.add(directDownloadURL.toLowerCase());
717                                    }
718    
719                                    List<SCProductVersion> list = q.list();
720    
721                                    if (list.isEmpty()) {
722                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
723                                                    finderArgs, list);
724                                    }
725                                    else {
726                                            if ((list.size() > 1) && _log.isWarnEnabled()) {
727                                                    _log.warn(
728                                                            "SCProductVersionPersistenceImpl.fetchByDirectDownloadURL(String, boolean) with parameters (" +
729                                                            StringUtil.merge(finderArgs) +
730                                                            ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.");
731                                            }
732    
733                                            SCProductVersion scProductVersion = list.get(0);
734    
735                                            result = scProductVersion;
736    
737                                            cacheResult(scProductVersion);
738    
739                                            if ((scProductVersion.getDirectDownloadURL() == null) ||
740                                                            !scProductVersion.getDirectDownloadURL()
741                                                                                                     .equals(directDownloadURL)) {
742                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
743                                                            finderArgs, scProductVersion);
744                                            }
745                                    }
746                            }
747                            catch (Exception e) {
748                                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
749                                            finderArgs);
750    
751                                    throw processException(e);
752                            }
753                            finally {
754                                    closeSession(session);
755                            }
756                    }
757    
758                    if (result instanceof List<?>) {
759                            return null;
760                    }
761                    else {
762                            return (SCProductVersion)result;
763                    }
764            }
765    
766            /**
767             * Removes the s c product version where directDownloadURL = &#63; from the database.
768             *
769             * @param directDownloadURL the direct download u r l
770             * @return the s c product version that was removed
771             * @throws SystemException if a system exception occurred
772             */
773            @Override
774            public SCProductVersion removeByDirectDownloadURL(String directDownloadURL)
775                    throws NoSuchProductVersionException, SystemException {
776                    SCProductVersion scProductVersion = findByDirectDownloadURL(directDownloadURL);
777    
778                    return remove(scProductVersion);
779            }
780    
781            /**
782             * Returns the number of s c product versions where directDownloadURL = &#63;.
783             *
784             * @param directDownloadURL the direct download u r l
785             * @return the number of matching s c product versions
786             * @throws SystemException if a system exception occurred
787             */
788            @Override
789            public int countByDirectDownloadURL(String directDownloadURL)
790                    throws SystemException {
791                    FinderPath finderPath = FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL;
792    
793                    Object[] finderArgs = new Object[] { directDownloadURL };
794    
795                    Long count = (Long)FinderCacheUtil.getResult(finderPath, finderArgs,
796                                    this);
797    
798                    if (count == null) {
799                            StringBundler query = new StringBundler(2);
800    
801                            query.append(_SQL_COUNT_SCPRODUCTVERSION_WHERE);
802    
803                            boolean bindDirectDownloadURL = false;
804    
805                            if (directDownloadURL == null) {
806                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_1);
807                            }
808                            else if (directDownloadURL.equals(StringPool.BLANK)) {
809                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_3);
810                            }
811                            else {
812                                    bindDirectDownloadURL = true;
813    
814                                    query.append(_FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_2);
815                            }
816    
817                            String sql = query.toString();
818    
819                            Session session = null;
820    
821                            try {
822                                    session = openSession();
823    
824                                    Query q = session.createQuery(sql);
825    
826                                    QueryPos qPos = QueryPos.getInstance(q);
827    
828                                    if (bindDirectDownloadURL) {
829                                            qPos.add(directDownloadURL.toLowerCase());
830                                    }
831    
832                                    count = (Long)q.uniqueResult();
833    
834                                    FinderCacheUtil.putResult(finderPath, finderArgs, count);
835                            }
836                            catch (Exception e) {
837                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
838    
839                                    throw processException(e);
840                            }
841                            finally {
842                                    closeSession(session);
843                            }
844                    }
845    
846                    return count.intValue();
847            }
848    
849            private static final String _FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_1 =
850                    "scProductVersion.directDownloadURL IS NULL";
851            private static final String _FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_2 =
852                    "lower(scProductVersion.directDownloadURL) = ?";
853            private static final String _FINDER_COLUMN_DIRECTDOWNLOADURL_DIRECTDOWNLOADURL_3 =
854                    "(scProductVersion.directDownloadURL IS NULL OR scProductVersion.directDownloadURL = '')";
855    
856            /**
857             * Caches the s c product version in the entity cache if it is enabled.
858             *
859             * @param scProductVersion the s c product version
860             */
861            @Override
862            public void cacheResult(SCProductVersion scProductVersion) {
863                    EntityCacheUtil.putResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
864                            SCProductVersionImpl.class, scProductVersion.getPrimaryKey(),
865                            scProductVersion);
866    
867                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
868                            new Object[] { scProductVersion.getDirectDownloadURL() },
869                            scProductVersion);
870    
871                    scProductVersion.resetOriginalValues();
872            }
873    
874            /**
875             * Caches the s c product versions in the entity cache if it is enabled.
876             *
877             * @param scProductVersions the s c product versions
878             */
879            @Override
880            public void cacheResult(List<SCProductVersion> scProductVersions) {
881                    for (SCProductVersion scProductVersion : scProductVersions) {
882                            if (EntityCacheUtil.getResult(
883                                                    SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
884                                                    SCProductVersionImpl.class,
885                                                    scProductVersion.getPrimaryKey()) == null) {
886                                    cacheResult(scProductVersion);
887                            }
888                            else {
889                                    scProductVersion.resetOriginalValues();
890                            }
891                    }
892            }
893    
894            /**
895             * Clears the cache for all s c product versions.
896             *
897             * <p>
898             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
899             * </p>
900             */
901            @Override
902            public void clearCache() {
903                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
904                            CacheRegistryUtil.clear(SCProductVersionImpl.class.getName());
905                    }
906    
907                    EntityCacheUtil.clearCache(SCProductVersionImpl.class.getName());
908    
909                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
910                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
911                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
912            }
913    
914            /**
915             * Clears the cache for the s c product version.
916             *
917             * <p>
918             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
919             * </p>
920             */
921            @Override
922            public void clearCache(SCProductVersion scProductVersion) {
923                    EntityCacheUtil.removeResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
924                            SCProductVersionImpl.class, scProductVersion.getPrimaryKey());
925    
926                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
927                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
928    
929                    clearUniqueFindersCache(scProductVersion);
930            }
931    
932            @Override
933            public void clearCache(List<SCProductVersion> scProductVersions) {
934                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
935                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
936    
937                    for (SCProductVersion scProductVersion : scProductVersions) {
938                            EntityCacheUtil.removeResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
939                                    SCProductVersionImpl.class, scProductVersion.getPrimaryKey());
940    
941                            clearUniqueFindersCache(scProductVersion);
942                    }
943            }
944    
945            protected void cacheUniqueFindersCache(SCProductVersion scProductVersion) {
946                    if (scProductVersion.isNew()) {
947                            Object[] args = new Object[] { scProductVersion.getDirectDownloadURL() };
948    
949                            FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
950                                    args, Long.valueOf(1));
951                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
952                                    args, scProductVersion);
953                    }
954                    else {
955                            SCProductVersionModelImpl scProductVersionModelImpl = (SCProductVersionModelImpl)scProductVersion;
956    
957                            if ((scProductVersionModelImpl.getColumnBitmask() &
958                                            FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL.getColumnBitmask()) != 0) {
959                                    Object[] args = new Object[] {
960                                                    scProductVersion.getDirectDownloadURL()
961                                            };
962    
963                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
964                                            args, Long.valueOf(1));
965                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
966                                            args, scProductVersion);
967                            }
968                    }
969            }
970    
971            protected void clearUniqueFindersCache(SCProductVersion scProductVersion) {
972                    SCProductVersionModelImpl scProductVersionModelImpl = (SCProductVersionModelImpl)scProductVersion;
973    
974                    Object[] args = new Object[] { scProductVersion.getDirectDownloadURL() };
975    
976                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
977                            args);
978                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
979                            args);
980    
981                    if ((scProductVersionModelImpl.getColumnBitmask() &
982                                    FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL.getColumnBitmask()) != 0) {
983                            args = new Object[] {
984                                            scProductVersionModelImpl.getOriginalDirectDownloadURL()
985                                    };
986    
987                            FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DIRECTDOWNLOADURL,
988                                    args);
989                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_DIRECTDOWNLOADURL,
990                                    args);
991                    }
992            }
993    
994            /**
995             * Creates a new s c product version with the primary key. Does not add the s c product version to the database.
996             *
997             * @param productVersionId the primary key for the new s c product version
998             * @return the new s c product version
999             */
1000            @Override
1001            public SCProductVersion create(long productVersionId) {
1002                    SCProductVersion scProductVersion = new SCProductVersionImpl();
1003    
1004                    scProductVersion.setNew(true);
1005                    scProductVersion.setPrimaryKey(productVersionId);
1006    
1007                    return scProductVersion;
1008            }
1009    
1010            /**
1011             * Removes the s c product version with the primary key from the database. Also notifies the appropriate model listeners.
1012             *
1013             * @param productVersionId the primary key of the s c product version
1014             * @return the s c product version that was removed
1015             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
1016             * @throws SystemException if a system exception occurred
1017             */
1018            @Override
1019            public SCProductVersion remove(long productVersionId)
1020                    throws NoSuchProductVersionException, SystemException {
1021                    return remove((Serializable)productVersionId);
1022            }
1023    
1024            /**
1025             * Removes the s c product version with the primary key from the database. Also notifies the appropriate model listeners.
1026             *
1027             * @param primaryKey the primary key of the s c product version
1028             * @return the s c product version that was removed
1029             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
1030             * @throws SystemException if a system exception occurred
1031             */
1032            @Override
1033            public SCProductVersion remove(Serializable primaryKey)
1034                    throws NoSuchProductVersionException, SystemException {
1035                    Session session = null;
1036    
1037                    try {
1038                            session = openSession();
1039    
1040                            SCProductVersion scProductVersion = (SCProductVersion)session.get(SCProductVersionImpl.class,
1041                                            primaryKey);
1042    
1043                            if (scProductVersion == null) {
1044                                    if (_log.isWarnEnabled()) {
1045                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1046                                    }
1047    
1048                                    throw new NoSuchProductVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1049                                            primaryKey);
1050                            }
1051    
1052                            return remove(scProductVersion);
1053                    }
1054                    catch (NoSuchProductVersionException nsee) {
1055                            throw nsee;
1056                    }
1057                    catch (Exception e) {
1058                            throw processException(e);
1059                    }
1060                    finally {
1061                            closeSession(session);
1062                    }
1063            }
1064    
1065            @Override
1066            protected SCProductVersion removeImpl(SCProductVersion scProductVersion)
1067                    throws SystemException {
1068                    scProductVersion = toUnwrappedModel(scProductVersion);
1069    
1070                    try {
1071                            clearSCFrameworkVersions.clear(scProductVersion.getPrimaryKey());
1072                    }
1073                    catch (Exception e) {
1074                            throw processException(e);
1075                    }
1076                    finally {
1077                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1078                    }
1079    
1080                    Session session = null;
1081    
1082                    try {
1083                            session = openSession();
1084    
1085                            if (!session.contains(scProductVersion)) {
1086                                    scProductVersion = (SCProductVersion)session.get(SCProductVersionImpl.class,
1087                                                    scProductVersion.getPrimaryKeyObj());
1088                            }
1089    
1090                            if (scProductVersion != null) {
1091                                    session.delete(scProductVersion);
1092                            }
1093                    }
1094                    catch (Exception e) {
1095                            throw processException(e);
1096                    }
1097                    finally {
1098                            closeSession(session);
1099                    }
1100    
1101                    if (scProductVersion != null) {
1102                            clearCache(scProductVersion);
1103                    }
1104    
1105                    return scProductVersion;
1106            }
1107    
1108            @Override
1109            public SCProductVersion updateImpl(
1110                    com.liferay.portlet.softwarecatalog.model.SCProductVersion scProductVersion)
1111                    throws SystemException {
1112                    scProductVersion = toUnwrappedModel(scProductVersion);
1113    
1114                    boolean isNew = scProductVersion.isNew();
1115    
1116                    SCProductVersionModelImpl scProductVersionModelImpl = (SCProductVersionModelImpl)scProductVersion;
1117    
1118                    Session session = null;
1119    
1120                    try {
1121                            session = openSession();
1122    
1123                            if (scProductVersion.isNew()) {
1124                                    session.save(scProductVersion);
1125    
1126                                    scProductVersion.setNew(false);
1127                            }
1128                            else {
1129                                    session.merge(scProductVersion);
1130                            }
1131                    }
1132                    catch (Exception e) {
1133                            throw processException(e);
1134                    }
1135                    finally {
1136                            closeSession(session);
1137                    }
1138    
1139                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
1140    
1141                    if (isNew || !SCProductVersionModelImpl.COLUMN_BITMASK_ENABLED) {
1142                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1143                    }
1144    
1145                    else {
1146                            if ((scProductVersionModelImpl.getColumnBitmask() &
1147                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID.getColumnBitmask()) != 0) {
1148                                    Object[] args = new Object[] {
1149                                                    scProductVersionModelImpl.getOriginalProductEntryId()
1150                                            };
1151    
1152                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1153                                            args);
1154                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID,
1155                                            args);
1156    
1157                                    args = new Object[] {
1158                                                    scProductVersionModelImpl.getProductEntryId()
1159                                            };
1160    
1161                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PRODUCTENTRYID,
1162                                            args);
1163                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PRODUCTENTRYID,
1164                                            args);
1165                            }
1166                    }
1167    
1168                    EntityCacheUtil.putResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1169                            SCProductVersionImpl.class, scProductVersion.getPrimaryKey(),
1170                            scProductVersion);
1171    
1172                    clearUniqueFindersCache(scProductVersion);
1173                    cacheUniqueFindersCache(scProductVersion);
1174    
1175                    return scProductVersion;
1176            }
1177    
1178            protected SCProductVersion toUnwrappedModel(
1179                    SCProductVersion scProductVersion) {
1180                    if (scProductVersion instanceof SCProductVersionImpl) {
1181                            return scProductVersion;
1182                    }
1183    
1184                    SCProductVersionImpl scProductVersionImpl = new SCProductVersionImpl();
1185    
1186                    scProductVersionImpl.setNew(scProductVersion.isNew());
1187                    scProductVersionImpl.setPrimaryKey(scProductVersion.getPrimaryKey());
1188    
1189                    scProductVersionImpl.setProductVersionId(scProductVersion.getProductVersionId());
1190                    scProductVersionImpl.setCompanyId(scProductVersion.getCompanyId());
1191                    scProductVersionImpl.setUserId(scProductVersion.getUserId());
1192                    scProductVersionImpl.setUserName(scProductVersion.getUserName());
1193                    scProductVersionImpl.setCreateDate(scProductVersion.getCreateDate());
1194                    scProductVersionImpl.setModifiedDate(scProductVersion.getModifiedDate());
1195                    scProductVersionImpl.setProductEntryId(scProductVersion.getProductEntryId());
1196                    scProductVersionImpl.setVersion(scProductVersion.getVersion());
1197                    scProductVersionImpl.setChangeLog(scProductVersion.getChangeLog());
1198                    scProductVersionImpl.setDownloadPageURL(scProductVersion.getDownloadPageURL());
1199                    scProductVersionImpl.setDirectDownloadURL(scProductVersion.getDirectDownloadURL());
1200                    scProductVersionImpl.setRepoStoreArtifact(scProductVersion.isRepoStoreArtifact());
1201    
1202                    return scProductVersionImpl;
1203            }
1204    
1205            /**
1206             * Returns the s c product version with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
1207             *
1208             * @param primaryKey the primary key of the s c product version
1209             * @return the s c product version
1210             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
1211             * @throws SystemException if a system exception occurred
1212             */
1213            @Override
1214            public SCProductVersion findByPrimaryKey(Serializable primaryKey)
1215                    throws NoSuchProductVersionException, SystemException {
1216                    SCProductVersion scProductVersion = fetchByPrimaryKey(primaryKey);
1217    
1218                    if (scProductVersion == null) {
1219                            if (_log.isWarnEnabled()) {
1220                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
1221                            }
1222    
1223                            throw new NoSuchProductVersionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
1224                                    primaryKey);
1225                    }
1226    
1227                    return scProductVersion;
1228            }
1229    
1230            /**
1231             * Returns the s c product version with the primary key or throws a {@link com.liferay.portlet.softwarecatalog.NoSuchProductVersionException} if it could not be found.
1232             *
1233             * @param productVersionId the primary key of the s c product version
1234             * @return the s c product version
1235             * @throws com.liferay.portlet.softwarecatalog.NoSuchProductVersionException if a s c product version with the primary key could not be found
1236             * @throws SystemException if a system exception occurred
1237             */
1238            @Override
1239            public SCProductVersion findByPrimaryKey(long productVersionId)
1240                    throws NoSuchProductVersionException, SystemException {
1241                    return findByPrimaryKey((Serializable)productVersionId);
1242            }
1243    
1244            /**
1245             * Returns the s c product version with the primary key or returns <code>null</code> if it could not be found.
1246             *
1247             * @param primaryKey the primary key of the s c product version
1248             * @return the s c product version, or <code>null</code> if a s c product version with the primary key could not be found
1249             * @throws SystemException if a system exception occurred
1250             */
1251            @Override
1252            public SCProductVersion fetchByPrimaryKey(Serializable primaryKey)
1253                    throws SystemException {
1254                    SCProductVersion scProductVersion = (SCProductVersion)EntityCacheUtil.getResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1255                                    SCProductVersionImpl.class, primaryKey);
1256    
1257                    if (scProductVersion == _nullSCProductVersion) {
1258                            return null;
1259                    }
1260    
1261                    if (scProductVersion == null) {
1262                            Session session = null;
1263    
1264                            try {
1265                                    session = openSession();
1266    
1267                                    scProductVersion = (SCProductVersion)session.get(SCProductVersionImpl.class,
1268                                                    primaryKey);
1269    
1270                                    if (scProductVersion != null) {
1271                                            cacheResult(scProductVersion);
1272                                    }
1273                                    else {
1274                                            EntityCacheUtil.putResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1275                                                    SCProductVersionImpl.class, primaryKey,
1276                                                    _nullSCProductVersion);
1277                                    }
1278                            }
1279                            catch (Exception e) {
1280                                    EntityCacheUtil.removeResult(SCProductVersionModelImpl.ENTITY_CACHE_ENABLED,
1281                                            SCProductVersionImpl.class, primaryKey);
1282    
1283                                    throw processException(e);
1284                            }
1285                            finally {
1286                                    closeSession(session);
1287                            }
1288                    }
1289    
1290                    return scProductVersion;
1291            }
1292    
1293            /**
1294             * Returns the s c product version with the primary key or returns <code>null</code> if it could not be found.
1295             *
1296             * @param productVersionId the primary key of the s c product version
1297             * @return the s c product version, or <code>null</code> if a s c product version with the primary key could not be found
1298             * @throws SystemException if a system exception occurred
1299             */
1300            @Override
1301            public SCProductVersion fetchByPrimaryKey(long productVersionId)
1302                    throws SystemException {
1303                    return fetchByPrimaryKey((Serializable)productVersionId);
1304            }
1305    
1306            /**
1307             * Returns all the s c product versions.
1308             *
1309             * @return the s c product versions
1310             * @throws SystemException if a system exception occurred
1311             */
1312            @Override
1313            public List<SCProductVersion> findAll() throws SystemException {
1314                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1315            }
1316    
1317            /**
1318             * Returns a range of all the s c product versions.
1319             *
1320             * <p>
1321             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1322             * </p>
1323             *
1324             * @param start the lower bound of the range of s c product versions
1325             * @param end the upper bound of the range of s c product versions (not inclusive)
1326             * @return the range of s c product versions
1327             * @throws SystemException if a system exception occurred
1328             */
1329            @Override
1330            public List<SCProductVersion> findAll(int start, int end)
1331                    throws SystemException {
1332                    return findAll(start, end, null);
1333            }
1334    
1335            /**
1336             * Returns an ordered range of all the s c product versions.
1337             *
1338             * <p>
1339             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1340             * </p>
1341             *
1342             * @param start the lower bound of the range of s c product versions
1343             * @param end the upper bound of the range of s c product versions (not inclusive)
1344             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1345             * @return the ordered range of s c product versions
1346             * @throws SystemException if a system exception occurred
1347             */
1348            @Override
1349            public List<SCProductVersion> findAll(int start, int end,
1350                    OrderByComparator orderByComparator) throws SystemException {
1351                    boolean pagination = true;
1352                    FinderPath finderPath = null;
1353                    Object[] finderArgs = null;
1354    
1355                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1356                                    (orderByComparator == null)) {
1357                            pagination = false;
1358                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1359                            finderArgs = FINDER_ARGS_EMPTY;
1360                    }
1361                    else {
1362                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1363                            finderArgs = new Object[] { start, end, orderByComparator };
1364                    }
1365    
1366                    List<SCProductVersion> list = (List<SCProductVersion>)FinderCacheUtil.getResult(finderPath,
1367                                    finderArgs, this);
1368    
1369                    if (list == null) {
1370                            StringBundler query = null;
1371                            String sql = null;
1372    
1373                            if (orderByComparator != null) {
1374                                    query = new StringBundler(2 +
1375                                                    (orderByComparator.getOrderByFields().length * 3));
1376    
1377                                    query.append(_SQL_SELECT_SCPRODUCTVERSION);
1378    
1379                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1380                                            orderByComparator);
1381    
1382                                    sql = query.toString();
1383                            }
1384                            else {
1385                                    sql = _SQL_SELECT_SCPRODUCTVERSION;
1386    
1387                                    if (pagination) {
1388                                            sql = sql.concat(SCProductVersionModelImpl.ORDER_BY_JPQL);
1389                                    }
1390                            }
1391    
1392                            Session session = null;
1393    
1394                            try {
1395                                    session = openSession();
1396    
1397                                    Query q = session.createQuery(sql);
1398    
1399                                    if (!pagination) {
1400                                            list = (List<SCProductVersion>)QueryUtil.list(q,
1401                                                            getDialect(), start, end, false);
1402    
1403                                            Collections.sort(list);
1404    
1405                                            list = new UnmodifiableList<SCProductVersion>(list);
1406                                    }
1407                                    else {
1408                                            list = (List<SCProductVersion>)QueryUtil.list(q,
1409                                                            getDialect(), start, end);
1410                                    }
1411    
1412                                    cacheResult(list);
1413    
1414                                    FinderCacheUtil.putResult(finderPath, finderArgs, list);
1415                            }
1416                            catch (Exception e) {
1417                                    FinderCacheUtil.removeResult(finderPath, finderArgs);
1418    
1419                                    throw processException(e);
1420                            }
1421                            finally {
1422                                    closeSession(session);
1423                            }
1424                    }
1425    
1426                    return list;
1427            }
1428    
1429            /**
1430             * Removes all the s c product versions from the database.
1431             *
1432             * @throws SystemException if a system exception occurred
1433             */
1434            @Override
1435            public void removeAll() throws SystemException {
1436                    for (SCProductVersion scProductVersion : findAll()) {
1437                            remove(scProductVersion);
1438                    }
1439            }
1440    
1441            /**
1442             * Returns the number of s c product versions.
1443             *
1444             * @return the number of s c product versions
1445             * @throws SystemException if a system exception occurred
1446             */
1447            @Override
1448            public int countAll() throws SystemException {
1449                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1450                                    FINDER_ARGS_EMPTY, this);
1451    
1452                    if (count == null) {
1453                            Session session = null;
1454    
1455                            try {
1456                                    session = openSession();
1457    
1458                                    Query q = session.createQuery(_SQL_COUNT_SCPRODUCTVERSION);
1459    
1460                                    count = (Long)q.uniqueResult();
1461    
1462                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1463                                            FINDER_ARGS_EMPTY, count);
1464                            }
1465                            catch (Exception e) {
1466                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_ALL,
1467                                            FINDER_ARGS_EMPTY);
1468    
1469                                    throw processException(e);
1470                            }
1471                            finally {
1472                                    closeSession(session);
1473                            }
1474                    }
1475    
1476                    return count.intValue();
1477            }
1478    
1479            /**
1480             * Returns all the s c framework versions associated with the s c product version.
1481             *
1482             * @param pk the primary key of the s c product version
1483             * @return the s c framework versions associated with the s c product version
1484             * @throws SystemException if a system exception occurred
1485             */
1486            @Override
1487            public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
1488                    long pk) throws SystemException {
1489                    return getSCFrameworkVersions(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1490            }
1491    
1492            /**
1493             * Returns a range of all the s c framework versions associated with the s c product version.
1494             *
1495             * <p>
1496             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1497             * </p>
1498             *
1499             * @param pk the primary key of the s c product version
1500             * @param start the lower bound of the range of s c product versions
1501             * @param end the upper bound of the range of s c product versions (not inclusive)
1502             * @return the range of s c framework versions associated with the s c product version
1503             * @throws SystemException if a system exception occurred
1504             */
1505            @Override
1506            public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
1507                    long pk, int start, int end) throws SystemException {
1508                    return getSCFrameworkVersions(pk, start, end, null);
1509            }
1510    
1511            public static final FinderPath FINDER_PATH_GET_SCFRAMEWORKVERSIONS = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
1512                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
1513                            com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl.class,
1514                            SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
1515                            "getSCFrameworkVersions",
1516                            new String[] {
1517                                    Long.class.getName(), Integer.class.getName(),
1518                                    Integer.class.getName(), OrderByComparator.class.getName()
1519                            });
1520    
1521            static {
1522                    FINDER_PATH_GET_SCFRAMEWORKVERSIONS.setCacheKeyGeneratorCacheName(null);
1523            }
1524    
1525            /**
1526             * Returns an ordered range of all the s c framework versions associated with the s c product version.
1527             *
1528             * <p>
1529             * 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. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.softwarecatalog.model.impl.SCProductVersionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
1530             * </p>
1531             *
1532             * @param pk the primary key of the s c product version
1533             * @param start the lower bound of the range of s c product versions
1534             * @param end the upper bound of the range of s c product versions (not inclusive)
1535             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1536             * @return the ordered range of s c framework versions associated with the s c product version
1537             * @throws SystemException if a system exception occurred
1538             */
1539            @Override
1540            public List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getSCFrameworkVersions(
1541                    long pk, int start, int end, OrderByComparator orderByComparator)
1542                    throws SystemException {
1543                    boolean pagination = true;
1544                    Object[] finderArgs = null;
1545    
1546                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1547                                    (orderByComparator == null)) {
1548                            pagination = false;
1549                            finderArgs = new Object[] { pk };
1550                    }
1551                    else {
1552                            finderArgs = new Object[] { pk, start, end, orderByComparator };
1553                    }
1554    
1555                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> list = (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS,
1556                                    finderArgs, this);
1557    
1558                    if (list == null) {
1559                            Session session = null;
1560    
1561                            try {
1562                                    session = openSession();
1563    
1564                                    String sql = null;
1565    
1566                                    if (orderByComparator != null) {
1567                                            sql = _SQL_GETSCFRAMEWORKVERSIONS.concat(ORDER_BY_CLAUSE)
1568                                                                                                             .concat(orderByComparator.getOrderBy());
1569                                    }
1570                                    else {
1571                                            sql = _SQL_GETSCFRAMEWORKVERSIONS;
1572    
1573                                            if (pagination) {
1574                                                    sql = sql.concat(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ORDER_BY_SQL);
1575                                            }
1576                                    }
1577    
1578                                    SQLQuery q = session.createSQLQuery(sql);
1579    
1580                                    q.addEntity("SCFrameworkVersion",
1581                                            com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionImpl.class);
1582    
1583                                    QueryPos qPos = QueryPos.getInstance(q);
1584    
1585                                    qPos.add(pk);
1586    
1587                                    if (!pagination) {
1588                                            list = (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)QueryUtil.list(q,
1589                                                            getDialect(), start, end, false);
1590    
1591                                            Collections.sort(list);
1592    
1593                                            list = new UnmodifiableList<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>(list);
1594                                    }
1595                                    else {
1596                                            list = (List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)QueryUtil.list(q,
1597                                                            getDialect(), start, end);
1598                                    }
1599    
1600                                    scFrameworkVersionPersistence.cacheResult(list);
1601    
1602                                    FinderCacheUtil.putResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS,
1603                                            finderArgs, list);
1604                            }
1605                            catch (Exception e) {
1606                                    FinderCacheUtil.removeResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS,
1607                                            finderArgs);
1608    
1609                                    throw processException(e);
1610                            }
1611                            finally {
1612                                    closeSession(session);
1613                            }
1614                    }
1615    
1616                    return list;
1617            }
1618    
1619            public static final FinderPath FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
1620                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
1621                            Long.class,
1622                            SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
1623                            "getSCFrameworkVersionsSize", new String[] { Long.class.getName() });
1624    
1625            static {
1626                    FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE.setCacheKeyGeneratorCacheName(null);
1627            }
1628    
1629            /**
1630             * Returns the number of s c framework versions associated with the s c product version.
1631             *
1632             * @param pk the primary key of the s c product version
1633             * @return the number of s c framework versions associated with the s c product version
1634             * @throws SystemException if a system exception occurred
1635             */
1636            @Override
1637            public int getSCFrameworkVersionsSize(long pk) throws SystemException {
1638                    Object[] finderArgs = new Object[] { pk };
1639    
1640                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE,
1641                                    finderArgs, this);
1642    
1643                    if (count == null) {
1644                            Session session = null;
1645    
1646                            try {
1647                                    session = openSession();
1648    
1649                                    SQLQuery q = session.createSQLQuery(_SQL_GETSCFRAMEWORKVERSIONSSIZE);
1650    
1651                                    q.addScalar(COUNT_COLUMN_NAME,
1652                                            com.liferay.portal.kernel.dao.orm.Type.LONG);
1653    
1654                                    QueryPos qPos = QueryPos.getInstance(q);
1655    
1656                                    qPos.add(pk);
1657    
1658                                    count = (Long)q.uniqueResult();
1659    
1660                                    FinderCacheUtil.putResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE,
1661                                            finderArgs, count);
1662                            }
1663                            catch (Exception e) {
1664                                    FinderCacheUtil.removeResult(FINDER_PATH_GET_SCFRAMEWORKVERSIONS_SIZE,
1665                                            finderArgs);
1666    
1667                                    throw processException(e);
1668                            }
1669                            finally {
1670                                    closeSession(session);
1671                            }
1672                    }
1673    
1674                    return count.intValue();
1675            }
1676    
1677            public static final FinderPath FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCFrameworkVersionModelImpl.ENTITY_CACHE_ENABLED,
1678                            SCProductVersionModelImpl.FINDER_CACHE_ENABLED_SCFRAMEWORKVERSI_SCPRODUCTVERS,
1679                            Boolean.class,
1680                            SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME,
1681                            "containsSCFrameworkVersion",
1682                            new String[] { Long.class.getName(), Long.class.getName() });
1683    
1684            /**
1685             * Returns <code>true</code> if the s c framework version is associated with the s c product version.
1686             *
1687             * @param pk the primary key of the s c product version
1688             * @param scFrameworkVersionPK the primary key of the s c framework version
1689             * @return <code>true</code> if the s c framework version is associated with the s c product version; <code>false</code> otherwise
1690             * @throws SystemException if a system exception occurred
1691             */
1692            @Override
1693            public boolean containsSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1694                    throws SystemException {
1695                    Object[] finderArgs = new Object[] { pk, scFrameworkVersionPK };
1696    
1697                    Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION,
1698                                    finderArgs, this);
1699    
1700                    if (value == null) {
1701                            try {
1702                                    value = Boolean.valueOf(containsSCFrameworkVersion.contains(
1703                                                            pk, scFrameworkVersionPK));
1704    
1705                                    FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION,
1706                                            finderArgs, value);
1707                            }
1708                            catch (Exception e) {
1709                                    FinderCacheUtil.removeResult(FINDER_PATH_CONTAINS_SCFRAMEWORKVERSION,
1710                                            finderArgs);
1711    
1712                                    throw processException(e);
1713                            }
1714                    }
1715    
1716                    return value.booleanValue();
1717            }
1718    
1719            /**
1720             * Returns <code>true</code> if the s c product version has any s c framework versions associated with it.
1721             *
1722             * @param pk the primary key of the s c product version to check for associations with s c framework versions
1723             * @return <code>true</code> if the s c product version has any s c framework versions associated with it; <code>false</code> otherwise
1724             * @throws SystemException if a system exception occurred
1725             */
1726            @Override
1727            public boolean containsSCFrameworkVersions(long pk)
1728                    throws SystemException {
1729                    if (getSCFrameworkVersionsSize(pk) > 0) {
1730                            return true;
1731                    }
1732                    else {
1733                            return false;
1734                    }
1735            }
1736    
1737            /**
1738             * Adds an association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1739             *
1740             * @param pk the primary key of the s c product version
1741             * @param scFrameworkVersionPK the primary key of the s c framework version
1742             * @throws SystemException if a system exception occurred
1743             */
1744            @Override
1745            public void addSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1746                    throws SystemException {
1747                    try {
1748                            addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1749                    }
1750                    catch (Exception e) {
1751                            throw processException(e);
1752                    }
1753                    finally {
1754                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1755                    }
1756            }
1757    
1758            /**
1759             * Adds an association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1760             *
1761             * @param pk the primary key of the s c product version
1762             * @param scFrameworkVersion the s c framework version
1763             * @throws SystemException if a system exception occurred
1764             */
1765            @Override
1766            public void addSCFrameworkVersion(long pk,
1767                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
1768                    throws SystemException {
1769                    try {
1770                            addSCFrameworkVersion.add(pk, scFrameworkVersion.getPrimaryKey());
1771                    }
1772                    catch (Exception e) {
1773                            throw processException(e);
1774                    }
1775                    finally {
1776                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1777                    }
1778            }
1779    
1780            /**
1781             * Adds an association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1782             *
1783             * @param pk the primary key of the s c product version
1784             * @param scFrameworkVersionPKs the primary keys of the s c framework versions
1785             * @throws SystemException if a system exception occurred
1786             */
1787            @Override
1788            public void addSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1789                    throws SystemException {
1790                    try {
1791                            for (long scFrameworkVersionPK : scFrameworkVersionPKs) {
1792                                    addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1793                            }
1794                    }
1795                    catch (Exception e) {
1796                            throw processException(e);
1797                    }
1798                    finally {
1799                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1800                    }
1801            }
1802    
1803            /**
1804             * Adds an association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1805             *
1806             * @param pk the primary key of the s c product version
1807             * @param scFrameworkVersions the s c framework versions
1808             * @throws SystemException if a system exception occurred
1809             */
1810            @Override
1811            public void addSCFrameworkVersions(long pk,
1812                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1813                    throws SystemException {
1814                    try {
1815                            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1816                                    addSCFrameworkVersion.add(pk, scFrameworkVersion.getPrimaryKey());
1817                            }
1818                    }
1819                    catch (Exception e) {
1820                            throw processException(e);
1821                    }
1822                    finally {
1823                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1824                    }
1825            }
1826    
1827            /**
1828             * Clears all associations between the s c product version and its s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1829             *
1830             * @param pk the primary key of the s c product version to clear the associated s c framework versions from
1831             * @throws SystemException if a system exception occurred
1832             */
1833            @Override
1834            public void clearSCFrameworkVersions(long pk) throws SystemException {
1835                    try {
1836                            clearSCFrameworkVersions.clear(pk);
1837                    }
1838                    catch (Exception e) {
1839                            throw processException(e);
1840                    }
1841                    finally {
1842                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1843                    }
1844            }
1845    
1846            /**
1847             * Removes the association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1848             *
1849             * @param pk the primary key of the s c product version
1850             * @param scFrameworkVersionPK the primary key of the s c framework version
1851             * @throws SystemException if a system exception occurred
1852             */
1853            @Override
1854            public void removeSCFrameworkVersion(long pk, long scFrameworkVersionPK)
1855                    throws SystemException {
1856                    try {
1857                            removeSCFrameworkVersion.remove(pk, scFrameworkVersionPK);
1858                    }
1859                    catch (Exception e) {
1860                            throw processException(e);
1861                    }
1862                    finally {
1863                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1864                    }
1865            }
1866    
1867            /**
1868             * Removes the association between the s c product version and the s c framework version. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1869             *
1870             * @param pk the primary key of the s c product version
1871             * @param scFrameworkVersion the s c framework version
1872             * @throws SystemException if a system exception occurred
1873             */
1874            @Override
1875            public void removeSCFrameworkVersion(long pk,
1876                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion)
1877                    throws SystemException {
1878                    try {
1879                            removeSCFrameworkVersion.remove(pk,
1880                                    scFrameworkVersion.getPrimaryKey());
1881                    }
1882                    catch (Exception e) {
1883                            throw processException(e);
1884                    }
1885                    finally {
1886                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1887                    }
1888            }
1889    
1890            /**
1891             * Removes the association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1892             *
1893             * @param pk the primary key of the s c product version
1894             * @param scFrameworkVersionPKs the primary keys of the s c framework versions
1895             * @throws SystemException if a system exception occurred
1896             */
1897            @Override
1898            public void removeSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1899                    throws SystemException {
1900                    try {
1901                            for (long scFrameworkVersionPK : scFrameworkVersionPKs) {
1902                                    removeSCFrameworkVersion.remove(pk, scFrameworkVersionPK);
1903                            }
1904                    }
1905                    catch (Exception e) {
1906                            throw processException(e);
1907                    }
1908                    finally {
1909                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1910                    }
1911            }
1912    
1913            /**
1914             * Removes the association between the s c product version and the s c framework versions. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1915             *
1916             * @param pk the primary key of the s c product version
1917             * @param scFrameworkVersions the s c framework versions
1918             * @throws SystemException if a system exception occurred
1919             */
1920            @Override
1921            public void removeSCFrameworkVersions(long pk,
1922                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1923                    throws SystemException {
1924                    try {
1925                            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1926                                    removeSCFrameworkVersion.remove(pk,
1927                                            scFrameworkVersion.getPrimaryKey());
1928                            }
1929                    }
1930                    catch (Exception e) {
1931                            throw processException(e);
1932                    }
1933                    finally {
1934                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1935                    }
1936            }
1937    
1938            /**
1939             * Sets the s c framework versions associated with the s c product version, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1940             *
1941             * @param pk the primary key of the s c product version
1942             * @param scFrameworkVersionPKs the primary keys of the s c framework versions to be associated with the s c product version
1943             * @throws SystemException if a system exception occurred
1944             */
1945            @Override
1946            public void setSCFrameworkVersions(long pk, long[] scFrameworkVersionPKs)
1947                    throws SystemException {
1948                    try {
1949                            Set<Long> scFrameworkVersionPKSet = SetUtil.fromArray(scFrameworkVersionPKs);
1950    
1951                            List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions =
1952                                    getSCFrameworkVersions(pk);
1953    
1954                            for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
1955                                    if (!scFrameworkVersionPKSet.remove(
1956                                                            scFrameworkVersion.getPrimaryKey())) {
1957                                            removeSCFrameworkVersion.remove(pk,
1958                                                    scFrameworkVersion.getPrimaryKey());
1959                                    }
1960                            }
1961    
1962                            for (Long scFrameworkVersionPK : scFrameworkVersionPKSet) {
1963                                    addSCFrameworkVersion.add(pk, scFrameworkVersionPK);
1964                            }
1965                    }
1966                    catch (Exception e) {
1967                            throw processException(e);
1968                    }
1969                    finally {
1970                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
1971                    }
1972            }
1973    
1974            /**
1975             * Sets the s c framework versions associated with the s c product version, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
1976             *
1977             * @param pk the primary key of the s c product version
1978             * @param scFrameworkVersions the s c framework versions to be associated with the s c product version
1979             * @throws SystemException if a system exception occurred
1980             */
1981            @Override
1982            public void setSCFrameworkVersions(long pk,
1983                    List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions)
1984                    throws SystemException {
1985                    try {
1986                            long[] scFrameworkVersionPKs = new long[scFrameworkVersions.size()];
1987    
1988                            for (int i = 0; i < scFrameworkVersions.size(); i++) {
1989                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion =
1990                                            scFrameworkVersions.get(i);
1991    
1992                                    scFrameworkVersionPKs[i] = scFrameworkVersion.getPrimaryKey();
1993                            }
1994    
1995                            setSCFrameworkVersions(pk, scFrameworkVersionPKs);
1996                    }
1997                    catch (Exception e) {
1998                            throw processException(e);
1999                    }
2000                    finally {
2001                            FinderCacheUtil.clearCache(SCProductVersionModelImpl.MAPPING_TABLE_SCFRAMEWORKVERSI_SCPRODUCTVERS_NAME);
2002                    }
2003            }
2004    
2005            /**
2006             * Initializes the s c product version persistence.
2007             */
2008            public void afterPropertiesSet() {
2009                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2010                                            com.liferay.portal.util.PropsUtil.get(
2011                                                    "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductVersion")));
2012    
2013                    if (listenerClassNames.length > 0) {
2014                            try {
2015                                    List<ModelListener<SCProductVersion>> listenersList = new ArrayList<ModelListener<SCProductVersion>>();
2016    
2017                                    for (String listenerClassName : listenerClassNames) {
2018                                            listenersList.add((ModelListener<SCProductVersion>)InstanceFactory.newInstance(
2019                                                            getClassLoader(), listenerClassName));
2020                                    }
2021    
2022                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2023                            }
2024                            catch (Exception e) {
2025                                    _log.error(e);
2026                            }
2027                    }
2028    
2029                    containsSCFrameworkVersion = new ContainsSCFrameworkVersion();
2030    
2031                    addSCFrameworkVersion = new AddSCFrameworkVersion();
2032                    clearSCFrameworkVersions = new ClearSCFrameworkVersions();
2033                    removeSCFrameworkVersion = new RemoveSCFrameworkVersion();
2034            }
2035    
2036            public void destroy() {
2037                    EntityCacheUtil.removeCache(SCProductVersionImpl.class.getName());
2038                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2039                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
2040                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2041            }
2042    
2043            @BeanReference(type = SCFrameworkVersionPersistence.class)
2044            protected SCFrameworkVersionPersistence scFrameworkVersionPersistence;
2045            protected ContainsSCFrameworkVersion containsSCFrameworkVersion;
2046            protected AddSCFrameworkVersion addSCFrameworkVersion;
2047            protected ClearSCFrameworkVersions clearSCFrameworkVersions;
2048            protected RemoveSCFrameworkVersion removeSCFrameworkVersion;
2049    
2050            protected class ContainsSCFrameworkVersion {
2051                    protected ContainsSCFrameworkVersion() {
2052                            _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2053                                            "SELECT 1 FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ? AND frameworkVersionId = ?",
2054                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
2055                                            RowMapper.COUNT);
2056                    }
2057    
2058                    protected boolean contains(long productVersionId,
2059                            long frameworkVersionId) {
2060                            List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2061                                                    new Long(productVersionId), new Long(frameworkVersionId)
2062                                            });
2063    
2064                            if (results.isEmpty()) {
2065                                    return false;
2066                            }
2067    
2068                            return true;
2069                    }
2070    
2071                    private MappingSqlQuery<Integer> _mappingSqlQuery;
2072            }
2073    
2074            protected class AddSCFrameworkVersion {
2075                    protected AddSCFrameworkVersion() {
2076                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2077                                            "INSERT INTO SCFrameworkVersi_SCProductVers (productVersionId, frameworkVersionId) VALUES (?, ?)",
2078                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2079                    }
2080    
2081                    protected void add(long productVersionId, long frameworkVersionId)
2082                            throws SystemException {
2083                            if (!containsSCFrameworkVersion.contains(productVersionId,
2084                                                    frameworkVersionId)) {
2085                                    ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>[] scFrameworkVersionListeners =
2086                                            scFrameworkVersionPersistence.getListeners();
2087    
2088                                    for (ModelListener<SCProductVersion> listener : listeners) {
2089                                            listener.onBeforeAddAssociation(productVersionId,
2090                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2091                                                    frameworkVersionId);
2092                                    }
2093    
2094                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2095                                            listener.onBeforeAddAssociation(frameworkVersionId,
2096                                                    SCProductVersion.class.getName(), productVersionId);
2097                                    }
2098    
2099                                    _sqlUpdate.update(new Object[] {
2100                                                    new Long(productVersionId), new Long(frameworkVersionId)
2101                                            });
2102    
2103                                    for (ModelListener<SCProductVersion> listener : listeners) {
2104                                            listener.onAfterAddAssociation(productVersionId,
2105                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2106                                                    frameworkVersionId);
2107                                    }
2108    
2109                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2110                                            listener.onAfterAddAssociation(frameworkVersionId,
2111                                                    SCProductVersion.class.getName(), productVersionId);
2112                                    }
2113                            }
2114                    }
2115    
2116                    private SqlUpdate _sqlUpdate;
2117            }
2118    
2119            protected class ClearSCFrameworkVersions {
2120                    protected ClearSCFrameworkVersions() {
2121                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2122                                            "DELETE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ?",
2123                                            new int[] { java.sql.Types.BIGINT });
2124                    }
2125    
2126                    protected void clear(long productVersionId) throws SystemException {
2127                            ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>[] scFrameworkVersionListeners =
2128                                    scFrameworkVersionPersistence.getListeners();
2129    
2130                            List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> scFrameworkVersions =
2131                                    null;
2132    
2133                            if ((listeners.length > 0) ||
2134                                            (scFrameworkVersionListeners.length > 0)) {
2135                                    scFrameworkVersions = getSCFrameworkVersions(productVersionId);
2136    
2137                                    for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
2138                                            for (ModelListener<SCProductVersion> listener : listeners) {
2139                                                    listener.onBeforeRemoveAssociation(productVersionId,
2140                                                            com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2141                                                            scFrameworkVersion.getPrimaryKey());
2142                                            }
2143    
2144                                            for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2145                                                    listener.onBeforeRemoveAssociation(scFrameworkVersion.getPrimaryKey(),
2146                                                            SCProductVersion.class.getName(), productVersionId);
2147                                            }
2148                                    }
2149                            }
2150    
2151                            _sqlUpdate.update(new Object[] { new Long(productVersionId) });
2152    
2153                            if ((listeners.length > 0) ||
2154                                            (scFrameworkVersionListeners.length > 0)) {
2155                                    for (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion scFrameworkVersion : scFrameworkVersions) {
2156                                            for (ModelListener<SCProductVersion> listener : listeners) {
2157                                                    listener.onAfterRemoveAssociation(productVersionId,
2158                                                            com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2159                                                            scFrameworkVersion.getPrimaryKey());
2160                                            }
2161    
2162                                            for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2163                                                    listener.onAfterRemoveAssociation(scFrameworkVersion.getPrimaryKey(),
2164                                                            SCProductVersion.class.getName(), productVersionId);
2165                                            }
2166                                    }
2167                            }
2168                    }
2169    
2170                    private SqlUpdate _sqlUpdate;
2171            }
2172    
2173            protected class RemoveSCFrameworkVersion {
2174                    protected RemoveSCFrameworkVersion() {
2175                            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2176                                            "DELETE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ? AND frameworkVersionId = ?",
2177                                            new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT });
2178                    }
2179    
2180                    protected void remove(long productVersionId, long frameworkVersionId)
2181                            throws SystemException {
2182                            if (containsSCFrameworkVersion.contains(productVersionId,
2183                                                    frameworkVersionId)) {
2184                                    ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>[] scFrameworkVersionListeners =
2185                                            scFrameworkVersionPersistence.getListeners();
2186    
2187                                    for (ModelListener<SCProductVersion> listener : listeners) {
2188                                            listener.onBeforeRemoveAssociation(productVersionId,
2189                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2190                                                    frameworkVersionId);
2191                                    }
2192    
2193                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2194                                            listener.onBeforeRemoveAssociation(frameworkVersionId,
2195                                                    SCProductVersion.class.getName(), productVersionId);
2196                                    }
2197    
2198                                    _sqlUpdate.update(new Object[] {
2199                                                    new Long(productVersionId), new Long(frameworkVersionId)
2200                                            });
2201    
2202                                    for (ModelListener<SCProductVersion> listener : listeners) {
2203                                            listener.onAfterRemoveAssociation(productVersionId,
2204                                                    com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion.class.getName(),
2205                                                    frameworkVersionId);
2206                                    }
2207    
2208                                    for (ModelListener<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> listener : scFrameworkVersionListeners) {
2209                                            listener.onAfterRemoveAssociation(frameworkVersionId,
2210                                                    SCProductVersion.class.getName(), productVersionId);
2211                                    }
2212                            }
2213                    }
2214    
2215                    private SqlUpdate _sqlUpdate;
2216            }
2217    
2218            private static final String _SQL_SELECT_SCPRODUCTVERSION = "SELECT scProductVersion FROM SCProductVersion scProductVersion";
2219            private static final String _SQL_SELECT_SCPRODUCTVERSION_WHERE = "SELECT scProductVersion FROM SCProductVersion scProductVersion WHERE ";
2220            private static final String _SQL_COUNT_SCPRODUCTVERSION = "SELECT COUNT(scProductVersion) FROM SCProductVersion scProductVersion";
2221            private static final String _SQL_COUNT_SCPRODUCTVERSION_WHERE = "SELECT COUNT(scProductVersion) FROM SCProductVersion scProductVersion WHERE ";
2222            private static final String _SQL_GETSCFRAMEWORKVERSIONS = "SELECT {SCFrameworkVersion.*} FROM SCFrameworkVersion INNER JOIN SCFrameworkVersi_SCProductVers ON (SCFrameworkVersi_SCProductVers.frameworkVersionId = SCFrameworkVersion.frameworkVersionId) WHERE (SCFrameworkVersi_SCProductVers.productVersionId = ?)";
2223            private static final String _SQL_GETSCFRAMEWORKVERSIONSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCFrameworkVersi_SCProductVers WHERE productVersionId = ?";
2224            private static final String _ORDER_BY_ENTITY_ALIAS = "scProductVersion.";
2225            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No SCProductVersion exists with the primary key ";
2226            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No SCProductVersion exists with the key {";
2227            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2228            private static Log _log = LogFactoryUtil.getLog(SCProductVersionPersistenceImpl.class);
2229            private static SCProductVersion _nullSCProductVersion = new SCProductVersionImpl() {
2230                            @Override
2231                            public Object clone() {
2232                                    return this;
2233                            }
2234    
2235                            @Override
2236                            public CacheModel<SCProductVersion> toCacheModel() {
2237                                    return _nullSCProductVersionCacheModel;
2238                            }
2239                    };
2240    
2241            private static CacheModel<SCProductVersion> _nullSCProductVersionCacheModel = new CacheModel<SCProductVersion>() {
2242                            @Override
2243                            public SCProductVersion toEntityModel() {
2244                                    return _nullSCProductVersion;
2245                            }
2246                    };
2247    }