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