001    /**
002     * Copyright (c) 2000-2010 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.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.NoSuchPortletItemException;
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.model.ModelListener;
039    import com.liferay.portal.model.PortletItem;
040    import com.liferay.portal.model.impl.PortletItemImpl;
041    import com.liferay.portal.model.impl.PortletItemModelImpl;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import java.io.Serializable;
045    
046    import java.util.ArrayList;
047    import java.util.Collections;
048    import java.util.List;
049    
050    /**
051     * The persistence implementation for the portlet item service.
052     *
053     * <p>
054     * Never modify or reference this class directly. Always use {@link PortletItemUtil} to access the portlet item persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
055     * </p>
056     *
057     * <p>
058     * Caching information and settings can be found in <code>portal.properties</code>
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see PortletItemPersistence
063     * @see PortletItemUtil
064     * @generated
065     */
066    public class PortletItemPersistenceImpl extends BasePersistenceImpl<PortletItem>
067            implements PortletItemPersistence {
068            public static final String FINDER_CLASS_NAME_ENTITY = PortletItemImpl.class.getName();
069            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
070                    ".List";
071            public static final FinderPath FINDER_PATH_FIND_BY_G_C = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
072                            PortletItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
073                            "findByG_C",
074                            new String[] {
075                                    Long.class.getName(), Long.class.getName(),
076                                    
077                            "java.lang.Integer", "java.lang.Integer",
078                                    "com.liferay.portal.kernel.util.OrderByComparator"
079                            });
080            public static final FinderPath FINDER_PATH_COUNT_BY_G_C = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
081                            PortletItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
082                            "countByG_C",
083                            new String[] { Long.class.getName(), Long.class.getName() });
084            public static final FinderPath FINDER_PATH_FIND_BY_G_P_C = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
085                            PortletItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
086                            "findByG_P_C",
087                            new String[] {
088                                    Long.class.getName(), String.class.getName(),
089                                    Long.class.getName(),
090                                    
091                            "java.lang.Integer", "java.lang.Integer",
092                                    "com.liferay.portal.kernel.util.OrderByComparator"
093                            });
094            public static final FinderPath FINDER_PATH_COUNT_BY_G_P_C = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
095                            PortletItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
096                            "countByG_P_C",
097                            new String[] {
098                                    Long.class.getName(), String.class.getName(),
099                                    Long.class.getName()
100                            });
101            public static final FinderPath FINDER_PATH_FETCH_BY_G_N_P_C = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
102                            PortletItemModelImpl.FINDER_CACHE_ENABLED,
103                            FINDER_CLASS_NAME_ENTITY, "fetchByG_N_P_C",
104                            new String[] {
105                                    Long.class.getName(), String.class.getName(),
106                                    String.class.getName(), Long.class.getName()
107                            });
108            public static final FinderPath FINDER_PATH_COUNT_BY_G_N_P_C = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
109                            PortletItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
110                            "countByG_N_P_C",
111                            new String[] {
112                                    Long.class.getName(), String.class.getName(),
113                                    String.class.getName(), Long.class.getName()
114                            });
115            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
116                            PortletItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
117                            "findAll", new String[0]);
118            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
119                            PortletItemModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
120                            "countAll", new String[0]);
121    
122            /**
123             * Caches the portlet item in the entity cache if it is enabled.
124             *
125             * @param portletItem the portlet item to cache
126             */
127            public void cacheResult(PortletItem portletItem) {
128                    EntityCacheUtil.putResult(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
129                            PortletItemImpl.class, portletItem.getPrimaryKey(), portletItem);
130    
131                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N_P_C,
132                            new Object[] {
133                                    new Long(portletItem.getGroupId()),
134                                    
135                            portletItem.getName(),
136                                    
137                            portletItem.getPortletId(), new Long(portletItem.getClassNameId())
138                            }, portletItem);
139            }
140    
141            /**
142             * Caches the portlet items in the entity cache if it is enabled.
143             *
144             * @param portletItems the portlet items to cache
145             */
146            public void cacheResult(List<PortletItem> portletItems) {
147                    for (PortletItem portletItem : portletItems) {
148                            if (EntityCacheUtil.getResult(
149                                                    PortletItemModelImpl.ENTITY_CACHE_ENABLED,
150                                                    PortletItemImpl.class, portletItem.getPrimaryKey(), this) == null) {
151                                    cacheResult(portletItem);
152                            }
153                    }
154            }
155    
156            /**
157             * Clears the cache for all portlet items.
158             *
159             * <p>
160             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
161             * </p>
162             */
163            public void clearCache() {
164                    CacheRegistryUtil.clear(PortletItemImpl.class.getName());
165                    EntityCacheUtil.clearCache(PortletItemImpl.class.getName());
166                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
167                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
168            }
169    
170            /**
171             * Clears the cache for the portlet item.
172             *
173             * <p>
174             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
175             * </p>
176             */
177            public void clearCache(PortletItem portletItem) {
178                    EntityCacheUtil.removeResult(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
179                            PortletItemImpl.class, portletItem.getPrimaryKey());
180    
181                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N_P_C,
182                            new Object[] {
183                                    new Long(portletItem.getGroupId()),
184                                    
185                            portletItem.getName(),
186                                    
187                            portletItem.getPortletId(), new Long(portletItem.getClassNameId())
188                            });
189            }
190    
191            /**
192             * Creates a new portlet item with the primary key. Does not add the portlet item to the database.
193             *
194             * @param portletItemId the primary key for the new portlet item
195             * @return the new portlet item
196             */
197            public PortletItem create(long portletItemId) {
198                    PortletItem portletItem = new PortletItemImpl();
199    
200                    portletItem.setNew(true);
201                    portletItem.setPrimaryKey(portletItemId);
202    
203                    return portletItem;
204            }
205    
206            /**
207             * Removes the portlet item with the primary key from the database. Also notifies the appropriate model listeners.
208             *
209             * @param primaryKey the primary key of the portlet item to remove
210             * @return the portlet item that was removed
211             * @throws com.liferay.portal.NoSuchModelException if a portlet item with the primary key could not be found
212             * @throws SystemException if a system exception occurred
213             */
214            public PortletItem remove(Serializable primaryKey)
215                    throws NoSuchModelException, SystemException {
216                    return remove(((Long)primaryKey).longValue());
217            }
218    
219            /**
220             * Removes the portlet item with the primary key from the database. Also notifies the appropriate model listeners.
221             *
222             * @param portletItemId the primary key of the portlet item to remove
223             * @return the portlet item that was removed
224             * @throws com.liferay.portal.NoSuchPortletItemException if a portlet item with the primary key could not be found
225             * @throws SystemException if a system exception occurred
226             */
227            public PortletItem remove(long portletItemId)
228                    throws NoSuchPortletItemException, SystemException {
229                    Session session = null;
230    
231                    try {
232                            session = openSession();
233    
234                            PortletItem portletItem = (PortletItem)session.get(PortletItemImpl.class,
235                                            new Long(portletItemId));
236    
237                            if (portletItem == null) {
238                                    if (_log.isWarnEnabled()) {
239                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + portletItemId);
240                                    }
241    
242                                    throw new NoSuchPortletItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
243                                            portletItemId);
244                            }
245    
246                            return remove(portletItem);
247                    }
248                    catch (NoSuchPortletItemException nsee) {
249                            throw nsee;
250                    }
251                    catch (Exception e) {
252                            throw processException(e);
253                    }
254                    finally {
255                            closeSession(session);
256                    }
257            }
258    
259            protected PortletItem removeImpl(PortletItem portletItem)
260                    throws SystemException {
261                    portletItem = toUnwrappedModel(portletItem);
262    
263                    Session session = null;
264    
265                    try {
266                            session = openSession();
267    
268                            if (portletItem.isCachedModel() || BatchSessionUtil.isEnabled()) {
269                                    Object staleObject = session.get(PortletItemImpl.class,
270                                                    portletItem.getPrimaryKeyObj());
271    
272                                    if (staleObject != null) {
273                                            session.evict(staleObject);
274                                    }
275                            }
276    
277                            session.delete(portletItem);
278    
279                            session.flush();
280                    }
281                    catch (Exception e) {
282                            throw processException(e);
283                    }
284                    finally {
285                            closeSession(session);
286                    }
287    
288                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
289    
290                    PortletItemModelImpl portletItemModelImpl = (PortletItemModelImpl)portletItem;
291    
292                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N_P_C,
293                            new Object[] {
294                                    new Long(portletItemModelImpl.getOriginalGroupId()),
295                                    
296                            portletItemModelImpl.getOriginalName(),
297                                    
298                            portletItemModelImpl.getOriginalPortletId(),
299                                    new Long(portletItemModelImpl.getOriginalClassNameId())
300                            });
301    
302                    EntityCacheUtil.removeResult(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
303                            PortletItemImpl.class, portletItem.getPrimaryKey());
304    
305                    return portletItem;
306            }
307    
308            public PortletItem updateImpl(
309                    com.liferay.portal.model.PortletItem portletItem, boolean merge)
310                    throws SystemException {
311                    portletItem = toUnwrappedModel(portletItem);
312    
313                    boolean isNew = portletItem.isNew();
314    
315                    PortletItemModelImpl portletItemModelImpl = (PortletItemModelImpl)portletItem;
316    
317                    Session session = null;
318    
319                    try {
320                            session = openSession();
321    
322                            BatchSessionUtil.update(session, portletItem, merge);
323    
324                            portletItem.setNew(false);
325                    }
326                    catch (Exception e) {
327                            throw processException(e);
328                    }
329                    finally {
330                            closeSession(session);
331                    }
332    
333                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
334    
335                    EntityCacheUtil.putResult(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
336                            PortletItemImpl.class, portletItem.getPrimaryKey(), portletItem);
337    
338                    if (!isNew &&
339                                    ((portletItem.getGroupId() != portletItemModelImpl.getOriginalGroupId()) ||
340                                    !Validator.equals(portletItem.getName(),
341                                            portletItemModelImpl.getOriginalName()) ||
342                                    !Validator.equals(portletItem.getPortletId(),
343                                            portletItemModelImpl.getOriginalPortletId()) ||
344                                    (portletItem.getClassNameId() != portletItemModelImpl.getOriginalClassNameId()))) {
345                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_N_P_C,
346                                    new Object[] {
347                                            new Long(portletItemModelImpl.getOriginalGroupId()),
348                                            
349                                    portletItemModelImpl.getOriginalName(),
350                                            
351                                    portletItemModelImpl.getOriginalPortletId(),
352                                            new Long(portletItemModelImpl.getOriginalClassNameId())
353                                    });
354                    }
355    
356                    if (isNew ||
357                                    ((portletItem.getGroupId() != portletItemModelImpl.getOriginalGroupId()) ||
358                                    !Validator.equals(portletItem.getName(),
359                                            portletItemModelImpl.getOriginalName()) ||
360                                    !Validator.equals(portletItem.getPortletId(),
361                                            portletItemModelImpl.getOriginalPortletId()) ||
362                                    (portletItem.getClassNameId() != portletItemModelImpl.getOriginalClassNameId()))) {
363                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N_P_C,
364                                    new Object[] {
365                                            new Long(portletItem.getGroupId()),
366                                            
367                                    portletItem.getName(),
368                                            
369                                    portletItem.getPortletId(),
370                                            new Long(portletItem.getClassNameId())
371                                    }, portletItem);
372                    }
373    
374                    return portletItem;
375            }
376    
377            protected PortletItem toUnwrappedModel(PortletItem portletItem) {
378                    if (portletItem instanceof PortletItemImpl) {
379                            return portletItem;
380                    }
381    
382                    PortletItemImpl portletItemImpl = new PortletItemImpl();
383    
384                    portletItemImpl.setNew(portletItem.isNew());
385                    portletItemImpl.setPrimaryKey(portletItem.getPrimaryKey());
386    
387                    portletItemImpl.setPortletItemId(portletItem.getPortletItemId());
388                    portletItemImpl.setGroupId(portletItem.getGroupId());
389                    portletItemImpl.setCompanyId(portletItem.getCompanyId());
390                    portletItemImpl.setUserId(portletItem.getUserId());
391                    portletItemImpl.setUserName(portletItem.getUserName());
392                    portletItemImpl.setCreateDate(portletItem.getCreateDate());
393                    portletItemImpl.setModifiedDate(portletItem.getModifiedDate());
394                    portletItemImpl.setName(portletItem.getName());
395                    portletItemImpl.setPortletId(portletItem.getPortletId());
396                    portletItemImpl.setClassNameId(portletItem.getClassNameId());
397    
398                    return portletItemImpl;
399            }
400    
401            /**
402             * Finds the portlet item with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
403             *
404             * @param primaryKey the primary key of the portlet item to find
405             * @return the portlet item
406             * @throws com.liferay.portal.NoSuchModelException if a portlet item with the primary key could not be found
407             * @throws SystemException if a system exception occurred
408             */
409            public PortletItem findByPrimaryKey(Serializable primaryKey)
410                    throws NoSuchModelException, SystemException {
411                    return findByPrimaryKey(((Long)primaryKey).longValue());
412            }
413    
414            /**
415             * Finds the portlet item with the primary key or throws a {@link com.liferay.portal.NoSuchPortletItemException} if it could not be found.
416             *
417             * @param portletItemId the primary key of the portlet item to find
418             * @return the portlet item
419             * @throws com.liferay.portal.NoSuchPortletItemException if a portlet item with the primary key could not be found
420             * @throws SystemException if a system exception occurred
421             */
422            public PortletItem findByPrimaryKey(long portletItemId)
423                    throws NoSuchPortletItemException, SystemException {
424                    PortletItem portletItem = fetchByPrimaryKey(portletItemId);
425    
426                    if (portletItem == null) {
427                            if (_log.isWarnEnabled()) {
428                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + portletItemId);
429                            }
430    
431                            throw new NoSuchPortletItemException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
432                                    portletItemId);
433                    }
434    
435                    return portletItem;
436            }
437    
438            /**
439             * Finds the portlet item with the primary key or returns <code>null</code> if it could not be found.
440             *
441             * @param primaryKey the primary key of the portlet item to find
442             * @return the portlet item, or <code>null</code> if a portlet item with the primary key could not be found
443             * @throws SystemException if a system exception occurred
444             */
445            public PortletItem fetchByPrimaryKey(Serializable primaryKey)
446                    throws SystemException {
447                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
448            }
449    
450            /**
451             * Finds the portlet item with the primary key or returns <code>null</code> if it could not be found.
452             *
453             * @param portletItemId the primary key of the portlet item to find
454             * @return the portlet item, or <code>null</code> if a portlet item with the primary key could not be found
455             * @throws SystemException if a system exception occurred
456             */
457            public PortletItem fetchByPrimaryKey(long portletItemId)
458                    throws SystemException {
459                    PortletItem portletItem = (PortletItem)EntityCacheUtil.getResult(PortletItemModelImpl.ENTITY_CACHE_ENABLED,
460                                    PortletItemImpl.class, portletItemId, this);
461    
462                    if (portletItem == null) {
463                            Session session = null;
464    
465                            try {
466                                    session = openSession();
467    
468                                    portletItem = (PortletItem)session.get(PortletItemImpl.class,
469                                                    new Long(portletItemId));
470                            }
471                            catch (Exception e) {
472                                    throw processException(e);
473                            }
474                            finally {
475                                    if (portletItem != null) {
476                                            cacheResult(portletItem);
477                                    }
478    
479                                    closeSession(session);
480                            }
481                    }
482    
483                    return portletItem;
484            }
485    
486            /**
487             * Finds all the portlet items where groupId = &#63; and classNameId = &#63;.
488             *
489             * @param groupId the group id to search with
490             * @param classNameId the class name id to search with
491             * @return the matching portlet items
492             * @throws SystemException if a system exception occurred
493             */
494            public List<PortletItem> findByG_C(long groupId, long classNameId)
495                    throws SystemException {
496                    return findByG_C(groupId, classNameId, QueryUtil.ALL_POS,
497                            QueryUtil.ALL_POS, null);
498            }
499    
500            /**
501             * Finds a range of all the portlet items where groupId = &#63; and classNameId = &#63;.
502             *
503             * <p>
504             * 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.
505             * </p>
506             *
507             * @param groupId the group id to search with
508             * @param classNameId the class name id to search with
509             * @param start the lower bound of the range of portlet items to return
510             * @param end the upper bound of the range of portlet items to return (not inclusive)
511             * @return the range of matching portlet items
512             * @throws SystemException if a system exception occurred
513             */
514            public List<PortletItem> findByG_C(long groupId, long classNameId,
515                    int start, int end) throws SystemException {
516                    return findByG_C(groupId, classNameId, start, end, null);
517            }
518    
519            /**
520             * Finds an ordered range of all the portlet items where groupId = &#63; and classNameId = &#63;.
521             *
522             * <p>
523             * 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.
524             * </p>
525             *
526             * @param groupId the group id to search with
527             * @param classNameId the class name id to search with
528             * @param start the lower bound of the range of portlet items to return
529             * @param end the upper bound of the range of portlet items to return (not inclusive)
530             * @param orderByComparator the comparator to order the results by
531             * @return the ordered range of matching portlet items
532             * @throws SystemException if a system exception occurred
533             */
534            public List<PortletItem> findByG_C(long groupId, long classNameId,
535                    int start, int end, OrderByComparator orderByComparator)
536                    throws SystemException {
537                    Object[] finderArgs = new Object[] {
538                                    groupId, classNameId,
539                                    
540                                    String.valueOf(start), String.valueOf(end),
541                                    String.valueOf(orderByComparator)
542                            };
543    
544                    List<PortletItem> list = (List<PortletItem>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_C,
545                                    finderArgs, this);
546    
547                    if (list == null) {
548                            Session session = null;
549    
550                            try {
551                                    session = openSession();
552    
553                                    StringBundler query = null;
554    
555                                    if (orderByComparator != null) {
556                                            query = new StringBundler(4 +
557                                                            (orderByComparator.getOrderByFields().length * 3));
558                                    }
559                                    else {
560                                            query = new StringBundler(3);
561                                    }
562    
563                                    query.append(_SQL_SELECT_PORTLETITEM_WHERE);
564    
565                                    query.append(_FINDER_COLUMN_G_C_GROUPID_2);
566    
567                                    query.append(_FINDER_COLUMN_G_C_CLASSNAMEID_2);
568    
569                                    if (orderByComparator != null) {
570                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
571                                                    orderByComparator);
572                                    }
573    
574                                    String sql = query.toString();
575    
576                                    Query q = session.createQuery(sql);
577    
578                                    QueryPos qPos = QueryPos.getInstance(q);
579    
580                                    qPos.add(groupId);
581    
582                                    qPos.add(classNameId);
583    
584                                    list = (List<PortletItem>)QueryUtil.list(q, getDialect(),
585                                                    start, end);
586                            }
587                            catch (Exception e) {
588                                    throw processException(e);
589                            }
590                            finally {
591                                    if (list == null) {
592                                            list = new ArrayList<PortletItem>();
593                                    }
594    
595                                    cacheResult(list);
596    
597                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_C, finderArgs,
598                                            list);
599    
600                                    closeSession(session);
601                            }
602                    }
603    
604                    return list;
605            }
606    
607            /**
608             * Finds the first portlet item in the ordered set where groupId = &#63; and classNameId = &#63;.
609             *
610             * <p>
611             * 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.
612             * </p>
613             *
614             * @param groupId the group id to search with
615             * @param classNameId the class name id to search with
616             * @param orderByComparator the comparator to order the set by
617             * @return the first matching portlet item
618             * @throws com.liferay.portal.NoSuchPortletItemException if a matching portlet item could not be found
619             * @throws SystemException if a system exception occurred
620             */
621            public PortletItem findByG_C_First(long groupId, long classNameId,
622                    OrderByComparator orderByComparator)
623                    throws NoSuchPortletItemException, SystemException {
624                    List<PortletItem> list = findByG_C(groupId, classNameId, 0, 1,
625                                    orderByComparator);
626    
627                    if (list.isEmpty()) {
628                            StringBundler msg = new StringBundler(6);
629    
630                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
631    
632                            msg.append("groupId=");
633                            msg.append(groupId);
634    
635                            msg.append(", classNameId=");
636                            msg.append(classNameId);
637    
638                            msg.append(StringPool.CLOSE_CURLY_BRACE);
639    
640                            throw new NoSuchPortletItemException(msg.toString());
641                    }
642                    else {
643                            return list.get(0);
644                    }
645            }
646    
647            /**
648             * Finds the last portlet item in the ordered set where groupId = &#63; and classNameId = &#63;.
649             *
650             * <p>
651             * 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.
652             * </p>
653             *
654             * @param groupId the group id to search with
655             * @param classNameId the class name id to search with
656             * @param orderByComparator the comparator to order the set by
657             * @return the last matching portlet item
658             * @throws com.liferay.portal.NoSuchPortletItemException if a matching portlet item could not be found
659             * @throws SystemException if a system exception occurred
660             */
661            public PortletItem findByG_C_Last(long groupId, long classNameId,
662                    OrderByComparator orderByComparator)
663                    throws NoSuchPortletItemException, SystemException {
664                    int count = countByG_C(groupId, classNameId);
665    
666                    List<PortletItem> list = findByG_C(groupId, classNameId, count - 1,
667                                    count, orderByComparator);
668    
669                    if (list.isEmpty()) {
670                            StringBundler msg = new StringBundler(6);
671    
672                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
673    
674                            msg.append("groupId=");
675                            msg.append(groupId);
676    
677                            msg.append(", classNameId=");
678                            msg.append(classNameId);
679    
680                            msg.append(StringPool.CLOSE_CURLY_BRACE);
681    
682                            throw new NoSuchPortletItemException(msg.toString());
683                    }
684                    else {
685                            return list.get(0);
686                    }
687            }
688    
689            /**
690             * Finds the portlet items before and after the current portlet item in the ordered set where groupId = &#63; and classNameId = &#63;.
691             *
692             * <p>
693             * 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.
694             * </p>
695             *
696             * @param portletItemId the primary key of the current portlet item
697             * @param groupId the group id to search with
698             * @param classNameId the class name id to search with
699             * @param orderByComparator the comparator to order the set by
700             * @return the previous, current, and next portlet item
701             * @throws com.liferay.portal.NoSuchPortletItemException if a portlet item with the primary key could not be found
702             * @throws SystemException if a system exception occurred
703             */
704            public PortletItem[] findByG_C_PrevAndNext(long portletItemId,
705                    long groupId, long classNameId, OrderByComparator orderByComparator)
706                    throws NoSuchPortletItemException, SystemException {
707                    PortletItem portletItem = findByPrimaryKey(portletItemId);
708    
709                    Session session = null;
710    
711                    try {
712                            session = openSession();
713    
714                            PortletItem[] array = new PortletItemImpl[3];
715    
716                            array[0] = getByG_C_PrevAndNext(session, portletItem, groupId,
717                                            classNameId, orderByComparator, true);
718    
719                            array[1] = portletItem;
720    
721                            array[2] = getByG_C_PrevAndNext(session, portletItem, groupId,
722                                            classNameId, orderByComparator, false);
723    
724                            return array;
725                    }
726                    catch (Exception e) {
727                            throw processException(e);
728                    }
729                    finally {
730                            closeSession(session);
731                    }
732            }
733    
734            protected PortletItem getByG_C_PrevAndNext(Session session,
735                    PortletItem portletItem, long groupId, long classNameId,
736                    OrderByComparator orderByComparator, boolean previous) {
737                    StringBundler query = null;
738    
739                    if (orderByComparator != null) {
740                            query = new StringBundler(6 +
741                                            (orderByComparator.getOrderByFields().length * 6));
742                    }
743                    else {
744                            query = new StringBundler(3);
745                    }
746    
747                    query.append(_SQL_SELECT_PORTLETITEM_WHERE);
748    
749                    query.append(_FINDER_COLUMN_G_C_GROUPID_2);
750    
751                    query.append(_FINDER_COLUMN_G_C_CLASSNAMEID_2);
752    
753                    if (orderByComparator != null) {
754                            String[] orderByFields = orderByComparator.getOrderByFields();
755    
756                            if (orderByFields.length > 0) {
757                                    query.append(WHERE_AND);
758                            }
759    
760                            for (int i = 0; i < orderByFields.length; i++) {
761                                    query.append(_ORDER_BY_ENTITY_ALIAS);
762                                    query.append(orderByFields[i]);
763    
764                                    if ((i + 1) < orderByFields.length) {
765                                            if (orderByComparator.isAscending() ^ previous) {
766                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
767                                            }
768                                            else {
769                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
770                                            }
771                                    }
772                                    else {
773                                            if (orderByComparator.isAscending() ^ previous) {
774                                                    query.append(WHERE_GREATER_THAN);
775                                            }
776                                            else {
777                                                    query.append(WHERE_LESSER_THAN);
778                                            }
779                                    }
780                            }
781    
782                            query.append(ORDER_BY_CLAUSE);
783    
784                            for (int i = 0; i < orderByFields.length; i++) {
785                                    query.append(_ORDER_BY_ENTITY_ALIAS);
786                                    query.append(orderByFields[i]);
787    
788                                    if ((i + 1) < orderByFields.length) {
789                                            if (orderByComparator.isAscending() ^ previous) {
790                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
791                                            }
792                                            else {
793                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
794                                            }
795                                    }
796                                    else {
797                                            if (orderByComparator.isAscending() ^ previous) {
798                                                    query.append(ORDER_BY_ASC);
799                                            }
800                                            else {
801                                                    query.append(ORDER_BY_DESC);
802                                            }
803                                    }
804                            }
805                    }
806    
807                    String sql = query.toString();
808    
809                    Query q = session.createQuery(sql);
810    
811                    q.setFirstResult(0);
812                    q.setMaxResults(2);
813    
814                    QueryPos qPos = QueryPos.getInstance(q);
815    
816                    qPos.add(groupId);
817    
818                    qPos.add(classNameId);
819    
820                    if (orderByComparator != null) {
821                            Object[] values = orderByComparator.getOrderByValues(portletItem);
822    
823                            for (Object value : values) {
824                                    qPos.add(value);
825                            }
826                    }
827    
828                    List<PortletItem> list = q.list();
829    
830                    if (list.size() == 2) {
831                            return list.get(1);
832                    }
833                    else {
834                            return null;
835                    }
836            }
837    
838            /**
839             * Finds all the portlet items where groupId = &#63; and portletId = &#63; and classNameId = &#63;.
840             *
841             * @param groupId the group id to search with
842             * @param portletId the portlet id to search with
843             * @param classNameId the class name id to search with
844             * @return the matching portlet items
845             * @throws SystemException if a system exception occurred
846             */
847            public List<PortletItem> findByG_P_C(long groupId, String portletId,
848                    long classNameId) throws SystemException {
849                    return findByG_P_C(groupId, portletId, classNameId, QueryUtil.ALL_POS,
850                            QueryUtil.ALL_POS, null);
851            }
852    
853            /**
854             * Finds a range of all the portlet items where groupId = &#63; and portletId = &#63; and classNameId = &#63;.
855             *
856             * <p>
857             * 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.
858             * </p>
859             *
860             * @param groupId the group id to search with
861             * @param portletId the portlet id to search with
862             * @param classNameId the class name id to search with
863             * @param start the lower bound of the range of portlet items to return
864             * @param end the upper bound of the range of portlet items to return (not inclusive)
865             * @return the range of matching portlet items
866             * @throws SystemException if a system exception occurred
867             */
868            public List<PortletItem> findByG_P_C(long groupId, String portletId,
869                    long classNameId, int start, int end) throws SystemException {
870                    return findByG_P_C(groupId, portletId, classNameId, start, end, null);
871            }
872    
873            /**
874             * Finds an ordered range of all the portlet items where groupId = &#63; and portletId = &#63; and classNameId = &#63;.
875             *
876             * <p>
877             * 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.
878             * </p>
879             *
880             * @param groupId the group id to search with
881             * @param portletId the portlet id to search with
882             * @param classNameId the class name id to search with
883             * @param start the lower bound of the range of portlet items to return
884             * @param end the upper bound of the range of portlet items to return (not inclusive)
885             * @param orderByComparator the comparator to order the results by
886             * @return the ordered range of matching portlet items
887             * @throws SystemException if a system exception occurred
888             */
889            public List<PortletItem> findByG_P_C(long groupId, String portletId,
890                    long classNameId, int start, int end,
891                    OrderByComparator orderByComparator) throws SystemException {
892                    Object[] finderArgs = new Object[] {
893                                    groupId, portletId, classNameId,
894                                    
895                                    String.valueOf(start), String.valueOf(end),
896                                    String.valueOf(orderByComparator)
897                            };
898    
899                    List<PortletItem> list = (List<PortletItem>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_P_C,
900                                    finderArgs, this);
901    
902                    if (list == null) {
903                            Session session = null;
904    
905                            try {
906                                    session = openSession();
907    
908                                    StringBundler query = null;
909    
910                                    if (orderByComparator != null) {
911                                            query = new StringBundler(5 +
912                                                            (orderByComparator.getOrderByFields().length * 3));
913                                    }
914                                    else {
915                                            query = new StringBundler(4);
916                                    }
917    
918                                    query.append(_SQL_SELECT_PORTLETITEM_WHERE);
919    
920                                    query.append(_FINDER_COLUMN_G_P_C_GROUPID_2);
921    
922                                    if (portletId == null) {
923                                            query.append(_FINDER_COLUMN_G_P_C_PORTLETID_1);
924                                    }
925                                    else {
926                                            if (portletId.equals(StringPool.BLANK)) {
927                                                    query.append(_FINDER_COLUMN_G_P_C_PORTLETID_3);
928                                            }
929                                            else {
930                                                    query.append(_FINDER_COLUMN_G_P_C_PORTLETID_2);
931                                            }
932                                    }
933    
934                                    query.append(_FINDER_COLUMN_G_P_C_CLASSNAMEID_2);
935    
936                                    if (orderByComparator != null) {
937                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
938                                                    orderByComparator);
939                                    }
940    
941                                    String sql = query.toString();
942    
943                                    Query q = session.createQuery(sql);
944    
945                                    QueryPos qPos = QueryPos.getInstance(q);
946    
947                                    qPos.add(groupId);
948    
949                                    if (portletId != null) {
950                                            qPos.add(portletId);
951                                    }
952    
953                                    qPos.add(classNameId);
954    
955                                    list = (List<PortletItem>)QueryUtil.list(q, getDialect(),
956                                                    start, end);
957                            }
958                            catch (Exception e) {
959                                    throw processException(e);
960                            }
961                            finally {
962                                    if (list == null) {
963                                            list = new ArrayList<PortletItem>();
964                                    }
965    
966                                    cacheResult(list);
967    
968                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_P_C,
969                                            finderArgs, list);
970    
971                                    closeSession(session);
972                            }
973                    }
974    
975                    return list;
976            }
977    
978            /**
979             * Finds the first portlet item in the ordered set where groupId = &#63; and portletId = &#63; and classNameId = &#63;.
980             *
981             * <p>
982             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
983             * </p>
984             *
985             * @param groupId the group id to search with
986             * @param portletId the portlet id to search with
987             * @param classNameId the class name id to search with
988             * @param orderByComparator the comparator to order the set by
989             * @return the first matching portlet item
990             * @throws com.liferay.portal.NoSuchPortletItemException if a matching portlet item could not be found
991             * @throws SystemException if a system exception occurred
992             */
993            public PortletItem findByG_P_C_First(long groupId, String portletId,
994                    long classNameId, OrderByComparator orderByComparator)
995                    throws NoSuchPortletItemException, SystemException {
996                    List<PortletItem> list = findByG_P_C(groupId, portletId, classNameId,
997                                    0, 1, orderByComparator);
998    
999                    if (list.isEmpty()) {
1000                            StringBundler msg = new StringBundler(8);
1001    
1002                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1003    
1004                            msg.append("groupId=");
1005                            msg.append(groupId);
1006    
1007                            msg.append(", portletId=");
1008                            msg.append(portletId);
1009    
1010                            msg.append(", classNameId=");
1011                            msg.append(classNameId);
1012    
1013                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1014    
1015                            throw new NoSuchPortletItemException(msg.toString());
1016                    }
1017                    else {
1018                            return list.get(0);
1019                    }
1020            }
1021    
1022            /**
1023             * Finds the last portlet item in the ordered set where groupId = &#63; and portletId = &#63; and classNameId = &#63;.
1024             *
1025             * <p>
1026             * 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.
1027             * </p>
1028             *
1029             * @param groupId the group id to search with
1030             * @param portletId the portlet id to search with
1031             * @param classNameId the class name id to search with
1032             * @param orderByComparator the comparator to order the set by
1033             * @return the last matching portlet item
1034             * @throws com.liferay.portal.NoSuchPortletItemException if a matching portlet item could not be found
1035             * @throws SystemException if a system exception occurred
1036             */
1037            public PortletItem findByG_P_C_Last(long groupId, String portletId,
1038                    long classNameId, OrderByComparator orderByComparator)
1039                    throws NoSuchPortletItemException, SystemException {
1040                    int count = countByG_P_C(groupId, portletId, classNameId);
1041    
1042                    List<PortletItem> list = findByG_P_C(groupId, portletId, classNameId,
1043                                    count - 1, count, orderByComparator);
1044    
1045                    if (list.isEmpty()) {
1046                            StringBundler msg = new StringBundler(8);
1047    
1048                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1049    
1050                            msg.append("groupId=");
1051                            msg.append(groupId);
1052    
1053                            msg.append(", portletId=");
1054                            msg.append(portletId);
1055    
1056                            msg.append(", classNameId=");
1057                            msg.append(classNameId);
1058    
1059                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1060    
1061                            throw new NoSuchPortletItemException(msg.toString());
1062                    }
1063                    else {
1064                            return list.get(0);
1065                    }
1066            }
1067    
1068            /**
1069             * Finds the portlet items before and after the current portlet item in the ordered set where groupId = &#63; and portletId = &#63; and classNameId = &#63;.
1070             *
1071             * <p>
1072             * 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.
1073             * </p>
1074             *
1075             * @param portletItemId the primary key of the current portlet item
1076             * @param groupId the group id to search with
1077             * @param portletId the portlet id to search with
1078             * @param classNameId the class name id to search with
1079             * @param orderByComparator the comparator to order the set by
1080             * @return the previous, current, and next portlet item
1081             * @throws com.liferay.portal.NoSuchPortletItemException if a portlet item with the primary key could not be found
1082             * @throws SystemException if a system exception occurred
1083             */
1084            public PortletItem[] findByG_P_C_PrevAndNext(long portletItemId,
1085                    long groupId, String portletId, long classNameId,
1086                    OrderByComparator orderByComparator)
1087                    throws NoSuchPortletItemException, SystemException {
1088                    PortletItem portletItem = findByPrimaryKey(portletItemId);
1089    
1090                    Session session = null;
1091    
1092                    try {
1093                            session = openSession();
1094    
1095                            PortletItem[] array = new PortletItemImpl[3];
1096    
1097                            array[0] = getByG_P_C_PrevAndNext(session, portletItem, groupId,
1098                                            portletId, classNameId, orderByComparator, true);
1099    
1100                            array[1] = portletItem;
1101    
1102                            array[2] = getByG_P_C_PrevAndNext(session, portletItem, groupId,
1103                                            portletId, classNameId, orderByComparator, false);
1104    
1105                            return array;
1106                    }
1107                    catch (Exception e) {
1108                            throw processException(e);
1109                    }
1110                    finally {
1111                            closeSession(session);
1112                    }
1113            }
1114    
1115            protected PortletItem getByG_P_C_PrevAndNext(Session session,
1116                    PortletItem portletItem, long groupId, String portletId,
1117                    long classNameId, OrderByComparator orderByComparator, boolean previous) {
1118                    StringBundler query = null;
1119    
1120                    if (orderByComparator != null) {
1121                            query = new StringBundler(6 +
1122                                            (orderByComparator.getOrderByFields().length * 6));
1123                    }
1124                    else {
1125                            query = new StringBundler(3);
1126                    }
1127    
1128                    query.append(_SQL_SELECT_PORTLETITEM_WHERE);
1129    
1130                    query.append(_FINDER_COLUMN_G_P_C_GROUPID_2);
1131    
1132                    if (portletId == null) {
1133                            query.append(_FINDER_COLUMN_G_P_C_PORTLETID_1);
1134                    }
1135                    else {
1136                            if (portletId.equals(StringPool.BLANK)) {
1137                                    query.append(_FINDER_COLUMN_G_P_C_PORTLETID_3);
1138                            }
1139                            else {
1140                                    query.append(_FINDER_COLUMN_G_P_C_PORTLETID_2);
1141                            }
1142                    }
1143    
1144                    query.append(_FINDER_COLUMN_G_P_C_CLASSNAMEID_2);
1145    
1146                    if (orderByComparator != null) {
1147                            String[] orderByFields = orderByComparator.getOrderByFields();
1148    
1149                            if (orderByFields.length > 0) {
1150                                    query.append(WHERE_AND);
1151                            }
1152    
1153                            for (int i = 0; i < orderByFields.length; i++) {
1154                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1155                                    query.append(orderByFields[i]);
1156    
1157                                    if ((i + 1) < orderByFields.length) {
1158                                            if (orderByComparator.isAscending() ^ previous) {
1159                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1160                                            }
1161                                            else {
1162                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1163                                            }
1164                                    }
1165                                    else {
1166                                            if (orderByComparator.isAscending() ^ previous) {
1167                                                    query.append(WHERE_GREATER_THAN);
1168                                            }
1169                                            else {
1170                                                    query.append(WHERE_LESSER_THAN);
1171                                            }
1172                                    }
1173                            }
1174    
1175                            query.append(ORDER_BY_CLAUSE);
1176    
1177                            for (int i = 0; i < orderByFields.length; i++) {
1178                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1179                                    query.append(orderByFields[i]);
1180    
1181                                    if ((i + 1) < orderByFields.length) {
1182                                            if (orderByComparator.isAscending() ^ previous) {
1183                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1184                                            }
1185                                            else {
1186                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1187                                            }
1188                                    }
1189                                    else {
1190                                            if (orderByComparator.isAscending() ^ previous) {
1191                                                    query.append(ORDER_BY_ASC);
1192                                            }
1193                                            else {
1194                                                    query.append(ORDER_BY_DESC);
1195                                            }
1196                                    }
1197                            }
1198                    }
1199    
1200                    String sql = query.toString();
1201    
1202                    Query q = session.createQuery(sql);
1203    
1204                    q.setFirstResult(0);
1205                    q.setMaxResults(2);
1206    
1207                    QueryPos qPos = QueryPos.getInstance(q);
1208    
1209                    qPos.add(groupId);
1210    
1211                    if (portletId != null) {
1212                            qPos.add(portletId);
1213                    }
1214    
1215                    qPos.add(classNameId);
1216    
1217                    if (orderByComparator != null) {
1218                            Object[] values = orderByComparator.getOrderByValues(portletItem);
1219    
1220                            for (Object value : values) {
1221                                    qPos.add(value);
1222                            }
1223                    }
1224    
1225                    List<PortletItem> list = q.list();
1226    
1227                    if (list.size() == 2) {
1228                            return list.get(1);
1229                    }
1230                    else {
1231                            return null;
1232                    }
1233            }
1234    
1235            /**
1236             * Finds the portlet item where groupId = &#63; and name = &#63; and portletId = &#63; and classNameId = &#63; or throws a {@link com.liferay.portal.NoSuchPortletItemException} if it could not be found.
1237             *
1238             * @param groupId the group id to search with
1239             * @param name the name to search with
1240             * @param portletId the portlet id to search with
1241             * @param classNameId the class name id to search with
1242             * @return the matching portlet item
1243             * @throws com.liferay.portal.NoSuchPortletItemException if a matching portlet item could not be found
1244             * @throws SystemException if a system exception occurred
1245             */
1246            public PortletItem findByG_N_P_C(long groupId, String name,
1247                    String portletId, long classNameId)
1248                    throws NoSuchPortletItemException, SystemException {
1249                    PortletItem portletItem = fetchByG_N_P_C(groupId, name, portletId,
1250                                    classNameId);
1251    
1252                    if (portletItem == null) {
1253                            StringBundler msg = new StringBundler(10);
1254    
1255                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1256    
1257                            msg.append("groupId=");
1258                            msg.append(groupId);
1259    
1260                            msg.append(", name=");
1261                            msg.append(name);
1262    
1263                            msg.append(", portletId=");
1264                            msg.append(portletId);
1265    
1266                            msg.append(", classNameId=");
1267                            msg.append(classNameId);
1268    
1269                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1270    
1271                            if (_log.isWarnEnabled()) {
1272                                    _log.warn(msg.toString());
1273                            }
1274    
1275                            throw new NoSuchPortletItemException(msg.toString());
1276                    }
1277    
1278                    return portletItem;
1279            }
1280    
1281            /**
1282             * Finds the portlet item where groupId = &#63; and name = &#63; and portletId = &#63; and classNameId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
1283             *
1284             * @param groupId the group id to search with
1285             * @param name the name to search with
1286             * @param portletId the portlet id to search with
1287             * @param classNameId the class name id to search with
1288             * @return the matching portlet item, or <code>null</code> if a matching portlet item could not be found
1289             * @throws SystemException if a system exception occurred
1290             */
1291            public PortletItem fetchByG_N_P_C(long groupId, String name,
1292                    String portletId, long classNameId) throws SystemException {
1293                    return fetchByG_N_P_C(groupId, name, portletId, classNameId, true);
1294            }
1295    
1296            /**
1297             * Finds the portlet item where groupId = &#63; and name = &#63; and portletId = &#63; and classNameId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
1298             *
1299             * @param groupId the group id to search with
1300             * @param name the name to search with
1301             * @param portletId the portlet id to search with
1302             * @param classNameId the class name id to search with
1303             * @return the matching portlet item, or <code>null</code> if a matching portlet item could not be found
1304             * @throws SystemException if a system exception occurred
1305             */
1306            public PortletItem fetchByG_N_P_C(long groupId, String name,
1307                    String portletId, long classNameId, boolean retrieveFromCache)
1308                    throws SystemException {
1309                    Object[] finderArgs = new Object[] { groupId, name, portletId, classNameId };
1310    
1311                    Object result = null;
1312    
1313                    if (retrieveFromCache) {
1314                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_N_P_C,
1315                                            finderArgs, this);
1316                    }
1317    
1318                    if (result == null) {
1319                            Session session = null;
1320    
1321                            try {
1322                                    session = openSession();
1323    
1324                                    StringBundler query = new StringBundler(5);
1325    
1326                                    query.append(_SQL_SELECT_PORTLETITEM_WHERE);
1327    
1328                                    query.append(_FINDER_COLUMN_G_N_P_C_GROUPID_2);
1329    
1330                                    if (name == null) {
1331                                            query.append(_FINDER_COLUMN_G_N_P_C_NAME_1);
1332                                    }
1333                                    else {
1334                                            if (name.equals(StringPool.BLANK)) {
1335                                                    query.append(_FINDER_COLUMN_G_N_P_C_NAME_3);
1336                                            }
1337                                            else {
1338                                                    query.append(_FINDER_COLUMN_G_N_P_C_NAME_2);
1339                                            }
1340                                    }
1341    
1342                                    if (portletId == null) {
1343                                            query.append(_FINDER_COLUMN_G_N_P_C_PORTLETID_1);
1344                                    }
1345                                    else {
1346                                            if (portletId.equals(StringPool.BLANK)) {
1347                                                    query.append(_FINDER_COLUMN_G_N_P_C_PORTLETID_3);
1348                                            }
1349                                            else {
1350                                                    query.append(_FINDER_COLUMN_G_N_P_C_PORTLETID_2);
1351                                            }
1352                                    }
1353    
1354                                    query.append(_FINDER_COLUMN_G_N_P_C_CLASSNAMEID_2);
1355    
1356                                    String sql = query.toString();
1357    
1358                                    Query q = session.createQuery(sql);
1359    
1360                                    QueryPos qPos = QueryPos.getInstance(q);
1361    
1362                                    qPos.add(groupId);
1363    
1364                                    if (name != null) {
1365                                            qPos.add(name);
1366                                    }
1367    
1368                                    if (portletId != null) {
1369                                            qPos.add(portletId);
1370                                    }
1371    
1372                                    qPos.add(classNameId);
1373    
1374                                    List<PortletItem> list = q.list();
1375    
1376                                    result = list;
1377    
1378                                    PortletItem portletItem = null;
1379    
1380                                    if (list.isEmpty()) {
1381                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N_P_C,
1382                                                    finderArgs, list);
1383                                    }
1384                                    else {
1385                                            portletItem = list.get(0);
1386    
1387                                            cacheResult(portletItem);
1388    
1389                                            if ((portletItem.getGroupId() != groupId) ||
1390                                                            (portletItem.getName() == null) ||
1391                                                            !portletItem.getName().equals(name) ||
1392                                                            (portletItem.getPortletId() == null) ||
1393                                                            !portletItem.getPortletId().equals(portletId) ||
1394                                                            (portletItem.getClassNameId() != classNameId)) {
1395                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N_P_C,
1396                                                            finderArgs, portletItem);
1397                                            }
1398                                    }
1399    
1400                                    return portletItem;
1401                            }
1402                            catch (Exception e) {
1403                                    throw processException(e);
1404                            }
1405                            finally {
1406                                    if (result == null) {
1407                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_N_P_C,
1408                                                    finderArgs, new ArrayList<PortletItem>());
1409                                    }
1410    
1411                                    closeSession(session);
1412                            }
1413                    }
1414                    else {
1415                            if (result instanceof List<?>) {
1416                                    return null;
1417                            }
1418                            else {
1419                                    return (PortletItem)result;
1420                            }
1421                    }
1422            }
1423    
1424            /**
1425             * Finds all the portlet items.
1426             *
1427             * @return the portlet items
1428             * @throws SystemException if a system exception occurred
1429             */
1430            public List<PortletItem> findAll() throws SystemException {
1431                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1432            }
1433    
1434            /**
1435             * Finds a range of all the portlet items.
1436             *
1437             * <p>
1438             * 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.
1439             * </p>
1440             *
1441             * @param start the lower bound of the range of portlet items to return
1442             * @param end the upper bound of the range of portlet items to return (not inclusive)
1443             * @return the range of portlet items
1444             * @throws SystemException if a system exception occurred
1445             */
1446            public List<PortletItem> findAll(int start, int end)
1447                    throws SystemException {
1448                    return findAll(start, end, null);
1449            }
1450    
1451            /**
1452             * Finds an ordered range of all the portlet items.
1453             *
1454             * <p>
1455             * 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.
1456             * </p>
1457             *
1458             * @param start the lower bound of the range of portlet items to return
1459             * @param end the upper bound of the range of portlet items to return (not inclusive)
1460             * @param orderByComparator the comparator to order the results by
1461             * @return the ordered range of portlet items
1462             * @throws SystemException if a system exception occurred
1463             */
1464            public List<PortletItem> findAll(int start, int end,
1465                    OrderByComparator orderByComparator) throws SystemException {
1466                    Object[] finderArgs = new Object[] {
1467                                    String.valueOf(start), String.valueOf(end),
1468                                    String.valueOf(orderByComparator)
1469                            };
1470    
1471                    List<PortletItem> list = (List<PortletItem>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
1472                                    finderArgs, this);
1473    
1474                    if (list == null) {
1475                            Session session = null;
1476    
1477                            try {
1478                                    session = openSession();
1479    
1480                                    StringBundler query = null;
1481                                    String sql = null;
1482    
1483                                    if (orderByComparator != null) {
1484                                            query = new StringBundler(2 +
1485                                                            (orderByComparator.getOrderByFields().length * 3));
1486    
1487                                            query.append(_SQL_SELECT_PORTLETITEM);
1488    
1489                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1490                                                    orderByComparator);
1491    
1492                                            sql = query.toString();
1493                                    }
1494                                    else {
1495                                            sql = _SQL_SELECT_PORTLETITEM;
1496                                    }
1497    
1498                                    Query q = session.createQuery(sql);
1499    
1500                                    if (orderByComparator == null) {
1501                                            list = (List<PortletItem>)QueryUtil.list(q, getDialect(),
1502                                                            start, end, false);
1503    
1504                                            Collections.sort(list);
1505                                    }
1506                                    else {
1507                                            list = (List<PortletItem>)QueryUtil.list(q, getDialect(),
1508                                                            start, end);
1509                                    }
1510                            }
1511                            catch (Exception e) {
1512                                    throw processException(e);
1513                            }
1514                            finally {
1515                                    if (list == null) {
1516                                            list = new ArrayList<PortletItem>();
1517                                    }
1518    
1519                                    cacheResult(list);
1520    
1521                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1522    
1523                                    closeSession(session);
1524                            }
1525                    }
1526    
1527                    return list;
1528            }
1529    
1530            /**
1531             * Removes all the portlet items where groupId = &#63; and classNameId = &#63; from the database.
1532             *
1533             * @param groupId the group id to search with
1534             * @param classNameId the class name id to search with
1535             * @throws SystemException if a system exception occurred
1536             */
1537            public void removeByG_C(long groupId, long classNameId)
1538                    throws SystemException {
1539                    for (PortletItem portletItem : findByG_C(groupId, classNameId)) {
1540                            remove(portletItem);
1541                    }
1542            }
1543    
1544            /**
1545             * Removes all the portlet items where groupId = &#63; and portletId = &#63; and classNameId = &#63; from the database.
1546             *
1547             * @param groupId the group id to search with
1548             * @param portletId the portlet id to search with
1549             * @param classNameId the class name id to search with
1550             * @throws SystemException if a system exception occurred
1551             */
1552            public void removeByG_P_C(long groupId, String portletId, long classNameId)
1553                    throws SystemException {
1554                    for (PortletItem portletItem : findByG_P_C(groupId, portletId,
1555                                    classNameId)) {
1556                            remove(portletItem);
1557                    }
1558            }
1559    
1560            /**
1561             * Removes the portlet item where groupId = &#63; and name = &#63; and portletId = &#63; and classNameId = &#63; from the database.
1562             *
1563             * @param groupId the group id to search with
1564             * @param name the name to search with
1565             * @param portletId the portlet id to search with
1566             * @param classNameId the class name id to search with
1567             * @throws SystemException if a system exception occurred
1568             */
1569            public void removeByG_N_P_C(long groupId, String name, String portletId,
1570                    long classNameId) throws NoSuchPortletItemException, SystemException {
1571                    PortletItem portletItem = findByG_N_P_C(groupId, name, portletId,
1572                                    classNameId);
1573    
1574                    remove(portletItem);
1575            }
1576    
1577            /**
1578             * Removes all the portlet items from the database.
1579             *
1580             * @throws SystemException if a system exception occurred
1581             */
1582            public void removeAll() throws SystemException {
1583                    for (PortletItem portletItem : findAll()) {
1584                            remove(portletItem);
1585                    }
1586            }
1587    
1588            /**
1589             * Counts all the portlet items where groupId = &#63; and classNameId = &#63;.
1590             *
1591             * @param groupId the group id to search with
1592             * @param classNameId the class name id to search with
1593             * @return the number of matching portlet items
1594             * @throws SystemException if a system exception occurred
1595             */
1596            public int countByG_C(long groupId, long classNameId)
1597                    throws SystemException {
1598                    Object[] finderArgs = new Object[] { groupId, classNameId };
1599    
1600                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_C,
1601                                    finderArgs, this);
1602    
1603                    if (count == null) {
1604                            Session session = null;
1605    
1606                            try {
1607                                    session = openSession();
1608    
1609                                    StringBundler query = new StringBundler(3);
1610    
1611                                    query.append(_SQL_COUNT_PORTLETITEM_WHERE);
1612    
1613                                    query.append(_FINDER_COLUMN_G_C_GROUPID_2);
1614    
1615                                    query.append(_FINDER_COLUMN_G_C_CLASSNAMEID_2);
1616    
1617                                    String sql = query.toString();
1618    
1619                                    Query q = session.createQuery(sql);
1620    
1621                                    QueryPos qPos = QueryPos.getInstance(q);
1622    
1623                                    qPos.add(groupId);
1624    
1625                                    qPos.add(classNameId);
1626    
1627                                    count = (Long)q.uniqueResult();
1628                            }
1629                            catch (Exception e) {
1630                                    throw processException(e);
1631                            }
1632                            finally {
1633                                    if (count == null) {
1634                                            count = Long.valueOf(0);
1635                                    }
1636    
1637                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_C, finderArgs,
1638                                            count);
1639    
1640                                    closeSession(session);
1641                            }
1642                    }
1643    
1644                    return count.intValue();
1645            }
1646    
1647            /**
1648             * Counts all the portlet items where groupId = &#63; and portletId = &#63; and classNameId = &#63;.
1649             *
1650             * @param groupId the group id to search with
1651             * @param portletId the portlet id to search with
1652             * @param classNameId the class name id to search with
1653             * @return the number of matching portlet items
1654             * @throws SystemException if a system exception occurred
1655             */
1656            public int countByG_P_C(long groupId, String portletId, long classNameId)
1657                    throws SystemException {
1658                    Object[] finderArgs = new Object[] { groupId, portletId, classNameId };
1659    
1660                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_P_C,
1661                                    finderArgs, this);
1662    
1663                    if (count == null) {
1664                            Session session = null;
1665    
1666                            try {
1667                                    session = openSession();
1668    
1669                                    StringBundler query = new StringBundler(4);
1670    
1671                                    query.append(_SQL_COUNT_PORTLETITEM_WHERE);
1672    
1673                                    query.append(_FINDER_COLUMN_G_P_C_GROUPID_2);
1674    
1675                                    if (portletId == null) {
1676                                            query.append(_FINDER_COLUMN_G_P_C_PORTLETID_1);
1677                                    }
1678                                    else {
1679                                            if (portletId.equals(StringPool.BLANK)) {
1680                                                    query.append(_FINDER_COLUMN_G_P_C_PORTLETID_3);
1681                                            }
1682                                            else {
1683                                                    query.append(_FINDER_COLUMN_G_P_C_PORTLETID_2);
1684                                            }
1685                                    }
1686    
1687                                    query.append(_FINDER_COLUMN_G_P_C_CLASSNAMEID_2);
1688    
1689                                    String sql = query.toString();
1690    
1691                                    Query q = session.createQuery(sql);
1692    
1693                                    QueryPos qPos = QueryPos.getInstance(q);
1694    
1695                                    qPos.add(groupId);
1696    
1697                                    if (portletId != null) {
1698                                            qPos.add(portletId);
1699                                    }
1700    
1701                                    qPos.add(classNameId);
1702    
1703                                    count = (Long)q.uniqueResult();
1704                            }
1705                            catch (Exception e) {
1706                                    throw processException(e);
1707                            }
1708                            finally {
1709                                    if (count == null) {
1710                                            count = Long.valueOf(0);
1711                                    }
1712    
1713                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_P_C,
1714                                            finderArgs, count);
1715    
1716                                    closeSession(session);
1717                            }
1718                    }
1719    
1720                    return count.intValue();
1721            }
1722    
1723            /**
1724             * Counts all the portlet items where groupId = &#63; and name = &#63; and portletId = &#63; and classNameId = &#63;.
1725             *
1726             * @param groupId the group id to search with
1727             * @param name the name to search with
1728             * @param portletId the portlet id to search with
1729             * @param classNameId the class name id to search with
1730             * @return the number of matching portlet items
1731             * @throws SystemException if a system exception occurred
1732             */
1733            public int countByG_N_P_C(long groupId, String name, String portletId,
1734                    long classNameId) throws SystemException {
1735                    Object[] finderArgs = new Object[] { groupId, name, portletId, classNameId };
1736    
1737                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_N_P_C,
1738                                    finderArgs, this);
1739    
1740                    if (count == null) {
1741                            Session session = null;
1742    
1743                            try {
1744                                    session = openSession();
1745    
1746                                    StringBundler query = new StringBundler(5);
1747    
1748                                    query.append(_SQL_COUNT_PORTLETITEM_WHERE);
1749    
1750                                    query.append(_FINDER_COLUMN_G_N_P_C_GROUPID_2);
1751    
1752                                    if (name == null) {
1753                                            query.append(_FINDER_COLUMN_G_N_P_C_NAME_1);
1754                                    }
1755                                    else {
1756                                            if (name.equals(StringPool.BLANK)) {
1757                                                    query.append(_FINDER_COLUMN_G_N_P_C_NAME_3);
1758                                            }
1759                                            else {
1760                                                    query.append(_FINDER_COLUMN_G_N_P_C_NAME_2);
1761                                            }
1762                                    }
1763    
1764                                    if (portletId == null) {
1765                                            query.append(_FINDER_COLUMN_G_N_P_C_PORTLETID_1);
1766                                    }
1767                                    else {
1768                                            if (portletId.equals(StringPool.BLANK)) {
1769                                                    query.append(_FINDER_COLUMN_G_N_P_C_PORTLETID_3);
1770                                            }
1771                                            else {
1772                                                    query.append(_FINDER_COLUMN_G_N_P_C_PORTLETID_2);
1773                                            }
1774                                    }
1775    
1776                                    query.append(_FINDER_COLUMN_G_N_P_C_CLASSNAMEID_2);
1777    
1778                                    String sql = query.toString();
1779    
1780                                    Query q = session.createQuery(sql);
1781    
1782                                    QueryPos qPos = QueryPos.getInstance(q);
1783    
1784                                    qPos.add(groupId);
1785    
1786                                    if (name != null) {
1787                                            qPos.add(name);
1788                                    }
1789    
1790                                    if (portletId != null) {
1791                                            qPos.add(portletId);
1792                                    }
1793    
1794                                    qPos.add(classNameId);
1795    
1796                                    count = (Long)q.uniqueResult();
1797                            }
1798                            catch (Exception e) {
1799                                    throw processException(e);
1800                            }
1801                            finally {
1802                                    if (count == null) {
1803                                            count = Long.valueOf(0);
1804                                    }
1805    
1806                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_N_P_C,
1807                                            finderArgs, count);
1808    
1809                                    closeSession(session);
1810                            }
1811                    }
1812    
1813                    return count.intValue();
1814            }
1815    
1816            /**
1817             * Counts all the portlet items.
1818             *
1819             * @return the number of portlet items
1820             * @throws SystemException if a system exception occurred
1821             */
1822            public int countAll() throws SystemException {
1823                    Object[] finderArgs = new Object[0];
1824    
1825                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1826                                    finderArgs, this);
1827    
1828                    if (count == null) {
1829                            Session session = null;
1830    
1831                            try {
1832                                    session = openSession();
1833    
1834                                    Query q = session.createQuery(_SQL_COUNT_PORTLETITEM);
1835    
1836                                    count = (Long)q.uniqueResult();
1837                            }
1838                            catch (Exception e) {
1839                                    throw processException(e);
1840                            }
1841                            finally {
1842                                    if (count == null) {
1843                                            count = Long.valueOf(0);
1844                                    }
1845    
1846                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1847                                            count);
1848    
1849                                    closeSession(session);
1850                            }
1851                    }
1852    
1853                    return count.intValue();
1854            }
1855    
1856            /**
1857             * Initializes the portlet item persistence.
1858             */
1859            public void afterPropertiesSet() {
1860                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1861                                            com.liferay.portal.util.PropsUtil.get(
1862                                                    "value.object.listener.com.liferay.portal.model.PortletItem")));
1863    
1864                    if (listenerClassNames.length > 0) {
1865                            try {
1866                                    List<ModelListener<PortletItem>> listenersList = new ArrayList<ModelListener<PortletItem>>();
1867    
1868                                    for (String listenerClassName : listenerClassNames) {
1869                                            listenersList.add((ModelListener<PortletItem>)InstanceFactory.newInstance(
1870                                                            listenerClassName));
1871                                    }
1872    
1873                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1874                            }
1875                            catch (Exception e) {
1876                                    _log.error(e);
1877                            }
1878                    }
1879            }
1880    
1881            @BeanReference(type = AccountPersistence.class)
1882            protected AccountPersistence accountPersistence;
1883            @BeanReference(type = AddressPersistence.class)
1884            protected AddressPersistence addressPersistence;
1885            @BeanReference(type = BrowserTrackerPersistence.class)
1886            protected BrowserTrackerPersistence browserTrackerPersistence;
1887            @BeanReference(type = ClassNamePersistence.class)
1888            protected ClassNamePersistence classNamePersistence;
1889            @BeanReference(type = ClusterGroupPersistence.class)
1890            protected ClusterGroupPersistence clusterGroupPersistence;
1891            @BeanReference(type = CompanyPersistence.class)
1892            protected CompanyPersistence companyPersistence;
1893            @BeanReference(type = ContactPersistence.class)
1894            protected ContactPersistence contactPersistence;
1895            @BeanReference(type = CountryPersistence.class)
1896            protected CountryPersistence countryPersistence;
1897            @BeanReference(type = EmailAddressPersistence.class)
1898            protected EmailAddressPersistence emailAddressPersistence;
1899            @BeanReference(type = GroupPersistence.class)
1900            protected GroupPersistence groupPersistence;
1901            @BeanReference(type = ImagePersistence.class)
1902            protected ImagePersistence imagePersistence;
1903            @BeanReference(type = LayoutPersistence.class)
1904            protected LayoutPersistence layoutPersistence;
1905            @BeanReference(type = LayoutPrototypePersistence.class)
1906            protected LayoutPrototypePersistence layoutPrototypePersistence;
1907            @BeanReference(type = LayoutSetPersistence.class)
1908            protected LayoutSetPersistence layoutSetPersistence;
1909            @BeanReference(type = LayoutSetPrototypePersistence.class)
1910            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1911            @BeanReference(type = ListTypePersistence.class)
1912            protected ListTypePersistence listTypePersistence;
1913            @BeanReference(type = LockPersistence.class)
1914            protected LockPersistence lockPersistence;
1915            @BeanReference(type = MembershipRequestPersistence.class)
1916            protected MembershipRequestPersistence membershipRequestPersistence;
1917            @BeanReference(type = OrganizationPersistence.class)
1918            protected OrganizationPersistence organizationPersistence;
1919            @BeanReference(type = OrgGroupPermissionPersistence.class)
1920            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1921            @BeanReference(type = OrgGroupRolePersistence.class)
1922            protected OrgGroupRolePersistence orgGroupRolePersistence;
1923            @BeanReference(type = OrgLaborPersistence.class)
1924            protected OrgLaborPersistence orgLaborPersistence;
1925            @BeanReference(type = PasswordPolicyPersistence.class)
1926            protected PasswordPolicyPersistence passwordPolicyPersistence;
1927            @BeanReference(type = PasswordPolicyRelPersistence.class)
1928            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1929            @BeanReference(type = PasswordTrackerPersistence.class)
1930            protected PasswordTrackerPersistence passwordTrackerPersistence;
1931            @BeanReference(type = PermissionPersistence.class)
1932            protected PermissionPersistence permissionPersistence;
1933            @BeanReference(type = PhonePersistence.class)
1934            protected PhonePersistence phonePersistence;
1935            @BeanReference(type = PluginSettingPersistence.class)
1936            protected PluginSettingPersistence pluginSettingPersistence;
1937            @BeanReference(type = PortletPersistence.class)
1938            protected PortletPersistence portletPersistence;
1939            @BeanReference(type = PortletItemPersistence.class)
1940            protected PortletItemPersistence portletItemPersistence;
1941            @BeanReference(type = PortletPreferencesPersistence.class)
1942            protected PortletPreferencesPersistence portletPreferencesPersistence;
1943            @BeanReference(type = RegionPersistence.class)
1944            protected RegionPersistence regionPersistence;
1945            @BeanReference(type = ReleasePersistence.class)
1946            protected ReleasePersistence releasePersistence;
1947            @BeanReference(type = ResourcePersistence.class)
1948            protected ResourcePersistence resourcePersistence;
1949            @BeanReference(type = ResourceActionPersistence.class)
1950            protected ResourceActionPersistence resourceActionPersistence;
1951            @BeanReference(type = ResourceCodePersistence.class)
1952            protected ResourceCodePersistence resourceCodePersistence;
1953            @BeanReference(type = ResourcePermissionPersistence.class)
1954            protected ResourcePermissionPersistence resourcePermissionPersistence;
1955            @BeanReference(type = RolePersistence.class)
1956            protected RolePersistence rolePersistence;
1957            @BeanReference(type = ServiceComponentPersistence.class)
1958            protected ServiceComponentPersistence serviceComponentPersistence;
1959            @BeanReference(type = ShardPersistence.class)
1960            protected ShardPersistence shardPersistence;
1961            @BeanReference(type = SubscriptionPersistence.class)
1962            protected SubscriptionPersistence subscriptionPersistence;
1963            @BeanReference(type = TicketPersistence.class)
1964            protected TicketPersistence ticketPersistence;
1965            @BeanReference(type = TeamPersistence.class)
1966            protected TeamPersistence teamPersistence;
1967            @BeanReference(type = UserPersistence.class)
1968            protected UserPersistence userPersistence;
1969            @BeanReference(type = UserGroupPersistence.class)
1970            protected UserGroupPersistence userGroupPersistence;
1971            @BeanReference(type = UserGroupGroupRolePersistence.class)
1972            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1973            @BeanReference(type = UserGroupRolePersistence.class)
1974            protected UserGroupRolePersistence userGroupRolePersistence;
1975            @BeanReference(type = UserIdMapperPersistence.class)
1976            protected UserIdMapperPersistence userIdMapperPersistence;
1977            @BeanReference(type = UserTrackerPersistence.class)
1978            protected UserTrackerPersistence userTrackerPersistence;
1979            @BeanReference(type = UserTrackerPathPersistence.class)
1980            protected UserTrackerPathPersistence userTrackerPathPersistence;
1981            @BeanReference(type = WebDAVPropsPersistence.class)
1982            protected WebDAVPropsPersistence webDAVPropsPersistence;
1983            @BeanReference(type = WebsitePersistence.class)
1984            protected WebsitePersistence websitePersistence;
1985            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1986            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1987            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1988            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1989            private static final String _SQL_SELECT_PORTLETITEM = "SELECT portletItem FROM PortletItem portletItem";
1990            private static final String _SQL_SELECT_PORTLETITEM_WHERE = "SELECT portletItem FROM PortletItem portletItem WHERE ";
1991            private static final String _SQL_COUNT_PORTLETITEM = "SELECT COUNT(portletItem) FROM PortletItem portletItem";
1992            private static final String _SQL_COUNT_PORTLETITEM_WHERE = "SELECT COUNT(portletItem) FROM PortletItem portletItem WHERE ";
1993            private static final String _FINDER_COLUMN_G_C_GROUPID_2 = "portletItem.groupId = ? AND ";
1994            private static final String _FINDER_COLUMN_G_C_CLASSNAMEID_2 = "portletItem.classNameId = ?";
1995            private static final String _FINDER_COLUMN_G_P_C_GROUPID_2 = "portletItem.groupId = ? AND ";
1996            private static final String _FINDER_COLUMN_G_P_C_PORTLETID_1 = "portletItem.portletId IS NULL AND ";
1997            private static final String _FINDER_COLUMN_G_P_C_PORTLETID_2 = "portletItem.portletId = ? AND ";
1998            private static final String _FINDER_COLUMN_G_P_C_PORTLETID_3 = "(portletItem.portletId IS NULL OR portletItem.portletId = ?) AND ";
1999            private static final String _FINDER_COLUMN_G_P_C_CLASSNAMEID_2 = "portletItem.classNameId = ?";
2000            private static final String _FINDER_COLUMN_G_N_P_C_GROUPID_2 = "portletItem.groupId = ? AND ";
2001            private static final String _FINDER_COLUMN_G_N_P_C_NAME_1 = "portletItem.name IS NULL AND ";
2002            private static final String _FINDER_COLUMN_G_N_P_C_NAME_2 = "lower(portletItem.name) = lower(?) AND ";
2003            private static final String _FINDER_COLUMN_G_N_P_C_NAME_3 = "(portletItem.name IS NULL OR lower(portletItem.name) = lower(?)) AND ";
2004            private static final String _FINDER_COLUMN_G_N_P_C_PORTLETID_1 = "portletItem.portletId IS NULL AND ";
2005            private static final String _FINDER_COLUMN_G_N_P_C_PORTLETID_2 = "portletItem.portletId = ? AND ";
2006            private static final String _FINDER_COLUMN_G_N_P_C_PORTLETID_3 = "(portletItem.portletId IS NULL OR portletItem.portletId = ?) AND ";
2007            private static final String _FINDER_COLUMN_G_N_P_C_CLASSNAMEID_2 = "portletItem.classNameId = ?";
2008            private static final String _ORDER_BY_ENTITY_ALIAS = "portletItem.";
2009            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No PortletItem exists with the primary key ";
2010            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No PortletItem exists with the key {";
2011            private static Log _log = LogFactoryUtil.getLog(PortletItemPersistenceImpl.class);
2012    }