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