1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.softwarecatalog.service.persistence;
21  
22  import com.liferay.portal.SystemException;
23  import com.liferay.portal.kernel.annotation.BeanReference;
24  import com.liferay.portal.kernel.cache.CacheRegistry;
25  import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
26  import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
27  import com.liferay.portal.kernel.dao.jdbc.RowMapper;
28  import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
29  import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
30  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
31  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
32  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
33  import com.liferay.portal.kernel.dao.orm.FinderPath;
34  import com.liferay.portal.kernel.dao.orm.Query;
35  import com.liferay.portal.kernel.dao.orm.QueryPos;
36  import com.liferay.portal.kernel.dao.orm.QueryUtil;
37  import com.liferay.portal.kernel.dao.orm.SQLQuery;
38  import com.liferay.portal.kernel.dao.orm.Session;
39  import com.liferay.portal.kernel.dao.orm.Type;
40  import com.liferay.portal.kernel.log.Log;
41  import com.liferay.portal.kernel.log.LogFactoryUtil;
42  import com.liferay.portal.kernel.util.GetterUtil;
43  import com.liferay.portal.kernel.util.OrderByComparator;
44  import com.liferay.portal.kernel.util.StringPool;
45  import com.liferay.portal.kernel.util.StringUtil;
46  import com.liferay.portal.model.ModelListener;
47  import com.liferay.portal.service.persistence.BatchSessionUtil;
48  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
49  
50  import com.liferay.portlet.softwarecatalog.NoSuchProductEntryException;
51  import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
52  import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryImpl;
53  import com.liferay.portlet.softwarecatalog.model.impl.SCProductEntryModelImpl;
54  
55  import java.sql.Types;
56  
57  import java.util.ArrayList;
58  import java.util.Collections;
59  import java.util.List;
60  
61  /**
62   * <a href="SCProductEntryPersistenceImpl.java.html"><b><i>View Source</i></b></a>
63   *
64   * @author Brian Wing Shun Chan
65   *
66   */
67  public class SCProductEntryPersistenceImpl extends BasePersistenceImpl
68      implements SCProductEntryPersistence {
69      public static final String FINDER_CLASS_NAME_ENTITY = SCProductEntryImpl.class.getName();
70      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
71          ".List";
72      public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
73              SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
74              FINDER_CLASS_NAME_LIST, "findByGroupId",
75              new String[] { Long.class.getName() });
76      public static final FinderPath FINDER_PATH_FIND_BY_OBC_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
77              SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
78              FINDER_CLASS_NAME_LIST, "findByGroupId",
79              new String[] {
80                  Long.class.getName(),
81                  
82              "java.lang.Integer", "java.lang.Integer",
83                  "com.liferay.portal.kernel.util.OrderByComparator"
84              });
85      public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
86              SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
87              FINDER_CLASS_NAME_LIST, "countByGroupId",
88              new String[] { Long.class.getName() });
89      public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
90              SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
91              FINDER_CLASS_NAME_LIST, "findByCompanyId",
92              new String[] { Long.class.getName() });
93      public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
94              SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
95              FINDER_CLASS_NAME_LIST, "findByCompanyId",
96              new String[] {
97                  Long.class.getName(),
98                  
99              "java.lang.Integer", "java.lang.Integer",
100                 "com.liferay.portal.kernel.util.OrderByComparator"
101             });
102     public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
103             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
104             FINDER_CLASS_NAME_LIST, "countByCompanyId",
105             new String[] { Long.class.getName() });
106     public static final FinderPath FINDER_PATH_FIND_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
107             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
108             FINDER_CLASS_NAME_LIST, "findByG_U",
109             new String[] { Long.class.getName(), Long.class.getName() });
110     public static final FinderPath FINDER_PATH_FIND_BY_OBC_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
111             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
112             FINDER_CLASS_NAME_LIST, "findByG_U",
113             new String[] {
114                 Long.class.getName(), Long.class.getName(),
115                 
116             "java.lang.Integer", "java.lang.Integer",
117                 "com.liferay.portal.kernel.util.OrderByComparator"
118             });
119     public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
120             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
121             FINDER_CLASS_NAME_LIST, "countByG_U",
122             new String[] { Long.class.getName(), Long.class.getName() });
123     public static final FinderPath FINDER_PATH_FETCH_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
124             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
125             FINDER_CLASS_NAME_ENTITY, "fetchByRG_RA",
126             new String[] { String.class.getName(), String.class.getName() });
127     public static final FinderPath FINDER_PATH_COUNT_BY_RG_RA = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
128             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
129             FINDER_CLASS_NAME_LIST, "countByRG_RA",
130             new String[] { String.class.getName(), String.class.getName() });
131     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
132             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
133             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
134     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
135             SCProductEntryModelImpl.FINDER_CACHE_ENABLED,
136             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
137 
138     public void cacheResult(SCProductEntry scProductEntry) {
139         EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
140             SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
141             scProductEntry);
142 
143         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
144             new Object[] {
145                 scProductEntry.getRepoGroupId(),
146                 
147             scProductEntry.getRepoArtifactId()
148             }, scProductEntry);
149     }
150 
151     public void cacheResult(List<SCProductEntry> scProductEntries) {
152         for (SCProductEntry scProductEntry : scProductEntries) {
153             if (EntityCacheUtil.getResult(
154                         SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
155                         SCProductEntryImpl.class,
156                         scProductEntry.getPrimaryKey(), this) == null) {
157                 cacheResult(scProductEntry);
158             }
159         }
160     }
161 
162     public void clearCache() {
163         CacheRegistry.clear(SCProductEntryImpl.class.getName());
164         EntityCacheUtil.clearCache(SCProductEntryImpl.class.getName());
165         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
166         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
167     }
168 
169     public SCProductEntry create(long productEntryId) {
170         SCProductEntry scProductEntry = new SCProductEntryImpl();
171 
172         scProductEntry.setNew(true);
173         scProductEntry.setPrimaryKey(productEntryId);
174 
175         return scProductEntry;
176     }
177 
178     public SCProductEntry remove(long productEntryId)
179         throws NoSuchProductEntryException, SystemException {
180         Session session = null;
181 
182         try {
183             session = openSession();
184 
185             SCProductEntry scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
186                     new Long(productEntryId));
187 
188             if (scProductEntry == null) {
189                 if (_log.isWarnEnabled()) {
190                     _log.warn("No SCProductEntry exists with the primary key " +
191                         productEntryId);
192                 }
193 
194                 throw new NoSuchProductEntryException(
195                     "No SCProductEntry exists with the primary key " +
196                     productEntryId);
197             }
198 
199             return remove(scProductEntry);
200         }
201         catch (NoSuchProductEntryException nsee) {
202             throw nsee;
203         }
204         catch (Exception e) {
205             throw processException(e);
206         }
207         finally {
208             closeSession(session);
209         }
210     }
211 
212     public SCProductEntry remove(SCProductEntry scProductEntry)
213         throws SystemException {
214         for (ModelListener<SCProductEntry> listener : listeners) {
215             listener.onBeforeRemove(scProductEntry);
216         }
217 
218         scProductEntry = removeImpl(scProductEntry);
219 
220         for (ModelListener<SCProductEntry> listener : listeners) {
221             listener.onAfterRemove(scProductEntry);
222         }
223 
224         return scProductEntry;
225     }
226 
227     protected SCProductEntry removeImpl(SCProductEntry scProductEntry)
228         throws SystemException {
229         try {
230             clearSCLicenses.clear(scProductEntry.getPrimaryKey());
231         }
232         catch (Exception e) {
233             throw processException(e);
234         }
235         finally {
236             FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
237         }
238 
239         Session session = null;
240 
241         try {
242             session = openSession();
243 
244             if (scProductEntry.isCachedModel() || BatchSessionUtil.isEnabled()) {
245                 Object staleObject = session.get(SCProductEntryImpl.class,
246                         scProductEntry.getPrimaryKeyObj());
247 
248                 if (staleObject != null) {
249                     session.evict(staleObject);
250                 }
251             }
252 
253             session.delete(scProductEntry);
254 
255             session.flush();
256         }
257         catch (Exception e) {
258             throw processException(e);
259         }
260         finally {
261             closeSession(session);
262         }
263 
264         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
265 
266         SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
267 
268         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA,
269             new Object[] {
270                 scProductEntryModelImpl.getOriginalRepoGroupId(),
271                 
272             scProductEntryModelImpl.getOriginalRepoArtifactId()
273             });
274 
275         EntityCacheUtil.removeResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
276             SCProductEntryImpl.class, scProductEntry.getPrimaryKey());
277 
278         return scProductEntry;
279     }
280 
281     /**
282      * @deprecated Use <code>update(SCProductEntry scProductEntry, boolean merge)</code>.
283      */
284     public SCProductEntry update(SCProductEntry scProductEntry)
285         throws SystemException {
286         if (_log.isWarnEnabled()) {
287             _log.warn(
288                 "Using the deprecated update(SCProductEntry scProductEntry) method. Use update(SCProductEntry scProductEntry, boolean merge) instead.");
289         }
290 
291         return update(scProductEntry, false);
292     }
293 
294     /**
295      * Add, update, or merge, the entity. This method also calls the model
296      * listeners to trigger the proper events associated with adding, deleting,
297      * or updating an entity.
298      *
299      * @param        scProductEntry the entity to add, update, or merge
300      * @param        merge boolean value for whether to merge the entity. The
301      *                default value is false. Setting merge to true is more
302      *                expensive and should only be true when scProductEntry is
303      *                transient. See LEP-5473 for a detailed discussion of this
304      *                method.
305      * @return        true if the portlet can be displayed via Ajax
306      */
307     public SCProductEntry update(SCProductEntry scProductEntry, boolean merge)
308         throws SystemException {
309         boolean isNew = scProductEntry.isNew();
310 
311         for (ModelListener<SCProductEntry> listener : listeners) {
312             if (isNew) {
313                 listener.onBeforeCreate(scProductEntry);
314             }
315             else {
316                 listener.onBeforeUpdate(scProductEntry);
317             }
318         }
319 
320         scProductEntry = updateImpl(scProductEntry, merge);
321 
322         for (ModelListener<SCProductEntry> listener : listeners) {
323             if (isNew) {
324                 listener.onAfterCreate(scProductEntry);
325             }
326             else {
327                 listener.onAfterUpdate(scProductEntry);
328             }
329         }
330 
331         return scProductEntry;
332     }
333 
334     public SCProductEntry updateImpl(
335         com.liferay.portlet.softwarecatalog.model.SCProductEntry scProductEntry,
336         boolean merge) throws SystemException {
337         boolean isNew = scProductEntry.isNew();
338 
339         SCProductEntryModelImpl scProductEntryModelImpl = (SCProductEntryModelImpl)scProductEntry;
340 
341         Session session = null;
342 
343         try {
344             session = openSession();
345 
346             BatchSessionUtil.update(session, scProductEntry, merge);
347 
348             scProductEntry.setNew(false);
349         }
350         catch (Exception e) {
351             throw processException(e);
352         }
353         finally {
354             closeSession(session);
355         }
356 
357         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
358 
359         EntityCacheUtil.putResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
360             SCProductEntryImpl.class, scProductEntry.getPrimaryKey(),
361             scProductEntry);
362 
363         if (!isNew &&
364                 (!scProductEntry.getRepoGroupId()
365                                     .equals(scProductEntryModelImpl.getOriginalRepoGroupId()) ||
366                 !scProductEntry.getRepoArtifactId()
367                                    .equals(scProductEntryModelImpl.getOriginalRepoArtifactId()))) {
368             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_RG_RA,
369                 new Object[] {
370                     scProductEntryModelImpl.getOriginalRepoGroupId(),
371                     
372                 scProductEntryModelImpl.getOriginalRepoArtifactId()
373                 });
374         }
375 
376         if (isNew ||
377                 (!scProductEntry.getRepoGroupId()
378                                     .equals(scProductEntryModelImpl.getOriginalRepoGroupId()) ||
379                 !scProductEntry.getRepoArtifactId()
380                                    .equals(scProductEntryModelImpl.getOriginalRepoArtifactId()))) {
381             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
382                 new Object[] {
383                     scProductEntry.getRepoGroupId(),
384                     
385                 scProductEntry.getRepoArtifactId()
386                 }, scProductEntry);
387         }
388 
389         return scProductEntry;
390     }
391 
392     public SCProductEntry findByPrimaryKey(long productEntryId)
393         throws NoSuchProductEntryException, SystemException {
394         SCProductEntry scProductEntry = fetchByPrimaryKey(productEntryId);
395 
396         if (scProductEntry == null) {
397             if (_log.isWarnEnabled()) {
398                 _log.warn("No SCProductEntry exists with the primary key " +
399                     productEntryId);
400             }
401 
402             throw new NoSuchProductEntryException(
403                 "No SCProductEntry exists with the primary key " +
404                 productEntryId);
405         }
406 
407         return scProductEntry;
408     }
409 
410     public SCProductEntry fetchByPrimaryKey(long productEntryId)
411         throws SystemException {
412         SCProductEntry scProductEntry = (SCProductEntry)EntityCacheUtil.getResult(SCProductEntryModelImpl.ENTITY_CACHE_ENABLED,
413                 SCProductEntryImpl.class, productEntryId, this);
414 
415         if (scProductEntry == null) {
416             Session session = null;
417 
418             try {
419                 session = openSession();
420 
421                 scProductEntry = (SCProductEntry)session.get(SCProductEntryImpl.class,
422                         new Long(productEntryId));
423             }
424             catch (Exception e) {
425                 throw processException(e);
426             }
427             finally {
428                 if (scProductEntry != null) {
429                     cacheResult(scProductEntry);
430                 }
431 
432                 closeSession(session);
433             }
434         }
435 
436         return scProductEntry;
437     }
438 
439     public List<SCProductEntry> findByGroupId(long groupId)
440         throws SystemException {
441         Object[] finderArgs = new Object[] { new Long(groupId) };
442 
443         List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
444                 finderArgs, this);
445 
446         if (list == null) {
447             Session session = null;
448 
449             try {
450                 session = openSession();
451 
452                 StringBuilder query = new StringBuilder();
453 
454                 query.append(
455                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
456 
457                 query.append("groupId = ?");
458 
459                 query.append(" ");
460 
461                 query.append("ORDER BY ");
462 
463                 query.append("modifiedDate DESC, ");
464                 query.append("name DESC");
465 
466                 Query q = session.createQuery(query.toString());
467 
468                 QueryPos qPos = QueryPos.getInstance(q);
469 
470                 qPos.add(groupId);
471 
472                 list = q.list();
473             }
474             catch (Exception e) {
475                 throw processException(e);
476             }
477             finally {
478                 if (list == null) {
479                     list = new ArrayList<SCProductEntry>();
480                 }
481 
482                 cacheResult(list);
483 
484                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
485                     finderArgs, list);
486 
487                 closeSession(session);
488             }
489         }
490 
491         return list;
492     }
493 
494     public List<SCProductEntry> findByGroupId(long groupId, int start, int end)
495         throws SystemException {
496         return findByGroupId(groupId, start, end, null);
497     }
498 
499     public List<SCProductEntry> findByGroupId(long groupId, int start, int end,
500         OrderByComparator obc) throws SystemException {
501         Object[] finderArgs = new Object[] {
502                 new Long(groupId),
503                 
504                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
505             };
506 
507         List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
508                 finderArgs, this);
509 
510         if (list == null) {
511             Session session = null;
512 
513             try {
514                 session = openSession();
515 
516                 StringBuilder query = new StringBuilder();
517 
518                 query.append(
519                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
520 
521                 query.append("groupId = ?");
522 
523                 query.append(" ");
524 
525                 if (obc != null) {
526                     query.append("ORDER BY ");
527                     query.append(obc.getOrderBy());
528                 }
529 
530                 else {
531                     query.append("ORDER BY ");
532 
533                     query.append("modifiedDate DESC, ");
534                     query.append("name DESC");
535                 }
536 
537                 Query q = session.createQuery(query.toString());
538 
539                 QueryPos qPos = QueryPos.getInstance(q);
540 
541                 qPos.add(groupId);
542 
543                 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
544                         start, end);
545             }
546             catch (Exception e) {
547                 throw processException(e);
548             }
549             finally {
550                 if (list == null) {
551                     list = new ArrayList<SCProductEntry>();
552                 }
553 
554                 cacheResult(list);
555 
556                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_GROUPID,
557                     finderArgs, list);
558 
559                 closeSession(session);
560             }
561         }
562 
563         return list;
564     }
565 
566     public SCProductEntry findByGroupId_First(long groupId,
567         OrderByComparator obc)
568         throws NoSuchProductEntryException, SystemException {
569         List<SCProductEntry> list = findByGroupId(groupId, 0, 1, obc);
570 
571         if (list.isEmpty()) {
572             StringBuilder msg = new StringBuilder();
573 
574             msg.append("No SCProductEntry exists with the key {");
575 
576             msg.append("groupId=" + groupId);
577 
578             msg.append(StringPool.CLOSE_CURLY_BRACE);
579 
580             throw new NoSuchProductEntryException(msg.toString());
581         }
582         else {
583             return list.get(0);
584         }
585     }
586 
587     public SCProductEntry findByGroupId_Last(long groupId, OrderByComparator obc)
588         throws NoSuchProductEntryException, SystemException {
589         int count = countByGroupId(groupId);
590 
591         List<SCProductEntry> list = findByGroupId(groupId, count - 1, count, obc);
592 
593         if (list.isEmpty()) {
594             StringBuilder msg = new StringBuilder();
595 
596             msg.append("No SCProductEntry exists with the key {");
597 
598             msg.append("groupId=" + groupId);
599 
600             msg.append(StringPool.CLOSE_CURLY_BRACE);
601 
602             throw new NoSuchProductEntryException(msg.toString());
603         }
604         else {
605             return list.get(0);
606         }
607     }
608 
609     public SCProductEntry[] findByGroupId_PrevAndNext(long productEntryId,
610         long groupId, OrderByComparator obc)
611         throws NoSuchProductEntryException, SystemException {
612         SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
613 
614         int count = countByGroupId(groupId);
615 
616         Session session = null;
617 
618         try {
619             session = openSession();
620 
621             StringBuilder query = new StringBuilder();
622 
623             query.append(
624                 "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
625 
626             query.append("groupId = ?");
627 
628             query.append(" ");
629 
630             if (obc != null) {
631                 query.append("ORDER BY ");
632                 query.append(obc.getOrderBy());
633             }
634 
635             else {
636                 query.append("ORDER BY ");
637 
638                 query.append("modifiedDate DESC, ");
639                 query.append("name DESC");
640             }
641 
642             Query q = session.createQuery(query.toString());
643 
644             QueryPos qPos = QueryPos.getInstance(q);
645 
646             qPos.add(groupId);
647 
648             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
649                     scProductEntry);
650 
651             SCProductEntry[] array = new SCProductEntryImpl[3];
652 
653             array[0] = (SCProductEntry)objArray[0];
654             array[1] = (SCProductEntry)objArray[1];
655             array[2] = (SCProductEntry)objArray[2];
656 
657             return array;
658         }
659         catch (Exception e) {
660             throw processException(e);
661         }
662         finally {
663             closeSession(session);
664         }
665     }
666 
667     public List<SCProductEntry> findByCompanyId(long companyId)
668         throws SystemException {
669         Object[] finderArgs = new Object[] { new Long(companyId) };
670 
671         List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
672                 finderArgs, this);
673 
674         if (list == null) {
675             Session session = null;
676 
677             try {
678                 session = openSession();
679 
680                 StringBuilder query = new StringBuilder();
681 
682                 query.append(
683                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
684 
685                 query.append("companyId = ?");
686 
687                 query.append(" ");
688 
689                 query.append("ORDER BY ");
690 
691                 query.append("modifiedDate DESC, ");
692                 query.append("name DESC");
693 
694                 Query q = session.createQuery(query.toString());
695 
696                 QueryPos qPos = QueryPos.getInstance(q);
697 
698                 qPos.add(companyId);
699 
700                 list = q.list();
701             }
702             catch (Exception e) {
703                 throw processException(e);
704             }
705             finally {
706                 if (list == null) {
707                     list = new ArrayList<SCProductEntry>();
708                 }
709 
710                 cacheResult(list);
711 
712                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
713                     finderArgs, list);
714 
715                 closeSession(session);
716             }
717         }
718 
719         return list;
720     }
721 
722     public List<SCProductEntry> findByCompanyId(long companyId, int start,
723         int end) throws SystemException {
724         return findByCompanyId(companyId, start, end, null);
725     }
726 
727     public List<SCProductEntry> findByCompanyId(long companyId, int start,
728         int end, OrderByComparator obc) throws SystemException {
729         Object[] finderArgs = new Object[] {
730                 new Long(companyId),
731                 
732                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
733             };
734 
735         List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
736                 finderArgs, this);
737 
738         if (list == null) {
739             Session session = null;
740 
741             try {
742                 session = openSession();
743 
744                 StringBuilder query = new StringBuilder();
745 
746                 query.append(
747                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
748 
749                 query.append("companyId = ?");
750 
751                 query.append(" ");
752 
753                 if (obc != null) {
754                     query.append("ORDER BY ");
755                     query.append(obc.getOrderBy());
756                 }
757 
758                 else {
759                     query.append("ORDER BY ");
760 
761                     query.append("modifiedDate DESC, ");
762                     query.append("name DESC");
763                 }
764 
765                 Query q = session.createQuery(query.toString());
766 
767                 QueryPos qPos = QueryPos.getInstance(q);
768 
769                 qPos.add(companyId);
770 
771                 list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
772                         start, end);
773             }
774             catch (Exception e) {
775                 throw processException(e);
776             }
777             finally {
778                 if (list == null) {
779                     list = new ArrayList<SCProductEntry>();
780                 }
781 
782                 cacheResult(list);
783 
784                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
785                     finderArgs, list);
786 
787                 closeSession(session);
788             }
789         }
790 
791         return list;
792     }
793 
794     public SCProductEntry findByCompanyId_First(long companyId,
795         OrderByComparator obc)
796         throws NoSuchProductEntryException, SystemException {
797         List<SCProductEntry> list = findByCompanyId(companyId, 0, 1, obc);
798 
799         if (list.isEmpty()) {
800             StringBuilder msg = new StringBuilder();
801 
802             msg.append("No SCProductEntry exists with the key {");
803 
804             msg.append("companyId=" + companyId);
805 
806             msg.append(StringPool.CLOSE_CURLY_BRACE);
807 
808             throw new NoSuchProductEntryException(msg.toString());
809         }
810         else {
811             return list.get(0);
812         }
813     }
814 
815     public SCProductEntry findByCompanyId_Last(long companyId,
816         OrderByComparator obc)
817         throws NoSuchProductEntryException, SystemException {
818         int count = countByCompanyId(companyId);
819 
820         List<SCProductEntry> list = findByCompanyId(companyId, count - 1,
821                 count, obc);
822 
823         if (list.isEmpty()) {
824             StringBuilder msg = new StringBuilder();
825 
826             msg.append("No SCProductEntry exists with the key {");
827 
828             msg.append("companyId=" + companyId);
829 
830             msg.append(StringPool.CLOSE_CURLY_BRACE);
831 
832             throw new NoSuchProductEntryException(msg.toString());
833         }
834         else {
835             return list.get(0);
836         }
837     }
838 
839     public SCProductEntry[] findByCompanyId_PrevAndNext(long productEntryId,
840         long companyId, OrderByComparator obc)
841         throws NoSuchProductEntryException, SystemException {
842         SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
843 
844         int count = countByCompanyId(companyId);
845 
846         Session session = null;
847 
848         try {
849             session = openSession();
850 
851             StringBuilder query = new StringBuilder();
852 
853             query.append(
854                 "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
855 
856             query.append("companyId = ?");
857 
858             query.append(" ");
859 
860             if (obc != null) {
861                 query.append("ORDER BY ");
862                 query.append(obc.getOrderBy());
863             }
864 
865             else {
866                 query.append("ORDER BY ");
867 
868                 query.append("modifiedDate DESC, ");
869                 query.append("name DESC");
870             }
871 
872             Query q = session.createQuery(query.toString());
873 
874             QueryPos qPos = QueryPos.getInstance(q);
875 
876             qPos.add(companyId);
877 
878             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
879                     scProductEntry);
880 
881             SCProductEntry[] array = new SCProductEntryImpl[3];
882 
883             array[0] = (SCProductEntry)objArray[0];
884             array[1] = (SCProductEntry)objArray[1];
885             array[2] = (SCProductEntry)objArray[2];
886 
887             return array;
888         }
889         catch (Exception e) {
890             throw processException(e);
891         }
892         finally {
893             closeSession(session);
894         }
895     }
896 
897     public List<SCProductEntry> findByG_U(long groupId, long userId)
898         throws SystemException {
899         Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
900 
901         List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U,
902                 finderArgs, this);
903 
904         if (list == null) {
905             Session session = null;
906 
907             try {
908                 session = openSession();
909 
910                 StringBuilder query = new StringBuilder();
911 
912                 query.append(
913                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
914 
915                 query.append("groupId = ?");
916 
917                 query.append(" AND ");
918 
919                 query.append("userId = ?");
920 
921                 query.append(" ");
922 
923                 query.append("ORDER BY ");
924 
925                 query.append("modifiedDate DESC, ");
926                 query.append("name DESC");
927 
928                 Query q = session.createQuery(query.toString());
929 
930                 QueryPos qPos = QueryPos.getInstance(q);
931 
932                 qPos.add(groupId);
933 
934                 qPos.add(userId);
935 
936                 list = q.list();
937             }
938             catch (Exception e) {
939                 throw processException(e);
940             }
941             finally {
942                 if (list == null) {
943                     list = new ArrayList<SCProductEntry>();
944                 }
945 
946                 cacheResult(list);
947 
948                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U, finderArgs,
949                     list);
950 
951                 closeSession(session);
952             }
953         }
954 
955         return list;
956     }
957 
958     public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
959         int end) throws SystemException {
960         return findByG_U(groupId, userId, start, end, null);
961     }
962 
963     public List<SCProductEntry> findByG_U(long groupId, long userId, int start,
964         int end, OrderByComparator obc) throws SystemException {
965         Object[] finderArgs = new Object[] {
966                 new Long(groupId), new Long(userId),
967                 
968                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
969             };
970 
971         List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_G_U,
972                 finderArgs, this);
973 
974         if (list == null) {
975             Session session = null;
976 
977             try {
978                 session = openSession();
979 
980                 StringBuilder query = new StringBuilder();
981 
982                 query.append(
983                     "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
984 
985                 query.append("groupId = ?");
986 
987                 query.append(" AND ");
988 
989                 query.append("userId = ?");
990 
991                 query.append(" ");
992 
993                 if (obc != null) {
994                     query.append("ORDER BY ");
995                     query.append(obc.getOrderBy());
996                 }
997 
998                 else {
999                     query.append("ORDER BY ");
1000
1001                    query.append("modifiedDate DESC, ");
1002                    query.append("name DESC");
1003                }
1004
1005                Query q = session.createQuery(query.toString());
1006
1007                QueryPos qPos = QueryPos.getInstance(q);
1008
1009                qPos.add(groupId);
1010
1011                qPos.add(userId);
1012
1013                list = (List<SCProductEntry>)QueryUtil.list(q, getDialect(),
1014                        start, end);
1015            }
1016            catch (Exception e) {
1017                throw processException(e);
1018            }
1019            finally {
1020                if (list == null) {
1021                    list = new ArrayList<SCProductEntry>();
1022                }
1023
1024                cacheResult(list);
1025
1026                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_G_U,
1027                    finderArgs, list);
1028
1029                closeSession(session);
1030            }
1031        }
1032
1033        return list;
1034    }
1035
1036    public SCProductEntry findByG_U_First(long groupId, long userId,
1037        OrderByComparator obc)
1038        throws NoSuchProductEntryException, SystemException {
1039        List<SCProductEntry> list = findByG_U(groupId, userId, 0, 1, obc);
1040
1041        if (list.isEmpty()) {
1042            StringBuilder msg = new StringBuilder();
1043
1044            msg.append("No SCProductEntry exists with the key {");
1045
1046            msg.append("groupId=" + groupId);
1047
1048            msg.append(", ");
1049            msg.append("userId=" + userId);
1050
1051            msg.append(StringPool.CLOSE_CURLY_BRACE);
1052
1053            throw new NoSuchProductEntryException(msg.toString());
1054        }
1055        else {
1056            return list.get(0);
1057        }
1058    }
1059
1060    public SCProductEntry findByG_U_Last(long groupId, long userId,
1061        OrderByComparator obc)
1062        throws NoSuchProductEntryException, SystemException {
1063        int count = countByG_U(groupId, userId);
1064
1065        List<SCProductEntry> list = findByG_U(groupId, userId, count - 1,
1066                count, obc);
1067
1068        if (list.isEmpty()) {
1069            StringBuilder msg = new StringBuilder();
1070
1071            msg.append("No SCProductEntry exists with the key {");
1072
1073            msg.append("groupId=" + groupId);
1074
1075            msg.append(", ");
1076            msg.append("userId=" + userId);
1077
1078            msg.append(StringPool.CLOSE_CURLY_BRACE);
1079
1080            throw new NoSuchProductEntryException(msg.toString());
1081        }
1082        else {
1083            return list.get(0);
1084        }
1085    }
1086
1087    public SCProductEntry[] findByG_U_PrevAndNext(long productEntryId,
1088        long groupId, long userId, OrderByComparator obc)
1089        throws NoSuchProductEntryException, SystemException {
1090        SCProductEntry scProductEntry = findByPrimaryKey(productEntryId);
1091
1092        int count = countByG_U(groupId, userId);
1093
1094        Session session = null;
1095
1096        try {
1097            session = openSession();
1098
1099            StringBuilder query = new StringBuilder();
1100
1101            query.append(
1102                "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
1103
1104            query.append("groupId = ?");
1105
1106            query.append(" AND ");
1107
1108            query.append("userId = ?");
1109
1110            query.append(" ");
1111
1112            if (obc != null) {
1113                query.append("ORDER BY ");
1114                query.append(obc.getOrderBy());
1115            }
1116
1117            else {
1118                query.append("ORDER BY ");
1119
1120                query.append("modifiedDate DESC, ");
1121                query.append("name DESC");
1122            }
1123
1124            Query q = session.createQuery(query.toString());
1125
1126            QueryPos qPos = QueryPos.getInstance(q);
1127
1128            qPos.add(groupId);
1129
1130            qPos.add(userId);
1131
1132            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1133                    scProductEntry);
1134
1135            SCProductEntry[] array = new SCProductEntryImpl[3];
1136
1137            array[0] = (SCProductEntry)objArray[0];
1138            array[1] = (SCProductEntry)objArray[1];
1139            array[2] = (SCProductEntry)objArray[2];
1140
1141            return array;
1142        }
1143        catch (Exception e) {
1144            throw processException(e);
1145        }
1146        finally {
1147            closeSession(session);
1148        }
1149    }
1150
1151    public SCProductEntry findByRG_RA(String repoGroupId, String repoArtifactId)
1152        throws NoSuchProductEntryException, SystemException {
1153        SCProductEntry scProductEntry = fetchByRG_RA(repoGroupId, repoArtifactId);
1154
1155        if (scProductEntry == null) {
1156            StringBuilder msg = new StringBuilder();
1157
1158            msg.append("No SCProductEntry exists with the key {");
1159
1160            msg.append("repoGroupId=" + repoGroupId);
1161
1162            msg.append(", ");
1163            msg.append("repoArtifactId=" + repoArtifactId);
1164
1165            msg.append(StringPool.CLOSE_CURLY_BRACE);
1166
1167            if (_log.isWarnEnabled()) {
1168                _log.warn(msg.toString());
1169            }
1170
1171            throw new NoSuchProductEntryException(msg.toString());
1172        }
1173
1174        return scProductEntry;
1175    }
1176
1177    public SCProductEntry fetchByRG_RA(String repoGroupId, String repoArtifactId)
1178        throws SystemException {
1179        return fetchByRG_RA(repoGroupId, repoArtifactId, true);
1180    }
1181
1182    public SCProductEntry fetchByRG_RA(String repoGroupId,
1183        String repoArtifactId, boolean retrieveFromCache)
1184        throws SystemException {
1185        Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
1186
1187        Object result = null;
1188
1189        if (retrieveFromCache) {
1190            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_RG_RA,
1191                    finderArgs, this);
1192        }
1193
1194        if (result == null) {
1195            Session session = null;
1196
1197            try {
1198                session = openSession();
1199
1200                StringBuilder query = new StringBuilder();
1201
1202                query.append(
1203                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
1204
1205                if (repoGroupId == null) {
1206                    query.append("repoGroupId IS NULL");
1207                }
1208                else {
1209                    query.append("lower(repoGroupId) = ?");
1210                }
1211
1212                query.append(" AND ");
1213
1214                if (repoArtifactId == null) {
1215                    query.append("repoArtifactId IS NULL");
1216                }
1217                else {
1218                    query.append("lower(repoArtifactId) = ?");
1219                }
1220
1221                query.append(" ");
1222
1223                query.append("ORDER BY ");
1224
1225                query.append("modifiedDate DESC, ");
1226                query.append("name DESC");
1227
1228                Query q = session.createQuery(query.toString());
1229
1230                QueryPos qPos = QueryPos.getInstance(q);
1231
1232                if (repoGroupId != null) {
1233                    qPos.add(repoGroupId);
1234                }
1235
1236                if (repoArtifactId != null) {
1237                    qPos.add(repoArtifactId);
1238                }
1239
1240                List<SCProductEntry> list = q.list();
1241
1242                result = list;
1243
1244                SCProductEntry scProductEntry = null;
1245
1246                if (list.isEmpty()) {
1247                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
1248                        finderArgs, list);
1249                }
1250                else {
1251                    scProductEntry = list.get(0);
1252
1253                    cacheResult(scProductEntry);
1254
1255                    if ((scProductEntry.getRepoGroupId() == null) ||
1256                            !scProductEntry.getRepoGroupId().equals(repoGroupId) ||
1257                            (scProductEntry.getRepoArtifactId() == null) ||
1258                            !scProductEntry.getRepoArtifactId()
1259                                               .equals(repoArtifactId)) {
1260                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
1261                            finderArgs, list);
1262                    }
1263                }
1264
1265                return scProductEntry;
1266            }
1267            catch (Exception e) {
1268                throw processException(e);
1269            }
1270            finally {
1271                if (result == null) {
1272                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_RG_RA,
1273                        finderArgs, new ArrayList<SCProductEntry>());
1274                }
1275
1276                closeSession(session);
1277            }
1278        }
1279        else {
1280            if (result instanceof List) {
1281                return null;
1282            }
1283            else {
1284                return (SCProductEntry)result;
1285            }
1286        }
1287    }
1288
1289    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
1290        throws SystemException {
1291        Session session = null;
1292
1293        try {
1294            session = openSession();
1295
1296            dynamicQuery.compile(session);
1297
1298            return dynamicQuery.list();
1299        }
1300        catch (Exception e) {
1301            throw processException(e);
1302        }
1303        finally {
1304            closeSession(session);
1305        }
1306    }
1307
1308    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
1309        int start, int end) throws SystemException {
1310        Session session = null;
1311
1312        try {
1313            session = openSession();
1314
1315            dynamicQuery.setLimit(start, end);
1316
1317            dynamicQuery.compile(session);
1318
1319            return dynamicQuery.list();
1320        }
1321        catch (Exception e) {
1322            throw processException(e);
1323        }
1324        finally {
1325            closeSession(session);
1326        }
1327    }
1328
1329    public List<SCProductEntry> findAll() throws SystemException {
1330        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1331    }
1332
1333    public List<SCProductEntry> findAll(int start, int end)
1334        throws SystemException {
1335        return findAll(start, end, null);
1336    }
1337
1338    public List<SCProductEntry> findAll(int start, int end,
1339        OrderByComparator obc) throws SystemException {
1340        Object[] finderArgs = new Object[] {
1341                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1342            };
1343
1344        List<SCProductEntry> list = (List<SCProductEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1345                finderArgs, this);
1346
1347        if (list == null) {
1348            Session session = null;
1349
1350            try {
1351                session = openSession();
1352
1353                StringBuilder query = new StringBuilder();
1354
1355                query.append(
1356                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry ");
1357
1358                if (obc != null) {
1359                    query.append("ORDER BY ");
1360                    query.append(obc.getOrderBy());
1361                }
1362
1363                else {
1364                    query.append("ORDER BY ");
1365
1366                    query.append("modifiedDate DESC, ");
1367                    query.append("name DESC");
1368                }
1369
1370                Query q = session.createQuery(query.toString());
1371
1372                if (obc == null) {
1373                    list = (List<SCProductEntry>)QueryUtil.list(q,
1374                            getDialect(), start, end, false);
1375
1376                    Collections.sort(list);
1377                }
1378                else {
1379                    list = (List<SCProductEntry>)QueryUtil.list(q,
1380                            getDialect(), start, end);
1381                }
1382            }
1383            catch (Exception e) {
1384                throw processException(e);
1385            }
1386            finally {
1387                if (list == null) {
1388                    list = new ArrayList<SCProductEntry>();
1389                }
1390
1391                cacheResult(list);
1392
1393                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1394
1395                closeSession(session);
1396            }
1397        }
1398
1399        return list;
1400    }
1401
1402    public void removeByGroupId(long groupId) throws SystemException {
1403        for (SCProductEntry scProductEntry : findByGroupId(groupId)) {
1404            remove(scProductEntry);
1405        }
1406    }
1407
1408    public void removeByCompanyId(long companyId) throws SystemException {
1409        for (SCProductEntry scProductEntry : findByCompanyId(companyId)) {
1410            remove(scProductEntry);
1411        }
1412    }
1413
1414    public void removeByG_U(long groupId, long userId)
1415        throws SystemException {
1416        for (SCProductEntry scProductEntry : findByG_U(groupId, userId)) {
1417            remove(scProductEntry);
1418        }
1419    }
1420
1421    public void removeByRG_RA(String repoGroupId, String repoArtifactId)
1422        throws NoSuchProductEntryException, SystemException {
1423        SCProductEntry scProductEntry = findByRG_RA(repoGroupId, repoArtifactId);
1424
1425        remove(scProductEntry);
1426    }
1427
1428    public void removeAll() throws SystemException {
1429        for (SCProductEntry scProductEntry : findAll()) {
1430            remove(scProductEntry);
1431        }
1432    }
1433
1434    public int countByGroupId(long groupId) throws SystemException {
1435        Object[] finderArgs = new Object[] { new Long(groupId) };
1436
1437        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1438                finderArgs, this);
1439
1440        if (count == null) {
1441            Session session = null;
1442
1443            try {
1444                session = openSession();
1445
1446                StringBuilder query = new StringBuilder();
1447
1448                query.append("SELECT COUNT(*) ");
1449                query.append(
1450                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
1451
1452                query.append("groupId = ?");
1453
1454                query.append(" ");
1455
1456                Query q = session.createQuery(query.toString());
1457
1458                QueryPos qPos = QueryPos.getInstance(q);
1459
1460                qPos.add(groupId);
1461
1462                count = (Long)q.uniqueResult();
1463            }
1464            catch (Exception e) {
1465                throw processException(e);
1466            }
1467            finally {
1468                if (count == null) {
1469                    count = Long.valueOf(0);
1470                }
1471
1472                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1473                    finderArgs, count);
1474
1475                closeSession(session);
1476            }
1477        }
1478
1479        return count.intValue();
1480    }
1481
1482    public int countByCompanyId(long companyId) throws SystemException {
1483        Object[] finderArgs = new Object[] { new Long(companyId) };
1484
1485        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
1486                finderArgs, this);
1487
1488        if (count == null) {
1489            Session session = null;
1490
1491            try {
1492                session = openSession();
1493
1494                StringBuilder query = new StringBuilder();
1495
1496                query.append("SELECT COUNT(*) ");
1497                query.append(
1498                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
1499
1500                query.append("companyId = ?");
1501
1502                query.append(" ");
1503
1504                Query q = session.createQuery(query.toString());
1505
1506                QueryPos qPos = QueryPos.getInstance(q);
1507
1508                qPos.add(companyId);
1509
1510                count = (Long)q.uniqueResult();
1511            }
1512            catch (Exception e) {
1513                throw processException(e);
1514            }
1515            finally {
1516                if (count == null) {
1517                    count = Long.valueOf(0);
1518                }
1519
1520                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
1521                    finderArgs, count);
1522
1523                closeSession(session);
1524            }
1525        }
1526
1527        return count.intValue();
1528    }
1529
1530    public int countByG_U(long groupId, long userId) throws SystemException {
1531        Object[] finderArgs = new Object[] { new Long(groupId), new Long(userId) };
1532
1533        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
1534                finderArgs, this);
1535
1536        if (count == null) {
1537            Session session = null;
1538
1539            try {
1540                session = openSession();
1541
1542                StringBuilder query = new StringBuilder();
1543
1544                query.append("SELECT COUNT(*) ");
1545                query.append(
1546                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
1547
1548                query.append("groupId = ?");
1549
1550                query.append(" AND ");
1551
1552                query.append("userId = ?");
1553
1554                query.append(" ");
1555
1556                Query q = session.createQuery(query.toString());
1557
1558                QueryPos qPos = QueryPos.getInstance(q);
1559
1560                qPos.add(groupId);
1561
1562                qPos.add(userId);
1563
1564                count = (Long)q.uniqueResult();
1565            }
1566            catch (Exception e) {
1567                throw processException(e);
1568            }
1569            finally {
1570                if (count == null) {
1571                    count = Long.valueOf(0);
1572                }
1573
1574                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
1575                    count);
1576
1577                closeSession(session);
1578            }
1579        }
1580
1581        return count.intValue();
1582    }
1583
1584    public int countByRG_RA(String repoGroupId, String repoArtifactId)
1585        throws SystemException {
1586        Object[] finderArgs = new Object[] { repoGroupId, repoArtifactId };
1587
1588        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RG_RA,
1589                finderArgs, this);
1590
1591        if (count == null) {
1592            Session session = null;
1593
1594            try {
1595                session = openSession();
1596
1597                StringBuilder query = new StringBuilder();
1598
1599                query.append("SELECT COUNT(*) ");
1600                query.append(
1601                    "FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry WHERE ");
1602
1603                if (repoGroupId == null) {
1604                    query.append("repoGroupId IS NULL");
1605                }
1606                else {
1607                    query.append("lower(repoGroupId) = ?");
1608                }
1609
1610                query.append(" AND ");
1611
1612                if (repoArtifactId == null) {
1613                    query.append("repoArtifactId IS NULL");
1614                }
1615                else {
1616                    query.append("lower(repoArtifactId) = ?");
1617                }
1618
1619                query.append(" ");
1620
1621                Query q = session.createQuery(query.toString());
1622
1623                QueryPos qPos = QueryPos.getInstance(q);
1624
1625                if (repoGroupId != null) {
1626                    qPos.add(repoGroupId);
1627                }
1628
1629                if (repoArtifactId != null) {
1630                    qPos.add(repoArtifactId);
1631                }
1632
1633                count = (Long)q.uniqueResult();
1634            }
1635            catch (Exception e) {
1636                throw processException(e);
1637            }
1638            finally {
1639                if (count == null) {
1640                    count = Long.valueOf(0);
1641                }
1642
1643                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RG_RA,
1644                    finderArgs, count);
1645
1646                closeSession(session);
1647            }
1648        }
1649
1650        return count.intValue();
1651    }
1652
1653    public int countAll() throws SystemException {
1654        Object[] finderArgs = new Object[0];
1655
1656        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1657                finderArgs, this);
1658
1659        if (count == null) {
1660            Session session = null;
1661
1662            try {
1663                session = openSession();
1664
1665                Query q = session.createQuery(
1666                        "SELECT COUNT(*) FROM com.liferay.portlet.softwarecatalog.model.SCProductEntry");
1667
1668                count = (Long)q.uniqueResult();
1669            }
1670            catch (Exception e) {
1671                throw processException(e);
1672            }
1673            finally {
1674                if (count == null) {
1675                    count = Long.valueOf(0);
1676                }
1677
1678                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1679                    count);
1680
1681                closeSession(session);
1682            }
1683        }
1684
1685        return count.intValue();
1686    }
1687
1688    public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
1689        long pk) throws SystemException {
1690        return getSCLicenses(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
1691    }
1692
1693    public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
1694        long pk, int start, int end) throws SystemException {
1695        return getSCLicenses(pk, start, end, null);
1696    }
1697
1698    public static final FinderPath FINDER_PATH_GET_SCLICENSES = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
1699            SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
1700            "SCLicenses_SCProductEntries", "getSCLicenses",
1701            new String[] {
1702                Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
1703                "com.liferay.portal.kernel.util.OrderByComparator"
1704            });
1705
1706    public List<com.liferay.portlet.softwarecatalog.model.SCLicense> getSCLicenses(
1707        long pk, int start, int end, OrderByComparator obc)
1708        throws SystemException {
1709        Object[] finderArgs = new Object[] {
1710                new Long(pk), String.valueOf(start), String.valueOf(end),
1711                String.valueOf(obc)
1712            };
1713
1714        List<com.liferay.portlet.softwarecatalog.model.SCLicense> list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES,
1715                finderArgs, this);
1716
1717        if (list == null) {
1718            Session session = null;
1719
1720            try {
1721                session = openSession();
1722
1723                StringBuilder sb = new StringBuilder();
1724
1725                sb.append(_SQL_GETSCLICENSES);
1726
1727                if (obc != null) {
1728                    sb.append("ORDER BY ");
1729                    sb.append(obc.getOrderBy());
1730                }
1731
1732                else {
1733                    sb.append("ORDER BY ");
1734
1735                    sb.append("SCLicense.name ASC");
1736                }
1737
1738                String sql = sb.toString();
1739
1740                SQLQuery q = session.createSQLQuery(sql);
1741
1742                q.addEntity("SCLicense",
1743                    com.liferay.portlet.softwarecatalog.model.impl.SCLicenseImpl.class);
1744
1745                QueryPos qPos = QueryPos.getInstance(q);
1746
1747                qPos.add(pk);
1748
1749                list = (List<com.liferay.portlet.softwarecatalog.model.SCLicense>)QueryUtil.list(q,
1750                        getDialect(), start, end);
1751            }
1752            catch (Exception e) {
1753                throw processException(e);
1754            }
1755            finally {
1756                if (list == null) {
1757                    list = new ArrayList<com.liferay.portlet.softwarecatalog.model.SCLicense>();
1758                }
1759
1760                scLicensePersistence.cacheResult(list);
1761
1762                FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES,
1763                    finderArgs, list);
1764
1765                closeSession(session);
1766            }
1767        }
1768
1769        return list;
1770    }
1771
1772    public static final FinderPath FINDER_PATH_GET_SCLICENSES_SIZE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
1773            SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
1774            "SCLicenses_SCProductEntries", "getSCLicensesSize",
1775            new String[] { Long.class.getName() });
1776
1777    public int getSCLicensesSize(long pk) throws SystemException {
1778        Object[] finderArgs = new Object[] { new Long(pk) };
1779
1780        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_SCLICENSES_SIZE,
1781                finderArgs, this);
1782
1783        if (count == null) {
1784            Session session = null;
1785
1786            try {
1787                session = openSession();
1788
1789                SQLQuery q = session.createSQLQuery(_SQL_GETSCLICENSESSIZE);
1790
1791                q.addScalar(COUNT_COLUMN_NAME, Type.LONG);
1792
1793                QueryPos qPos = QueryPos.getInstance(q);
1794
1795                qPos.add(pk);
1796
1797                count = (Long)q.uniqueResult();
1798            }
1799            catch (Exception e) {
1800                throw processException(e);
1801            }
1802            finally {
1803                if (count == null) {
1804                    count = Long.valueOf(0);
1805                }
1806
1807                FinderCacheUtil.putResult(FINDER_PATH_GET_SCLICENSES_SIZE,
1808                    finderArgs, count);
1809
1810                closeSession(session);
1811            }
1812        }
1813
1814        return count.intValue();
1815    }
1816
1817    public static final FinderPath FINDER_PATH_CONTAINS_SCLICENSE = new FinderPath(com.liferay.portlet.softwarecatalog.model.impl.SCLicenseModelImpl.ENTITY_CACHE_ENABLED,
1818            SCProductEntryModelImpl.FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES,
1819            "SCLicenses_SCProductEntries", "containsSCLicense",
1820            new String[] { Long.class.getName(), Long.class.getName() });
1821
1822    public boolean containsSCLicense(long pk, long scLicensePK)
1823        throws SystemException {
1824        Object[] finderArgs = new Object[] { new Long(pk), new Long(scLicensePK) };
1825
1826        Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_SCLICENSE,
1827                finderArgs, this);
1828
1829        if (value == null) {
1830            try {
1831                value = Boolean.valueOf(containsSCLicense.contains(pk,
1832                            scLicensePK));
1833            }
1834            catch (Exception e) {
1835                throw processException(e);
1836            }
1837            finally {
1838                if (value == null) {
1839                    value = Boolean.FALSE;
1840                }
1841
1842                FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_SCLICENSE,
1843                    finderArgs, value);
1844            }
1845        }
1846
1847        return value.booleanValue();
1848    }
1849
1850    public boolean containsSCLicenses(long pk) throws SystemException {
1851        if (getSCLicensesSize(pk) > 0) {
1852            return true;
1853        }
1854        else {
1855            return false;
1856        }
1857    }
1858
1859    public void addSCLicense(long pk, long scLicensePK)
1860        throws SystemException {
1861        try {
1862            addSCLicense.add(pk, scLicensePK);
1863        }
1864        catch (Exception e) {
1865            throw processException(e);
1866        }
1867        finally {
1868            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1869        }
1870    }
1871
1872    public void addSCLicense(long pk,
1873        com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
1874        throws SystemException {
1875        try {
1876            addSCLicense.add(pk, scLicense.getPrimaryKey());
1877        }
1878        catch (Exception e) {
1879            throw processException(e);
1880        }
1881        finally {
1882            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1883        }
1884    }
1885
1886    public void addSCLicenses(long pk, long[] scLicensePKs)
1887        throws SystemException {
1888        try {
1889            for (long scLicensePK : scLicensePKs) {
1890                addSCLicense.add(pk, scLicensePK);
1891            }
1892        }
1893        catch (Exception e) {
1894            throw processException(e);
1895        }
1896        finally {
1897            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1898        }
1899    }
1900
1901    public void addSCLicenses(long pk,
1902        List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
1903        throws SystemException {
1904        try {
1905            for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
1906                addSCLicense.add(pk, scLicense.getPrimaryKey());
1907            }
1908        }
1909        catch (Exception e) {
1910            throw processException(e);
1911        }
1912        finally {
1913            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1914        }
1915    }
1916
1917    public void clearSCLicenses(long pk) throws SystemException {
1918        try {
1919            clearSCLicenses.clear(pk);
1920        }
1921        catch (Exception e) {
1922            throw processException(e);
1923        }
1924        finally {
1925            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1926        }
1927    }
1928
1929    public void removeSCLicense(long pk, long scLicensePK)
1930        throws SystemException {
1931        try {
1932            removeSCLicense.remove(pk, scLicensePK);
1933        }
1934        catch (Exception e) {
1935            throw processException(e);
1936        }
1937        finally {
1938            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1939        }
1940    }
1941
1942    public void removeSCLicense(long pk,
1943        com.liferay.portlet.softwarecatalog.model.SCLicense scLicense)
1944        throws SystemException {
1945        try {
1946            removeSCLicense.remove(pk, scLicense.getPrimaryKey());
1947        }
1948        catch (Exception e) {
1949            throw processException(e);
1950        }
1951        finally {
1952            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1953        }
1954    }
1955
1956    public void removeSCLicenses(long pk, long[] scLicensePKs)
1957        throws SystemException {
1958        try {
1959            for (long scLicensePK : scLicensePKs) {
1960                removeSCLicense.remove(pk, scLicensePK);
1961            }
1962        }
1963        catch (Exception e) {
1964            throw processException(e);
1965        }
1966        finally {
1967            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1968        }
1969    }
1970
1971    public void removeSCLicenses(long pk,
1972        List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
1973        throws SystemException {
1974        try {
1975            for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
1976                removeSCLicense.remove(pk, scLicense.getPrimaryKey());
1977            }
1978        }
1979        catch (Exception e) {
1980            throw processException(e);
1981        }
1982        finally {
1983            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
1984        }
1985    }
1986
1987    public void setSCLicenses(long pk, long[] scLicensePKs)
1988        throws SystemException {
1989        try {
1990            clearSCLicenses.clear(pk);
1991
1992            for (long scLicensePK : scLicensePKs) {
1993                addSCLicense.add(pk, scLicensePK);
1994            }
1995        }
1996        catch (Exception e) {
1997            throw processException(e);
1998        }
1999        finally {
2000            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
2001        }
2002    }
2003
2004    public void setSCLicenses(long pk,
2005        List<com.liferay.portlet.softwarecatalog.model.SCLicense> scLicenses)
2006        throws SystemException {
2007        try {
2008            clearSCLicenses.clear(pk);
2009
2010            for (com.liferay.portlet.softwarecatalog.model.SCLicense scLicense : scLicenses) {
2011                addSCLicense.add(pk, scLicense.getPrimaryKey());
2012            }
2013        }
2014        catch (Exception e) {
2015            throw processException(e);
2016        }
2017        finally {
2018            FinderCacheUtil.clearCache("SCLicenses_SCProductEntries");
2019        }
2020    }
2021
2022    public void afterPropertiesSet() {
2023        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2024                    com.liferay.portal.util.PropsUtil.get(
2025                        "value.object.listener.com.liferay.portlet.softwarecatalog.model.SCProductEntry")));
2026
2027        if (listenerClassNames.length > 0) {
2028            try {
2029                List<ModelListener<SCProductEntry>> listenersList = new ArrayList<ModelListener<SCProductEntry>>();
2030
2031                for (String listenerClassName : listenerClassNames) {
2032                    listenersList.add((ModelListener<SCProductEntry>)Class.forName(
2033                            listenerClassName).newInstance());
2034                }
2035
2036                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2037            }
2038            catch (Exception e) {
2039                _log.error(e);
2040            }
2041        }
2042
2043        containsSCLicense = new ContainsSCLicense(this);
2044
2045        addSCLicense = new AddSCLicense(this);
2046        clearSCLicenses = new ClearSCLicenses(this);
2047        removeSCLicense = new RemoveSCLicense(this);
2048    }
2049
2050    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCLicensePersistence.impl")
2051    protected com.liferay.portlet.softwarecatalog.service.persistence.SCLicensePersistence scLicensePersistence;
2052    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence.impl")
2053    protected com.liferay.portlet.softwarecatalog.service.persistence.SCFrameworkVersionPersistence scFrameworkVersionPersistence;
2054    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence.impl")
2055    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductEntryPersistence scProductEntryPersistence;
2056    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductScreenshotPersistence.impl")
2057    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductScreenshotPersistence scProductScreenshotPersistence;
2058    @BeanReference(name = "com.liferay.portlet.softwarecatalog.service.persistence.SCProductVersionPersistence.impl")
2059    protected com.liferay.portlet.softwarecatalog.service.persistence.SCProductVersionPersistence scProductVersionPersistence;
2060    @BeanReference(name = "com.liferay.portal.service.persistence.ImagePersistence.impl")
2061    protected com.liferay.portal.service.persistence.ImagePersistence imagePersistence;
2062    @BeanReference(name = "com.liferay.portal.service.persistence.ResourcePersistence.impl")
2063    protected com.liferay.portal.service.persistence.ResourcePersistence resourcePersistence;
2064    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
2065    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
2066    @BeanReference(name = "com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence.impl")
2067    protected com.liferay.portlet.messageboards.service.persistence.MBMessagePersistence mbMessagePersistence;
2068    @BeanReference(name = "com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence.impl")
2069    protected com.liferay.portlet.ratings.service.persistence.RatingsStatsPersistence ratingsStatsPersistence;
2070    protected ContainsSCLicense containsSCLicense;
2071    protected AddSCLicense addSCLicense;
2072    protected ClearSCLicenses clearSCLicenses;
2073    protected RemoveSCLicense removeSCLicense;
2074
2075    protected class ContainsSCLicense {
2076        protected ContainsSCLicense(
2077            SCProductEntryPersistenceImpl persistenceImpl) {
2078            super();
2079
2080            _mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
2081                    _SQL_CONTAINSSCLICENSE,
2082                    new int[] { Types.BIGINT, Types.BIGINT }, RowMapper.COUNT);
2083        }
2084
2085        protected boolean contains(long productEntryId, long licenseId) {
2086            List<Integer> results = _mappingSqlQuery.execute(new Object[] {
2087                        new Long(productEntryId), new Long(licenseId)
2088                    });
2089
2090            if (results.size() > 0) {
2091                Integer count = results.get(0);
2092
2093                if (count.intValue() > 0) {
2094                    return true;
2095                }
2096            }
2097
2098            return false;
2099        }
2100
2101        private MappingSqlQuery _mappingSqlQuery;
2102    }
2103
2104    protected class AddSCLicense {
2105        protected AddSCLicense(SCProductEntryPersistenceImpl persistenceImpl) {
2106            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2107                    "INSERT INTO SCLicenses_SCProductEntries (productEntryId, licenseId) VALUES (?, ?)",
2108                    new int[] { Types.BIGINT, Types.BIGINT });
2109            _persistenceImpl = persistenceImpl;
2110        }
2111
2112        protected void add(long productEntryId, long licenseId) {
2113            if (!_persistenceImpl.containsSCLicense.contains(productEntryId,
2114                        licenseId)) {
2115                _sqlUpdate.update(new Object[] {
2116                        new Long(productEntryId), new Long(licenseId)
2117                    });
2118            }
2119        }
2120
2121        private SqlUpdate _sqlUpdate;
2122        private SCProductEntryPersistenceImpl _persistenceImpl;
2123    }
2124
2125    protected class ClearSCLicenses {
2126        protected ClearSCLicenses(SCProductEntryPersistenceImpl persistenceImpl) {
2127            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2128                    "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?",
2129                    new int[] { Types.BIGINT });
2130        }
2131
2132        protected void clear(long productEntryId) {
2133            _sqlUpdate.update(new Object[] { new Long(productEntryId) });
2134        }
2135
2136        private SqlUpdate _sqlUpdate;
2137    }
2138
2139    protected class RemoveSCLicense {
2140        protected RemoveSCLicense(SCProductEntryPersistenceImpl persistenceImpl) {
2141            _sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(getDataSource(),
2142                    "DELETE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?",
2143                    new int[] { Types.BIGINT, Types.BIGINT });
2144        }
2145
2146        protected void remove(long productEntryId, long licenseId) {
2147            _sqlUpdate.update(new Object[] {
2148                    new Long(productEntryId), new Long(licenseId)
2149                });
2150        }
2151
2152        private SqlUpdate _sqlUpdate;
2153    }
2154
2155    private static final String _SQL_GETSCLICENSES = "SELECT {SCLicense.*} FROM SCLicense INNER JOIN SCLicenses_SCProductEntries ON (SCLicenses_SCProductEntries.licenseId = SCLicense.licenseId) WHERE (SCLicenses_SCProductEntries.productEntryId = ?)";
2156    private static final String _SQL_GETSCLICENSESSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ?";
2157    private static final String _SQL_CONTAINSSCLICENSE = "SELECT COUNT(*) AS COUNT_VALUE FROM SCLicenses_SCProductEntries WHERE productEntryId = ? AND licenseId = ?";
2158    private static Log _log = LogFactoryUtil.getLog(SCProductEntryPersistenceImpl.class);
2159}