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