001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.NoSuchOrgGroupPermissionException;
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.model.CacheModel;
038    import com.liferay.portal.model.ModelListener;
039    import com.liferay.portal.model.OrgGroupPermission;
040    import com.liferay.portal.model.impl.OrgGroupPermissionImpl;
041    import com.liferay.portal.model.impl.OrgGroupPermissionModelImpl;
042    import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
043    
044    import java.io.Serializable;
045    
046    import java.util.ArrayList;
047    import java.util.Collections;
048    import java.util.List;
049    
050    /**
051     * The persistence implementation for the org group permission service.
052     *
053     * <p>
054     * Caching information and settings can be found in <code>portal.properties</code>
055     * </p>
056     *
057     * @author Brian Wing Shun Chan
058     * @see OrgGroupPermissionPersistence
059     * @see OrgGroupPermissionUtil
060     * @generated
061     */
062    public class OrgGroupPermissionPersistenceImpl extends BasePersistenceImpl<OrgGroupPermission>
063            implements OrgGroupPermissionPersistence {
064            /*
065             * NOTE FOR DEVELOPERS:
066             *
067             * Never modify or reference this class directly. Always use {@link OrgGroupPermissionUtil} to access the org group permission persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
068             */
069            public static final String FINDER_CLASS_NAME_ENTITY = OrgGroupPermissionImpl.class.getName();
070            public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
071                    ".List1";
072            public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
073                    ".List2";
074            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
075                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED,
076                            OrgGroupPermissionImpl.class,
077                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
078                            new String[] {
079                                    Long.class.getName(),
080                                    
081                            "java.lang.Integer", "java.lang.Integer",
082                                    "com.liferay.portal.kernel.util.OrderByComparator"
083                            });
084            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
085                    new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
086                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED,
087                            OrgGroupPermissionImpl.class,
088                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
089                            new String[] { Long.class.getName() },
090                            OrgGroupPermissionModelImpl.GROUPID_COLUMN_BITMASK);
091            public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
092                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED, Long.class,
093                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
094                            new String[] { Long.class.getName() });
095            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_PERMISSIONID =
096                    new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
097                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED,
098                            OrgGroupPermissionImpl.class,
099                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByPermissionId",
100                            new String[] {
101                                    Long.class.getName(),
102                                    
103                            "java.lang.Integer", "java.lang.Integer",
104                                    "com.liferay.portal.kernel.util.OrderByComparator"
105                            });
106            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PERMISSIONID =
107                    new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
108                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED,
109                            OrgGroupPermissionImpl.class,
110                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByPermissionId",
111                            new String[] { Long.class.getName() },
112                            OrgGroupPermissionModelImpl.PERMISSIONID_COLUMN_BITMASK);
113            public static final FinderPath FINDER_PATH_COUNT_BY_PERMISSIONID = new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
114                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED, Long.class,
115                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByPermissionId",
116                            new String[] { Long.class.getName() });
117            public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
118                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED,
119                            OrgGroupPermissionImpl.class,
120                            FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
121            public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
122                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED,
123                            OrgGroupPermissionImpl.class,
124                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
125            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
126                            OrgGroupPermissionModelImpl.FINDER_CACHE_ENABLED, Long.class,
127                            FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
128    
129            /**
130             * Caches the org group permission in the entity cache if it is enabled.
131             *
132             * @param orgGroupPermission the org group permission
133             */
134            public void cacheResult(OrgGroupPermission orgGroupPermission) {
135                    EntityCacheUtil.putResult(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
136                            OrgGroupPermissionImpl.class, orgGroupPermission.getPrimaryKey(),
137                            orgGroupPermission);
138    
139                    orgGroupPermission.resetOriginalValues();
140            }
141    
142            /**
143             * Caches the org group permissions in the entity cache if it is enabled.
144             *
145             * @param orgGroupPermissions the org group permissions
146             */
147            public void cacheResult(List<OrgGroupPermission> orgGroupPermissions) {
148                    for (OrgGroupPermission orgGroupPermission : orgGroupPermissions) {
149                            if (EntityCacheUtil.getResult(
150                                                    OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
151                                                    OrgGroupPermissionImpl.class,
152                                                    orgGroupPermission.getPrimaryKey()) == null) {
153                                    cacheResult(orgGroupPermission);
154                            }
155                            else {
156                                    orgGroupPermission.resetOriginalValues();
157                            }
158                    }
159            }
160    
161            /**
162             * Clears the cache for all org group permissions.
163             *
164             * <p>
165             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
166             * </p>
167             */
168            @Override
169            public void clearCache() {
170                    if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
171                            CacheRegistryUtil.clear(OrgGroupPermissionImpl.class.getName());
172                    }
173    
174                    EntityCacheUtil.clearCache(OrgGroupPermissionImpl.class.getName());
175    
176                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
177                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
178                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
179            }
180    
181            /**
182             * Clears the cache for the org group permission.
183             *
184             * <p>
185             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
186             * </p>
187             */
188            @Override
189            public void clearCache(OrgGroupPermission orgGroupPermission) {
190                    EntityCacheUtil.removeResult(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
191                            OrgGroupPermissionImpl.class, orgGroupPermission.getPrimaryKey());
192    
193                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
194                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
195            }
196    
197            @Override
198            public void clearCache(List<OrgGroupPermission> orgGroupPermissions) {
199                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
200                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
201    
202                    for (OrgGroupPermission orgGroupPermission : orgGroupPermissions) {
203                            EntityCacheUtil.removeResult(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
204                                    OrgGroupPermissionImpl.class, orgGroupPermission.getPrimaryKey());
205                    }
206            }
207    
208            /**
209             * Creates a new org group permission with the primary key. Does not add the org group permission to the database.
210             *
211             * @param orgGroupPermissionPK the primary key for the new org group permission
212             * @return the new org group permission
213             */
214            public OrgGroupPermission create(OrgGroupPermissionPK orgGroupPermissionPK) {
215                    OrgGroupPermission orgGroupPermission = new OrgGroupPermissionImpl();
216    
217                    orgGroupPermission.setNew(true);
218                    orgGroupPermission.setPrimaryKey(orgGroupPermissionPK);
219    
220                    return orgGroupPermission;
221            }
222    
223            /**
224             * Removes the org group permission with the primary key from the database. Also notifies the appropriate model listeners.
225             *
226             * @param orgGroupPermissionPK the primary key of the org group permission
227             * @return the org group permission that was removed
228             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a org group permission with the primary key could not be found
229             * @throws SystemException if a system exception occurred
230             */
231            public OrgGroupPermission remove(OrgGroupPermissionPK orgGroupPermissionPK)
232                    throws NoSuchOrgGroupPermissionException, SystemException {
233                    return remove((Serializable)orgGroupPermissionPK);
234            }
235    
236            /**
237             * Removes the org group permission with the primary key from the database. Also notifies the appropriate model listeners.
238             *
239             * @param primaryKey the primary key of the org group permission
240             * @return the org group permission that was removed
241             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a org group permission with the primary key could not be found
242             * @throws SystemException if a system exception occurred
243             */
244            @Override
245            public OrgGroupPermission remove(Serializable primaryKey)
246                    throws NoSuchOrgGroupPermissionException, SystemException {
247                    Session session = null;
248    
249                    try {
250                            session = openSession();
251    
252                            OrgGroupPermission orgGroupPermission = (OrgGroupPermission)session.get(OrgGroupPermissionImpl.class,
253                                            primaryKey);
254    
255                            if (orgGroupPermission == null) {
256                                    if (_log.isWarnEnabled()) {
257                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
258                                    }
259    
260                                    throw new NoSuchOrgGroupPermissionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
261                                            primaryKey);
262                            }
263    
264                            return remove(orgGroupPermission);
265                    }
266                    catch (NoSuchOrgGroupPermissionException nsee) {
267                            throw nsee;
268                    }
269                    catch (Exception e) {
270                            throw processException(e);
271                    }
272                    finally {
273                            closeSession(session);
274                    }
275            }
276    
277            @Override
278            protected OrgGroupPermission removeImpl(
279                    OrgGroupPermission orgGroupPermission) throws SystemException {
280                    orgGroupPermission = toUnwrappedModel(orgGroupPermission);
281    
282                    Session session = null;
283    
284                    try {
285                            session = openSession();
286    
287                            BatchSessionUtil.delete(session, orgGroupPermission);
288                    }
289                    catch (Exception e) {
290                            throw processException(e);
291                    }
292                    finally {
293                            closeSession(session);
294                    }
295    
296                    clearCache(orgGroupPermission);
297    
298                    return orgGroupPermission;
299            }
300    
301            @Override
302            public OrgGroupPermission updateImpl(
303                    com.liferay.portal.model.OrgGroupPermission orgGroupPermission,
304                    boolean merge) throws SystemException {
305                    orgGroupPermission = toUnwrappedModel(orgGroupPermission);
306    
307                    boolean isNew = orgGroupPermission.isNew();
308    
309                    OrgGroupPermissionModelImpl orgGroupPermissionModelImpl = (OrgGroupPermissionModelImpl)orgGroupPermission;
310    
311                    Session session = null;
312    
313                    try {
314                            session = openSession();
315    
316                            BatchSessionUtil.update(session, orgGroupPermission, merge);
317    
318                            orgGroupPermission.setNew(false);
319                    }
320                    catch (Exception e) {
321                            throw processException(e);
322                    }
323                    finally {
324                            closeSession(session);
325                    }
326    
327                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
328    
329                    if (isNew || !OrgGroupPermissionModelImpl.COLUMN_BITMASK_ENABLED) {
330                            FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
331                    }
332    
333                    else {
334                            if ((orgGroupPermissionModelImpl.getColumnBitmask() &
335                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
336                                    Object[] args = new Object[] {
337                                                    Long.valueOf(orgGroupPermissionModelImpl.getOriginalGroupId())
338                                            };
339    
340                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
341                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
342                                            args);
343    
344                                    args = new Object[] {
345                                                    Long.valueOf(orgGroupPermissionModelImpl.getGroupId())
346                                            };
347    
348                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
349                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
350                                            args);
351                            }
352    
353                            if ((orgGroupPermissionModelImpl.getColumnBitmask() &
354                                            FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PERMISSIONID.getColumnBitmask()) != 0) {
355                                    Object[] args = new Object[] {
356                                                    Long.valueOf(orgGroupPermissionModelImpl.getOriginalPermissionId())
357                                            };
358    
359                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PERMISSIONID,
360                                            args);
361                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PERMISSIONID,
362                                            args);
363    
364                                    args = new Object[] {
365                                                    Long.valueOf(orgGroupPermissionModelImpl.getPermissionId())
366                                            };
367    
368                                    FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_PERMISSIONID,
369                                            args);
370                                    FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PERMISSIONID,
371                                            args);
372                            }
373                    }
374    
375                    EntityCacheUtil.putResult(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
376                            OrgGroupPermissionImpl.class, orgGroupPermission.getPrimaryKey(),
377                            orgGroupPermission);
378    
379                    return orgGroupPermission;
380            }
381    
382            protected OrgGroupPermission toUnwrappedModel(
383                    OrgGroupPermission orgGroupPermission) {
384                    if (orgGroupPermission instanceof OrgGroupPermissionImpl) {
385                            return orgGroupPermission;
386                    }
387    
388                    OrgGroupPermissionImpl orgGroupPermissionImpl = new OrgGroupPermissionImpl();
389    
390                    orgGroupPermissionImpl.setNew(orgGroupPermission.isNew());
391                    orgGroupPermissionImpl.setPrimaryKey(orgGroupPermission.getPrimaryKey());
392    
393                    orgGroupPermissionImpl.setOrganizationId(orgGroupPermission.getOrganizationId());
394                    orgGroupPermissionImpl.setGroupId(orgGroupPermission.getGroupId());
395                    orgGroupPermissionImpl.setPermissionId(orgGroupPermission.getPermissionId());
396    
397                    return orgGroupPermissionImpl;
398            }
399    
400            /**
401             * Returns the org group permission with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
402             *
403             * @param primaryKey the primary key of the org group permission
404             * @return the org group permission
405             * @throws com.liferay.portal.NoSuchModelException if a org group permission with the primary key could not be found
406             * @throws SystemException if a system exception occurred
407             */
408            @Override
409            public OrgGroupPermission findByPrimaryKey(Serializable primaryKey)
410                    throws NoSuchModelException, SystemException {
411                    return findByPrimaryKey((OrgGroupPermissionPK)primaryKey);
412            }
413    
414            /**
415             * Returns the org group permission with the primary key or throws a {@link com.liferay.portal.NoSuchOrgGroupPermissionException} if it could not be found.
416             *
417             * @param orgGroupPermissionPK the primary key of the org group permission
418             * @return the org group permission
419             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a org group permission with the primary key could not be found
420             * @throws SystemException if a system exception occurred
421             */
422            public OrgGroupPermission findByPrimaryKey(
423                    OrgGroupPermissionPK orgGroupPermissionPK)
424                    throws NoSuchOrgGroupPermissionException, SystemException {
425                    OrgGroupPermission orgGroupPermission = fetchByPrimaryKey(orgGroupPermissionPK);
426    
427                    if (orgGroupPermission == null) {
428                            if (_log.isWarnEnabled()) {
429                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
430                                            orgGroupPermissionPK);
431                            }
432    
433                            throw new NoSuchOrgGroupPermissionException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
434                                    orgGroupPermissionPK);
435                    }
436    
437                    return orgGroupPermission;
438            }
439    
440            /**
441             * Returns the org group permission with the primary key or returns <code>null</code> if it could not be found.
442             *
443             * @param primaryKey the primary key of the org group permission
444             * @return the org group permission, or <code>null</code> if a org group permission with the primary key could not be found
445             * @throws SystemException if a system exception occurred
446             */
447            @Override
448            public OrgGroupPermission fetchByPrimaryKey(Serializable primaryKey)
449                    throws SystemException {
450                    return fetchByPrimaryKey((OrgGroupPermissionPK)primaryKey);
451            }
452    
453            /**
454             * Returns the org group permission with the primary key or returns <code>null</code> if it could not be found.
455             *
456             * @param orgGroupPermissionPK the primary key of the org group permission
457             * @return the org group permission, or <code>null</code> if a org group permission with the primary key could not be found
458             * @throws SystemException if a system exception occurred
459             */
460            public OrgGroupPermission fetchByPrimaryKey(
461                    OrgGroupPermissionPK orgGroupPermissionPK) throws SystemException {
462                    OrgGroupPermission orgGroupPermission = (OrgGroupPermission)EntityCacheUtil.getResult(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
463                                    OrgGroupPermissionImpl.class, orgGroupPermissionPK);
464    
465                    if (orgGroupPermission == _nullOrgGroupPermission) {
466                            return null;
467                    }
468    
469                    if (orgGroupPermission == null) {
470                            Session session = null;
471    
472                            boolean hasException = false;
473    
474                            try {
475                                    session = openSession();
476    
477                                    orgGroupPermission = (OrgGroupPermission)session.get(OrgGroupPermissionImpl.class,
478                                                    orgGroupPermissionPK);
479                            }
480                            catch (Exception e) {
481                                    hasException = true;
482    
483                                    throw processException(e);
484                            }
485                            finally {
486                                    if (orgGroupPermission != null) {
487                                            cacheResult(orgGroupPermission);
488                                    }
489                                    else if (!hasException) {
490                                            EntityCacheUtil.putResult(OrgGroupPermissionModelImpl.ENTITY_CACHE_ENABLED,
491                                                    OrgGroupPermissionImpl.class, orgGroupPermissionPK,
492                                                    _nullOrgGroupPermission);
493                                    }
494    
495                                    closeSession(session);
496                            }
497                    }
498    
499                    return orgGroupPermission;
500            }
501    
502            /**
503             * Returns all the org group permissions where groupId = &#63;.
504             *
505             * @param groupId the group ID
506             * @return the matching org group permissions
507             * @throws SystemException if a system exception occurred
508             */
509            public List<OrgGroupPermission> findByGroupId(long groupId)
510                    throws SystemException {
511                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
512            }
513    
514            /**
515             * Returns a range of all the org group permissions where groupId = &#63;.
516             *
517             * <p>
518             * 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.
519             * </p>
520             *
521             * @param groupId the group ID
522             * @param start the lower bound of the range of org group permissions
523             * @param end the upper bound of the range of org group permissions (not inclusive)
524             * @return the range of matching org group permissions
525             * @throws SystemException if a system exception occurred
526             */
527            public List<OrgGroupPermission> findByGroupId(long groupId, int start,
528                    int end) throws SystemException {
529                    return findByGroupId(groupId, start, end, null);
530            }
531    
532            /**
533             * Returns an ordered range of all the org group permissions where groupId = &#63;.
534             *
535             * <p>
536             * 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.
537             * </p>
538             *
539             * @param groupId the group ID
540             * @param start the lower bound of the range of org group permissions
541             * @param end the upper bound of the range of org group permissions (not inclusive)
542             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
543             * @return the ordered range of matching org group permissions
544             * @throws SystemException if a system exception occurred
545             */
546            public List<OrgGroupPermission> findByGroupId(long groupId, int start,
547                    int end, OrderByComparator orderByComparator) throws SystemException {
548                    FinderPath finderPath = null;
549                    Object[] finderArgs = null;
550    
551                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
552                                    (orderByComparator == null)) {
553                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
554                            finderArgs = new Object[] { groupId };
555                    }
556                    else {
557                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
558                            finderArgs = new Object[] { groupId, start, end, orderByComparator };
559                    }
560    
561                    List<OrgGroupPermission> list = (List<OrgGroupPermission>)FinderCacheUtil.getResult(finderPath,
562                                    finderArgs, this);
563    
564                    if ((list != null) && !list.isEmpty()) {
565                            for (OrgGroupPermission orgGroupPermission : list) {
566                                    if ((groupId != orgGroupPermission.getGroupId())) {
567                                            list = null;
568    
569                                            break;
570                                    }
571                            }
572                    }
573    
574                    if (list == null) {
575                            StringBundler query = null;
576    
577                            if (orderByComparator != null) {
578                                    query = new StringBundler(3 +
579                                                    (orderByComparator.getOrderByFields().length * 3));
580                            }
581                            else {
582                                    query = new StringBundler(2);
583                            }
584    
585                            query.append(_SQL_SELECT_ORGGROUPPERMISSION_WHERE);
586    
587                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
588    
589                            if (orderByComparator != null) {
590                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
591                                            orderByComparator);
592                            }
593    
594                            String sql = query.toString();
595    
596                            Session session = null;
597    
598                            try {
599                                    session = openSession();
600    
601                                    Query q = session.createQuery(sql);
602    
603                                    QueryPos qPos = QueryPos.getInstance(q);
604    
605                                    qPos.add(groupId);
606    
607                                    list = (List<OrgGroupPermission>)QueryUtil.list(q,
608                                                    getDialect(), start, end);
609                            }
610                            catch (Exception e) {
611                                    throw processException(e);
612                            }
613                            finally {
614                                    if (list == null) {
615                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
616                                    }
617                                    else {
618                                            cacheResult(list);
619    
620                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
621                                    }
622    
623                                    closeSession(session);
624                            }
625                    }
626    
627                    return list;
628            }
629    
630            /**
631             * Returns the first org group permission in the ordered set where groupId = &#63;.
632             *
633             * @param groupId the group ID
634             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
635             * @return the first matching org group permission
636             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a matching org group permission could not be found
637             * @throws SystemException if a system exception occurred
638             */
639            public OrgGroupPermission findByGroupId_First(long groupId,
640                    OrderByComparator orderByComparator)
641                    throws NoSuchOrgGroupPermissionException, SystemException {
642                    OrgGroupPermission orgGroupPermission = fetchByGroupId_First(groupId,
643                                    orderByComparator);
644    
645                    if (orgGroupPermission != null) {
646                            return orgGroupPermission;
647                    }
648    
649                    StringBundler msg = new StringBundler(4);
650    
651                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
652    
653                    msg.append("groupId=");
654                    msg.append(groupId);
655    
656                    msg.append(StringPool.CLOSE_CURLY_BRACE);
657    
658                    throw new NoSuchOrgGroupPermissionException(msg.toString());
659            }
660    
661            /**
662             * Returns the first org group permission in the ordered set where groupId = &#63;.
663             *
664             * @param groupId the group ID
665             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
666             * @return the first matching org group permission, or <code>null</code> if a matching org group permission could not be found
667             * @throws SystemException if a system exception occurred
668             */
669            public OrgGroupPermission fetchByGroupId_First(long groupId,
670                    OrderByComparator orderByComparator) throws SystemException {
671                    List<OrgGroupPermission> list = findByGroupId(groupId, 0, 1,
672                                    orderByComparator);
673    
674                    if (!list.isEmpty()) {
675                            return list.get(0);
676                    }
677    
678                    return null;
679            }
680    
681            /**
682             * Returns the last org group permission in the ordered set where groupId = &#63;.
683             *
684             * @param groupId the group ID
685             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
686             * @return the last matching org group permission
687             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a matching org group permission could not be found
688             * @throws SystemException if a system exception occurred
689             */
690            public OrgGroupPermission findByGroupId_Last(long groupId,
691                    OrderByComparator orderByComparator)
692                    throws NoSuchOrgGroupPermissionException, SystemException {
693                    OrgGroupPermission orgGroupPermission = fetchByGroupId_Last(groupId,
694                                    orderByComparator);
695    
696                    if (orgGroupPermission != null) {
697                            return orgGroupPermission;
698                    }
699    
700                    StringBundler msg = new StringBundler(4);
701    
702                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
703    
704                    msg.append("groupId=");
705                    msg.append(groupId);
706    
707                    msg.append(StringPool.CLOSE_CURLY_BRACE);
708    
709                    throw new NoSuchOrgGroupPermissionException(msg.toString());
710            }
711    
712            /**
713             * Returns the last org group permission in the ordered set where groupId = &#63;.
714             *
715             * @param groupId the group ID
716             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
717             * @return the last matching org group permission, or <code>null</code> if a matching org group permission could not be found
718             * @throws SystemException if a system exception occurred
719             */
720            public OrgGroupPermission fetchByGroupId_Last(long groupId,
721                    OrderByComparator orderByComparator) throws SystemException {
722                    int count = countByGroupId(groupId);
723    
724                    List<OrgGroupPermission> list = findByGroupId(groupId, count - 1,
725                                    count, orderByComparator);
726    
727                    if (!list.isEmpty()) {
728                            return list.get(0);
729                    }
730    
731                    return null;
732            }
733    
734            /**
735             * Returns the org group permissions before and after the current org group permission in the ordered set where groupId = &#63;.
736             *
737             * @param orgGroupPermissionPK the primary key of the current org group permission
738             * @param groupId the group ID
739             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
740             * @return the previous, current, and next org group permission
741             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a org group permission with the primary key could not be found
742             * @throws SystemException if a system exception occurred
743             */
744            public OrgGroupPermission[] findByGroupId_PrevAndNext(
745                    OrgGroupPermissionPK orgGroupPermissionPK, long groupId,
746                    OrderByComparator orderByComparator)
747                    throws NoSuchOrgGroupPermissionException, SystemException {
748                    OrgGroupPermission orgGroupPermission = findByPrimaryKey(orgGroupPermissionPK);
749    
750                    Session session = null;
751    
752                    try {
753                            session = openSession();
754    
755                            OrgGroupPermission[] array = new OrgGroupPermissionImpl[3];
756    
757                            array[0] = getByGroupId_PrevAndNext(session, orgGroupPermission,
758                                            groupId, orderByComparator, true);
759    
760                            array[1] = orgGroupPermission;
761    
762                            array[2] = getByGroupId_PrevAndNext(session, orgGroupPermission,
763                                            groupId, orderByComparator, false);
764    
765                            return array;
766                    }
767                    catch (Exception e) {
768                            throw processException(e);
769                    }
770                    finally {
771                            closeSession(session);
772                    }
773            }
774    
775            protected OrgGroupPermission getByGroupId_PrevAndNext(Session session,
776                    OrgGroupPermission orgGroupPermission, long groupId,
777                    OrderByComparator orderByComparator, boolean previous) {
778                    StringBundler query = null;
779    
780                    if (orderByComparator != null) {
781                            query = new StringBundler(6 +
782                                            (orderByComparator.getOrderByFields().length * 6));
783                    }
784                    else {
785                            query = new StringBundler(3);
786                    }
787    
788                    query.append(_SQL_SELECT_ORGGROUPPERMISSION_WHERE);
789    
790                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
791    
792                    if (orderByComparator != null) {
793                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
794    
795                            if (orderByConditionFields.length > 0) {
796                                    query.append(WHERE_AND);
797                            }
798    
799                            for (int i = 0; i < orderByConditionFields.length; i++) {
800                                    query.append(_ORDER_BY_ENTITY_ALIAS);
801                                    query.append(orderByConditionFields[i]);
802    
803                                    if ((i + 1) < orderByConditionFields.length) {
804                                            if (orderByComparator.isAscending() ^ previous) {
805                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
806                                            }
807                                            else {
808                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
809                                            }
810                                    }
811                                    else {
812                                            if (orderByComparator.isAscending() ^ previous) {
813                                                    query.append(WHERE_GREATER_THAN);
814                                            }
815                                            else {
816                                                    query.append(WHERE_LESSER_THAN);
817                                            }
818                                    }
819                            }
820    
821                            query.append(ORDER_BY_CLAUSE);
822    
823                            String[] orderByFields = orderByComparator.getOrderByFields();
824    
825                            for (int i = 0; i < orderByFields.length; i++) {
826                                    query.append(_ORDER_BY_ENTITY_ALIAS);
827                                    query.append(orderByFields[i]);
828    
829                                    if ((i + 1) < orderByFields.length) {
830                                            if (orderByComparator.isAscending() ^ previous) {
831                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
832                                            }
833                                            else {
834                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
835                                            }
836                                    }
837                                    else {
838                                            if (orderByComparator.isAscending() ^ previous) {
839                                                    query.append(ORDER_BY_ASC);
840                                            }
841                                            else {
842                                                    query.append(ORDER_BY_DESC);
843                                            }
844                                    }
845                            }
846                    }
847    
848                    String sql = query.toString();
849    
850                    Query q = session.createQuery(sql);
851    
852                    q.setFirstResult(0);
853                    q.setMaxResults(2);
854    
855                    QueryPos qPos = QueryPos.getInstance(q);
856    
857                    qPos.add(groupId);
858    
859                    if (orderByComparator != null) {
860                            Object[] values = orderByComparator.getOrderByConditionValues(orgGroupPermission);
861    
862                            for (Object value : values) {
863                                    qPos.add(value);
864                            }
865                    }
866    
867                    List<OrgGroupPermission> list = q.list();
868    
869                    if (list.size() == 2) {
870                            return list.get(1);
871                    }
872                    else {
873                            return null;
874                    }
875            }
876    
877            /**
878             * Returns all the org group permissions where permissionId = &#63;.
879             *
880             * @param permissionId the permission ID
881             * @return the matching org group permissions
882             * @throws SystemException if a system exception occurred
883             */
884            public List<OrgGroupPermission> findByPermissionId(long permissionId)
885                    throws SystemException {
886                    return findByPermissionId(permissionId, QueryUtil.ALL_POS,
887                            QueryUtil.ALL_POS, null);
888            }
889    
890            /**
891             * Returns a range of all the org group permissions where permissionId = &#63;.
892             *
893             * <p>
894             * 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.
895             * </p>
896             *
897             * @param permissionId the permission ID
898             * @param start the lower bound of the range of org group permissions
899             * @param end the upper bound of the range of org group permissions (not inclusive)
900             * @return the range of matching org group permissions
901             * @throws SystemException if a system exception occurred
902             */
903            public List<OrgGroupPermission> findByPermissionId(long permissionId,
904                    int start, int end) throws SystemException {
905                    return findByPermissionId(permissionId, start, end, null);
906            }
907    
908            /**
909             * Returns an ordered range of all the org group permissions where permissionId = &#63;.
910             *
911             * <p>
912             * 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.
913             * </p>
914             *
915             * @param permissionId the permission ID
916             * @param start the lower bound of the range of org group permissions
917             * @param end the upper bound of the range of org group permissions (not inclusive)
918             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
919             * @return the ordered range of matching org group permissions
920             * @throws SystemException if a system exception occurred
921             */
922            public List<OrgGroupPermission> findByPermissionId(long permissionId,
923                    int start, int end, OrderByComparator orderByComparator)
924                    throws SystemException {
925                    FinderPath finderPath = null;
926                    Object[] finderArgs = null;
927    
928                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
929                                    (orderByComparator == null)) {
930                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_PERMISSIONID;
931                            finderArgs = new Object[] { permissionId };
932                    }
933                    else {
934                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_PERMISSIONID;
935                            finderArgs = new Object[] {
936                                            permissionId,
937                                            
938                                            start, end, orderByComparator
939                                    };
940                    }
941    
942                    List<OrgGroupPermission> list = (List<OrgGroupPermission>)FinderCacheUtil.getResult(finderPath,
943                                    finderArgs, this);
944    
945                    if ((list != null) && !list.isEmpty()) {
946                            for (OrgGroupPermission orgGroupPermission : list) {
947                                    if ((permissionId != orgGroupPermission.getPermissionId())) {
948                                            list = null;
949    
950                                            break;
951                                    }
952                            }
953                    }
954    
955                    if (list == null) {
956                            StringBundler query = null;
957    
958                            if (orderByComparator != null) {
959                                    query = new StringBundler(3 +
960                                                    (orderByComparator.getOrderByFields().length * 3));
961                            }
962                            else {
963                                    query = new StringBundler(2);
964                            }
965    
966                            query.append(_SQL_SELECT_ORGGROUPPERMISSION_WHERE);
967    
968                            query.append(_FINDER_COLUMN_PERMISSIONID_PERMISSIONID_2);
969    
970                            if (orderByComparator != null) {
971                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
972                                            orderByComparator);
973                            }
974    
975                            String sql = query.toString();
976    
977                            Session session = null;
978    
979                            try {
980                                    session = openSession();
981    
982                                    Query q = session.createQuery(sql);
983    
984                                    QueryPos qPos = QueryPos.getInstance(q);
985    
986                                    qPos.add(permissionId);
987    
988                                    list = (List<OrgGroupPermission>)QueryUtil.list(q,
989                                                    getDialect(), start, end);
990                            }
991                            catch (Exception e) {
992                                    throw processException(e);
993                            }
994                            finally {
995                                    if (list == null) {
996                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
997                                    }
998                                    else {
999                                            cacheResult(list);
1000    
1001                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1002                                    }
1003    
1004                                    closeSession(session);
1005                            }
1006                    }
1007    
1008                    return list;
1009            }
1010    
1011            /**
1012             * Returns the first org group permission in the ordered set where permissionId = &#63;.
1013             *
1014             * @param permissionId the permission ID
1015             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1016             * @return the first matching org group permission
1017             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a matching org group permission could not be found
1018             * @throws SystemException if a system exception occurred
1019             */
1020            public OrgGroupPermission findByPermissionId_First(long permissionId,
1021                    OrderByComparator orderByComparator)
1022                    throws NoSuchOrgGroupPermissionException, SystemException {
1023                    OrgGroupPermission orgGroupPermission = fetchByPermissionId_First(permissionId,
1024                                    orderByComparator);
1025    
1026                    if (orgGroupPermission != null) {
1027                            return orgGroupPermission;
1028                    }
1029    
1030                    StringBundler msg = new StringBundler(4);
1031    
1032                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1033    
1034                    msg.append("permissionId=");
1035                    msg.append(permissionId);
1036    
1037                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1038    
1039                    throw new NoSuchOrgGroupPermissionException(msg.toString());
1040            }
1041    
1042            /**
1043             * Returns the first org group permission in the ordered set where permissionId = &#63;.
1044             *
1045             * @param permissionId the permission ID
1046             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1047             * @return the first matching org group permission, or <code>null</code> if a matching org group permission could not be found
1048             * @throws SystemException if a system exception occurred
1049             */
1050            public OrgGroupPermission fetchByPermissionId_First(long permissionId,
1051                    OrderByComparator orderByComparator) throws SystemException {
1052                    List<OrgGroupPermission> list = findByPermissionId(permissionId, 0, 1,
1053                                    orderByComparator);
1054    
1055                    if (!list.isEmpty()) {
1056                            return list.get(0);
1057                    }
1058    
1059                    return null;
1060            }
1061    
1062            /**
1063             * Returns the last org group permission in the ordered set where permissionId = &#63;.
1064             *
1065             * @param permissionId the permission ID
1066             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1067             * @return the last matching org group permission
1068             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a matching org group permission could not be found
1069             * @throws SystemException if a system exception occurred
1070             */
1071            public OrgGroupPermission findByPermissionId_Last(long permissionId,
1072                    OrderByComparator orderByComparator)
1073                    throws NoSuchOrgGroupPermissionException, SystemException {
1074                    OrgGroupPermission orgGroupPermission = fetchByPermissionId_Last(permissionId,
1075                                    orderByComparator);
1076    
1077                    if (orgGroupPermission != null) {
1078                            return orgGroupPermission;
1079                    }
1080    
1081                    StringBundler msg = new StringBundler(4);
1082    
1083                    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1084    
1085                    msg.append("permissionId=");
1086                    msg.append(permissionId);
1087    
1088                    msg.append(StringPool.CLOSE_CURLY_BRACE);
1089    
1090                    throw new NoSuchOrgGroupPermissionException(msg.toString());
1091            }
1092    
1093            /**
1094             * Returns the last org group permission in the ordered set where permissionId = &#63;.
1095             *
1096             * @param permissionId the permission ID
1097             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1098             * @return the last matching org group permission, or <code>null</code> if a matching org group permission could not be found
1099             * @throws SystemException if a system exception occurred
1100             */
1101            public OrgGroupPermission fetchByPermissionId_Last(long permissionId,
1102                    OrderByComparator orderByComparator) throws SystemException {
1103                    int count = countByPermissionId(permissionId);
1104    
1105                    List<OrgGroupPermission> list = findByPermissionId(permissionId,
1106                                    count - 1, count, orderByComparator);
1107    
1108                    if (!list.isEmpty()) {
1109                            return list.get(0);
1110                    }
1111    
1112                    return null;
1113            }
1114    
1115            /**
1116             * Returns the org group permissions before and after the current org group permission in the ordered set where permissionId = &#63;.
1117             *
1118             * @param orgGroupPermissionPK the primary key of the current org group permission
1119             * @param permissionId the permission ID
1120             * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
1121             * @return the previous, current, and next org group permission
1122             * @throws com.liferay.portal.NoSuchOrgGroupPermissionException if a org group permission with the primary key could not be found
1123             * @throws SystemException if a system exception occurred
1124             */
1125            public OrgGroupPermission[] findByPermissionId_PrevAndNext(
1126                    OrgGroupPermissionPK orgGroupPermissionPK, long permissionId,
1127                    OrderByComparator orderByComparator)
1128                    throws NoSuchOrgGroupPermissionException, SystemException {
1129                    OrgGroupPermission orgGroupPermission = findByPrimaryKey(orgGroupPermissionPK);
1130    
1131                    Session session = null;
1132    
1133                    try {
1134                            session = openSession();
1135    
1136                            OrgGroupPermission[] array = new OrgGroupPermissionImpl[3];
1137    
1138                            array[0] = getByPermissionId_PrevAndNext(session,
1139                                            orgGroupPermission, permissionId, orderByComparator, true);
1140    
1141                            array[1] = orgGroupPermission;
1142    
1143                            array[2] = getByPermissionId_PrevAndNext(session,
1144                                            orgGroupPermission, permissionId, orderByComparator, false);
1145    
1146                            return array;
1147                    }
1148                    catch (Exception e) {
1149                            throw processException(e);
1150                    }
1151                    finally {
1152                            closeSession(session);
1153                    }
1154            }
1155    
1156            protected OrgGroupPermission getByPermissionId_PrevAndNext(
1157                    Session session, OrgGroupPermission orgGroupPermission,
1158                    long permissionId, OrderByComparator orderByComparator, boolean previous) {
1159                    StringBundler query = null;
1160    
1161                    if (orderByComparator != null) {
1162                            query = new StringBundler(6 +
1163                                            (orderByComparator.getOrderByFields().length * 6));
1164                    }
1165                    else {
1166                            query = new StringBundler(3);
1167                    }
1168    
1169                    query.append(_SQL_SELECT_ORGGROUPPERMISSION_WHERE);
1170    
1171                    query.append(_FINDER_COLUMN_PERMISSIONID_PERMISSIONID_2);
1172    
1173                    if (orderByComparator != null) {
1174                            String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1175    
1176                            if (orderByConditionFields.length > 0) {
1177                                    query.append(WHERE_AND);
1178                            }
1179    
1180                            for (int i = 0; i < orderByConditionFields.length; i++) {
1181                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1182                                    query.append(orderByConditionFields[i]);
1183    
1184                                    if ((i + 1) < orderByConditionFields.length) {
1185                                            if (orderByComparator.isAscending() ^ previous) {
1186                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1187                                            }
1188                                            else {
1189                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1190                                            }
1191                                    }
1192                                    else {
1193                                            if (orderByComparator.isAscending() ^ previous) {
1194                                                    query.append(WHERE_GREATER_THAN);
1195                                            }
1196                                            else {
1197                                                    query.append(WHERE_LESSER_THAN);
1198                                            }
1199                                    }
1200                            }
1201    
1202                            query.append(ORDER_BY_CLAUSE);
1203    
1204                            String[] orderByFields = orderByComparator.getOrderByFields();
1205    
1206                            for (int i = 0; i < orderByFields.length; i++) {
1207                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1208                                    query.append(orderByFields[i]);
1209    
1210                                    if ((i + 1) < orderByFields.length) {
1211                                            if (orderByComparator.isAscending() ^ previous) {
1212                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1213                                            }
1214                                            else {
1215                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1216                                            }
1217                                    }
1218                                    else {
1219                                            if (orderByComparator.isAscending() ^ previous) {
1220                                                    query.append(ORDER_BY_ASC);
1221                                            }
1222                                            else {
1223                                                    query.append(ORDER_BY_DESC);
1224                                            }
1225                                    }
1226                            }
1227                    }
1228    
1229                    String sql = query.toString();
1230    
1231                    Query q = session.createQuery(sql);
1232    
1233                    q.setFirstResult(0);
1234                    q.setMaxResults(2);
1235    
1236                    QueryPos qPos = QueryPos.getInstance(q);
1237    
1238                    qPos.add(permissionId);
1239    
1240                    if (orderByComparator != null) {
1241                            Object[] values = orderByComparator.getOrderByConditionValues(orgGroupPermission);
1242    
1243                            for (Object value : values) {
1244                                    qPos.add(value);
1245                            }
1246                    }
1247    
1248                    List<OrgGroupPermission> list = q.list();
1249    
1250                    if (list.size() == 2) {
1251                            return list.get(1);
1252                    }
1253                    else {
1254                            return null;
1255                    }
1256            }
1257    
1258            /**
1259             * Returns all the org group permissions.
1260             *
1261             * @return the org group permissions
1262             * @throws SystemException if a system exception occurred
1263             */
1264            public List<OrgGroupPermission> findAll() throws SystemException {
1265                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1266            }
1267    
1268            /**
1269             * Returns a range of all the org group permissions.
1270             *
1271             * <p>
1272             * 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.
1273             * </p>
1274             *
1275             * @param start the lower bound of the range of org group permissions
1276             * @param end the upper bound of the range of org group permissions (not inclusive)
1277             * @return the range of org group permissions
1278             * @throws SystemException if a system exception occurred
1279             */
1280            public List<OrgGroupPermission> findAll(int start, int end)
1281                    throws SystemException {
1282                    return findAll(start, end, null);
1283            }
1284    
1285            /**
1286             * Returns an ordered range of all the org group permissions.
1287             *
1288             * <p>
1289             * 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.
1290             * </p>
1291             *
1292             * @param start the lower bound of the range of org group permissions
1293             * @param end the upper bound of the range of org group permissions (not inclusive)
1294             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
1295             * @return the ordered range of org group permissions
1296             * @throws SystemException if a system exception occurred
1297             */
1298            public List<OrgGroupPermission> findAll(int start, int end,
1299                    OrderByComparator orderByComparator) throws SystemException {
1300                    FinderPath finderPath = null;
1301                    Object[] finderArgs = new Object[] { start, end, orderByComparator };
1302    
1303                    if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1304                                    (orderByComparator == null)) {
1305                            finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
1306                            finderArgs = FINDER_ARGS_EMPTY;
1307                    }
1308                    else {
1309                            finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
1310                            finderArgs = new Object[] { start, end, orderByComparator };
1311                    }
1312    
1313                    List<OrgGroupPermission> list = (List<OrgGroupPermission>)FinderCacheUtil.getResult(finderPath,
1314                                    finderArgs, this);
1315    
1316                    if (list == null) {
1317                            StringBundler query = null;
1318                            String sql = null;
1319    
1320                            if (orderByComparator != null) {
1321                                    query = new StringBundler(2 +
1322                                                    (orderByComparator.getOrderByFields().length * 3));
1323    
1324                                    query.append(_SQL_SELECT_ORGGROUPPERMISSION);
1325    
1326                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1327                                            orderByComparator);
1328    
1329                                    sql = query.toString();
1330                            }
1331                            else {
1332                                    sql = _SQL_SELECT_ORGGROUPPERMISSION;
1333                            }
1334    
1335                            Session session = null;
1336    
1337                            try {
1338                                    session = openSession();
1339    
1340                                    Query q = session.createQuery(sql);
1341    
1342                                    if (orderByComparator == null) {
1343                                            list = (List<OrgGroupPermission>)QueryUtil.list(q,
1344                                                            getDialect(), start, end, false);
1345    
1346                                            Collections.sort(list);
1347                                    }
1348                                    else {
1349                                            list = (List<OrgGroupPermission>)QueryUtil.list(q,
1350                                                            getDialect(), start, end);
1351                                    }
1352                            }
1353                            catch (Exception e) {
1354                                    throw processException(e);
1355                            }
1356                            finally {
1357                                    if (list == null) {
1358                                            FinderCacheUtil.removeResult(finderPath, finderArgs);
1359                                    }
1360                                    else {
1361                                            cacheResult(list);
1362    
1363                                            FinderCacheUtil.putResult(finderPath, finderArgs, list);
1364                                    }
1365    
1366                                    closeSession(session);
1367                            }
1368                    }
1369    
1370                    return list;
1371            }
1372    
1373            /**
1374             * Removes all the org group permissions where groupId = &#63; from the database.
1375             *
1376             * @param groupId the group ID
1377             * @throws SystemException if a system exception occurred
1378             */
1379            public void removeByGroupId(long groupId) throws SystemException {
1380                    for (OrgGroupPermission orgGroupPermission : findByGroupId(groupId)) {
1381                            remove(orgGroupPermission);
1382                    }
1383            }
1384    
1385            /**
1386             * Removes all the org group permissions where permissionId = &#63; from the database.
1387             *
1388             * @param permissionId the permission ID
1389             * @throws SystemException if a system exception occurred
1390             */
1391            public void removeByPermissionId(long permissionId)
1392                    throws SystemException {
1393                    for (OrgGroupPermission orgGroupPermission : findByPermissionId(
1394                                    permissionId)) {
1395                            remove(orgGroupPermission);
1396                    }
1397            }
1398    
1399            /**
1400             * Removes all the org group permissions from the database.
1401             *
1402             * @throws SystemException if a system exception occurred
1403             */
1404            public void removeAll() throws SystemException {
1405                    for (OrgGroupPermission orgGroupPermission : findAll()) {
1406                            remove(orgGroupPermission);
1407                    }
1408            }
1409    
1410            /**
1411             * Returns the number of org group permissions where groupId = &#63;.
1412             *
1413             * @param groupId the group ID
1414             * @return the number of matching org group permissions
1415             * @throws SystemException if a system exception occurred
1416             */
1417            public int countByGroupId(long groupId) throws SystemException {
1418                    Object[] finderArgs = new Object[] { groupId };
1419    
1420                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
1421                                    finderArgs, this);
1422    
1423                    if (count == null) {
1424                            StringBundler query = new StringBundler(2);
1425    
1426                            query.append(_SQL_COUNT_ORGGROUPPERMISSION_WHERE);
1427    
1428                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1429    
1430                            String sql = query.toString();
1431    
1432                            Session session = null;
1433    
1434                            try {
1435                                    session = openSession();
1436    
1437                                    Query q = session.createQuery(sql);
1438    
1439                                    QueryPos qPos = QueryPos.getInstance(q);
1440    
1441                                    qPos.add(groupId);
1442    
1443                                    count = (Long)q.uniqueResult();
1444                            }
1445                            catch (Exception e) {
1446                                    throw processException(e);
1447                            }
1448                            finally {
1449                                    if (count == null) {
1450                                            count = Long.valueOf(0);
1451                                    }
1452    
1453                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
1454                                            finderArgs, count);
1455    
1456                                    closeSession(session);
1457                            }
1458                    }
1459    
1460                    return count.intValue();
1461            }
1462    
1463            /**
1464             * Returns the number of org group permissions where permissionId = &#63;.
1465             *
1466             * @param permissionId the permission ID
1467             * @return the number of matching org group permissions
1468             * @throws SystemException if a system exception occurred
1469             */
1470            public int countByPermissionId(long permissionId) throws SystemException {
1471                    Object[] finderArgs = new Object[] { permissionId };
1472    
1473                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PERMISSIONID,
1474                                    finderArgs, this);
1475    
1476                    if (count == null) {
1477                            StringBundler query = new StringBundler(2);
1478    
1479                            query.append(_SQL_COUNT_ORGGROUPPERMISSION_WHERE);
1480    
1481                            query.append(_FINDER_COLUMN_PERMISSIONID_PERMISSIONID_2);
1482    
1483                            String sql = query.toString();
1484    
1485                            Session session = null;
1486    
1487                            try {
1488                                    session = openSession();
1489    
1490                                    Query q = session.createQuery(sql);
1491    
1492                                    QueryPos qPos = QueryPos.getInstance(q);
1493    
1494                                    qPos.add(permissionId);
1495    
1496                                    count = (Long)q.uniqueResult();
1497                            }
1498                            catch (Exception e) {
1499                                    throw processException(e);
1500                            }
1501                            finally {
1502                                    if (count == null) {
1503                                            count = Long.valueOf(0);
1504                                    }
1505    
1506                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PERMISSIONID,
1507                                            finderArgs, count);
1508    
1509                                    closeSession(session);
1510                            }
1511                    }
1512    
1513                    return count.intValue();
1514            }
1515    
1516            /**
1517             * Returns the number of org group permissions.
1518             *
1519             * @return the number of org group permissions
1520             * @throws SystemException if a system exception occurred
1521             */
1522            public int countAll() throws SystemException {
1523                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1524                                    FINDER_ARGS_EMPTY, this);
1525    
1526                    if (count == null) {
1527                            Session session = null;
1528    
1529                            try {
1530                                    session = openSession();
1531    
1532                                    Query q = session.createQuery(_SQL_COUNT_ORGGROUPPERMISSION);
1533    
1534                                    count = (Long)q.uniqueResult();
1535                            }
1536                            catch (Exception e) {
1537                                    throw processException(e);
1538                            }
1539                            finally {
1540                                    if (count == null) {
1541                                            count = Long.valueOf(0);
1542                                    }
1543    
1544                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
1545                                            FINDER_ARGS_EMPTY, count);
1546    
1547                                    closeSession(session);
1548                            }
1549                    }
1550    
1551                    return count.intValue();
1552            }
1553    
1554            /**
1555             * Initializes the org group permission persistence.
1556             */
1557            public void afterPropertiesSet() {
1558                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1559                                            com.liferay.portal.util.PropsUtil.get(
1560                                                    "value.object.listener.com.liferay.portal.model.OrgGroupPermission")));
1561    
1562                    if (listenerClassNames.length > 0) {
1563                            try {
1564                                    List<ModelListener<OrgGroupPermission>> listenersList = new ArrayList<ModelListener<OrgGroupPermission>>();
1565    
1566                                    for (String listenerClassName : listenerClassNames) {
1567                                            Class<?> clazz = getClass();
1568    
1569                                            listenersList.add((ModelListener<OrgGroupPermission>)InstanceFactory.newInstance(
1570                                                            clazz.getClassLoader(), listenerClassName));
1571                                    }
1572    
1573                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1574                            }
1575                            catch (Exception e) {
1576                                    _log.error(e);
1577                            }
1578                    }
1579            }
1580    
1581            public void destroy() {
1582                    EntityCacheUtil.removeCache(OrgGroupPermissionImpl.class.getName());
1583                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
1584                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
1585            }
1586    
1587            @BeanReference(type = AccountPersistence.class)
1588            protected AccountPersistence accountPersistence;
1589            @BeanReference(type = AddressPersistence.class)
1590            protected AddressPersistence addressPersistence;
1591            @BeanReference(type = BrowserTrackerPersistence.class)
1592            protected BrowserTrackerPersistence browserTrackerPersistence;
1593            @BeanReference(type = ClassNamePersistence.class)
1594            protected ClassNamePersistence classNamePersistence;
1595            @BeanReference(type = ClusterGroupPersistence.class)
1596            protected ClusterGroupPersistence clusterGroupPersistence;
1597            @BeanReference(type = CompanyPersistence.class)
1598            protected CompanyPersistence companyPersistence;
1599            @BeanReference(type = ContactPersistence.class)
1600            protected ContactPersistence contactPersistence;
1601            @BeanReference(type = CountryPersistence.class)
1602            protected CountryPersistence countryPersistence;
1603            @BeanReference(type = EmailAddressPersistence.class)
1604            protected EmailAddressPersistence emailAddressPersistence;
1605            @BeanReference(type = GroupPersistence.class)
1606            protected GroupPersistence groupPersistence;
1607            @BeanReference(type = ImagePersistence.class)
1608            protected ImagePersistence imagePersistence;
1609            @BeanReference(type = LayoutPersistence.class)
1610            protected LayoutPersistence layoutPersistence;
1611            @BeanReference(type = LayoutBranchPersistence.class)
1612            protected LayoutBranchPersistence layoutBranchPersistence;
1613            @BeanReference(type = LayoutPrototypePersistence.class)
1614            protected LayoutPrototypePersistence layoutPrototypePersistence;
1615            @BeanReference(type = LayoutRevisionPersistence.class)
1616            protected LayoutRevisionPersistence layoutRevisionPersistence;
1617            @BeanReference(type = LayoutSetPersistence.class)
1618            protected LayoutSetPersistence layoutSetPersistence;
1619            @BeanReference(type = LayoutSetBranchPersistence.class)
1620            protected LayoutSetBranchPersistence layoutSetBranchPersistence;
1621            @BeanReference(type = LayoutSetPrototypePersistence.class)
1622            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1623            @BeanReference(type = ListTypePersistence.class)
1624            protected ListTypePersistence listTypePersistence;
1625            @BeanReference(type = LockPersistence.class)
1626            protected LockPersistence lockPersistence;
1627            @BeanReference(type = MembershipRequestPersistence.class)
1628            protected MembershipRequestPersistence membershipRequestPersistence;
1629            @BeanReference(type = OrganizationPersistence.class)
1630            protected OrganizationPersistence organizationPersistence;
1631            @BeanReference(type = OrgGroupPermissionPersistence.class)
1632            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1633            @BeanReference(type = OrgGroupRolePersistence.class)
1634            protected OrgGroupRolePersistence orgGroupRolePersistence;
1635            @BeanReference(type = OrgLaborPersistence.class)
1636            protected OrgLaborPersistence orgLaborPersistence;
1637            @BeanReference(type = PasswordPolicyPersistence.class)
1638            protected PasswordPolicyPersistence passwordPolicyPersistence;
1639            @BeanReference(type = PasswordPolicyRelPersistence.class)
1640            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1641            @BeanReference(type = PasswordTrackerPersistence.class)
1642            protected PasswordTrackerPersistence passwordTrackerPersistence;
1643            @BeanReference(type = PermissionPersistence.class)
1644            protected PermissionPersistence permissionPersistence;
1645            @BeanReference(type = PhonePersistence.class)
1646            protected PhonePersistence phonePersistence;
1647            @BeanReference(type = PluginSettingPersistence.class)
1648            protected PluginSettingPersistence pluginSettingPersistence;
1649            @BeanReference(type = PortalPreferencesPersistence.class)
1650            protected PortalPreferencesPersistence portalPreferencesPersistence;
1651            @BeanReference(type = PortletPersistence.class)
1652            protected PortletPersistence portletPersistence;
1653            @BeanReference(type = PortletItemPersistence.class)
1654            protected PortletItemPersistence portletItemPersistence;
1655            @BeanReference(type = PortletPreferencesPersistence.class)
1656            protected PortletPreferencesPersistence portletPreferencesPersistence;
1657            @BeanReference(type = RegionPersistence.class)
1658            protected RegionPersistence regionPersistence;
1659            @BeanReference(type = ReleasePersistence.class)
1660            protected ReleasePersistence releasePersistence;
1661            @BeanReference(type = RepositoryPersistence.class)
1662            protected RepositoryPersistence repositoryPersistence;
1663            @BeanReference(type = RepositoryEntryPersistence.class)
1664            protected RepositoryEntryPersistence repositoryEntryPersistence;
1665            @BeanReference(type = ResourcePersistence.class)
1666            protected ResourcePersistence resourcePersistence;
1667            @BeanReference(type = ResourceActionPersistence.class)
1668            protected ResourceActionPersistence resourceActionPersistence;
1669            @BeanReference(type = ResourceBlockPersistence.class)
1670            protected ResourceBlockPersistence resourceBlockPersistence;
1671            @BeanReference(type = ResourceBlockPermissionPersistence.class)
1672            protected ResourceBlockPermissionPersistence resourceBlockPermissionPersistence;
1673            @BeanReference(type = ResourceCodePersistence.class)
1674            protected ResourceCodePersistence resourceCodePersistence;
1675            @BeanReference(type = ResourcePermissionPersistence.class)
1676            protected ResourcePermissionPersistence resourcePermissionPersistence;
1677            @BeanReference(type = ResourceTypePermissionPersistence.class)
1678            protected ResourceTypePermissionPersistence resourceTypePermissionPersistence;
1679            @BeanReference(type = RolePersistence.class)
1680            protected RolePersistence rolePersistence;
1681            @BeanReference(type = ServiceComponentPersistence.class)
1682            protected ServiceComponentPersistence serviceComponentPersistence;
1683            @BeanReference(type = ShardPersistence.class)
1684            protected ShardPersistence shardPersistence;
1685            @BeanReference(type = SubscriptionPersistence.class)
1686            protected SubscriptionPersistence subscriptionPersistence;
1687            @BeanReference(type = TeamPersistence.class)
1688            protected TeamPersistence teamPersistence;
1689            @BeanReference(type = TicketPersistence.class)
1690            protected TicketPersistence ticketPersistence;
1691            @BeanReference(type = UserPersistence.class)
1692            protected UserPersistence userPersistence;
1693            @BeanReference(type = UserGroupPersistence.class)
1694            protected UserGroupPersistence userGroupPersistence;
1695            @BeanReference(type = UserGroupGroupRolePersistence.class)
1696            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1697            @BeanReference(type = UserGroupRolePersistence.class)
1698            protected UserGroupRolePersistence userGroupRolePersistence;
1699            @BeanReference(type = UserIdMapperPersistence.class)
1700            protected UserIdMapperPersistence userIdMapperPersistence;
1701            @BeanReference(type = UserNotificationEventPersistence.class)
1702            protected UserNotificationEventPersistence userNotificationEventPersistence;
1703            @BeanReference(type = UserTrackerPersistence.class)
1704            protected UserTrackerPersistence userTrackerPersistence;
1705            @BeanReference(type = UserTrackerPathPersistence.class)
1706            protected UserTrackerPathPersistence userTrackerPathPersistence;
1707            @BeanReference(type = VirtualHostPersistence.class)
1708            protected VirtualHostPersistence virtualHostPersistence;
1709            @BeanReference(type = WebDAVPropsPersistence.class)
1710            protected WebDAVPropsPersistence webDAVPropsPersistence;
1711            @BeanReference(type = WebsitePersistence.class)
1712            protected WebsitePersistence websitePersistence;
1713            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1714            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1715            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1716            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1717            private static final String _SQL_SELECT_ORGGROUPPERMISSION = "SELECT orgGroupPermission FROM OrgGroupPermission orgGroupPermission";
1718            private static final String _SQL_SELECT_ORGGROUPPERMISSION_WHERE = "SELECT orgGroupPermission FROM OrgGroupPermission orgGroupPermission WHERE ";
1719            private static final String _SQL_COUNT_ORGGROUPPERMISSION = "SELECT COUNT(orgGroupPermission) FROM OrgGroupPermission orgGroupPermission";
1720            private static final String _SQL_COUNT_ORGGROUPPERMISSION_WHERE = "SELECT COUNT(orgGroupPermission) FROM OrgGroupPermission orgGroupPermission WHERE ";
1721            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "orgGroupPermission.id.groupId = ?";
1722            private static final String _FINDER_COLUMN_PERMISSIONID_PERMISSIONID_2 = "orgGroupPermission.id.permissionId = ?";
1723            private static final String _ORDER_BY_ENTITY_ALIAS = "orgGroupPermission.";
1724            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No OrgGroupPermission exists with the primary key ";
1725            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No OrgGroupPermission exists with the key {";
1726            private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
1727            private static Log _log = LogFactoryUtil.getLog(OrgGroupPermissionPersistenceImpl.class);
1728            private static OrgGroupPermission _nullOrgGroupPermission = new OrgGroupPermissionImpl() {
1729                            @Override
1730                            public Object clone() {
1731                                    return this;
1732                            }
1733    
1734                            @Override
1735                            public CacheModel<OrgGroupPermission> toCacheModel() {
1736                                    return _nullOrgGroupPermissionCacheModel;
1737                            }
1738                    };
1739    
1740            private static CacheModel<OrgGroupPermission> _nullOrgGroupPermissionCacheModel =
1741                    new CacheModel<OrgGroupPermission>() {
1742                            public OrgGroupPermission toEntityModel() {
1743                                    return _nullOrgGroupPermission;
1744                            }
1745                    };
1746    }