001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.persistence;
016    
017    import com.liferay.portal.NoSuchModelException;
018    import com.liferay.portal.NoSuchResourceException;
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.cache.CacheRegistryUtil;
021    import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
022    import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023    import com.liferay.portal.kernel.dao.orm.FinderPath;
024    import com.liferay.portal.kernel.dao.orm.Query;
025    import com.liferay.portal.kernel.dao.orm.QueryPos;
026    import com.liferay.portal.kernel.dao.orm.QueryUtil;
027    import com.liferay.portal.kernel.dao.orm.Session;
028    import com.liferay.portal.kernel.exception.SystemException;
029    import com.liferay.portal.kernel.log.Log;
030    import com.liferay.portal.kernel.log.LogFactoryUtil;
031    import com.liferay.portal.kernel.util.GetterUtil;
032    import com.liferay.portal.kernel.util.InstanceFactory;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.StringBundler;
035    import com.liferay.portal.kernel.util.StringPool;
036    import com.liferay.portal.kernel.util.StringUtil;
037    import com.liferay.portal.kernel.util.Validator;
038    import com.liferay.portal.model.ModelListener;
039    import com.liferay.portal.model.Resource;
040    import com.liferay.portal.model.impl.ResourceImpl;
041    import com.liferay.portal.model.impl.ResourceModelImpl;
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 for the resource service.
052     *
053     * <p>
054     * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regnerate this class.
055     * </p>
056     *
057     * <p>
058     * Caching information and settings can be found in <code>portal.properties</code>
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see ResourcePersistence
063     * @see ResourceUtil
064     * @generated
065     */
066    public class ResourcePersistenceImpl extends BasePersistenceImpl<Resource>
067            implements ResourcePersistence {
068            public static final String FINDER_CLASS_NAME_ENTITY = ResourceImpl.class.getName();
069            public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
070                    ".List";
071            public static final FinderPath FINDER_PATH_FIND_BY_CODEID = new FinderPath(ResourceModelImpl.ENTITY_CACHE_ENABLED,
072                            ResourceModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
073                            "findByCodeId",
074                            new String[] {
075                                    Long.class.getName(),
076                                    
077                            "java.lang.Integer", "java.lang.Integer",
078                                    "com.liferay.portal.kernel.util.OrderByComparator"
079                            });
080            public static final FinderPath FINDER_PATH_COUNT_BY_CODEID = new FinderPath(ResourceModelImpl.ENTITY_CACHE_ENABLED,
081                            ResourceModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
082                            "countByCodeId", new String[] { Long.class.getName() });
083            public static final FinderPath FINDER_PATH_FETCH_BY_C_P = new FinderPath(ResourceModelImpl.ENTITY_CACHE_ENABLED,
084                            ResourceModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_ENTITY,
085                            "fetchByC_P",
086                            new String[] { Long.class.getName(), String.class.getName() });
087            public static final FinderPath FINDER_PATH_COUNT_BY_C_P = new FinderPath(ResourceModelImpl.ENTITY_CACHE_ENABLED,
088                            ResourceModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
089                            "countByC_P",
090                            new String[] { Long.class.getName(), String.class.getName() });
091            public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(ResourceModelImpl.ENTITY_CACHE_ENABLED,
092                            ResourceModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
093                            "findAll", new String[0]);
094            public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(ResourceModelImpl.ENTITY_CACHE_ENABLED,
095                            ResourceModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
096                            "countAll", new String[0]);
097    
098            /**
099             * Caches the resource in the entity cache if it is enabled.
100             *
101             * @param resource the resource to cache
102             */
103            public void cacheResult(Resource resource) {
104                    EntityCacheUtil.putResult(ResourceModelImpl.ENTITY_CACHE_ENABLED,
105                            ResourceImpl.class, resource.getPrimaryKey(), resource);
106    
107                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_P,
108                            new Object[] { new Long(resource.getCodeId()), resource.getPrimKey() },
109                            resource);
110            }
111    
112            /**
113             * Caches the resources in the entity cache if it is enabled.
114             *
115             * @param resources the resources to cache
116             */
117            public void cacheResult(List<Resource> resources) {
118                    for (Resource resource : resources) {
119                            if (EntityCacheUtil.getResult(
120                                                    ResourceModelImpl.ENTITY_CACHE_ENABLED,
121                                                    ResourceImpl.class, resource.getPrimaryKey(), this) == null) {
122                                    cacheResult(resource);
123                            }
124                    }
125            }
126    
127            /**
128             * Clears the cache for all resources.
129             *
130             * <p>
131             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
132             * </p>
133             */
134            public void clearCache() {
135                    CacheRegistryUtil.clear(ResourceImpl.class.getName());
136                    EntityCacheUtil.clearCache(ResourceImpl.class.getName());
137                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
138                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
139            }
140    
141            /**
142             * Clears the cache for the resource.
143             *
144             * <p>
145             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
146             * </p>
147             */
148            public void clearCache(Resource resource) {
149                    EntityCacheUtil.removeResult(ResourceModelImpl.ENTITY_CACHE_ENABLED,
150                            ResourceImpl.class, resource.getPrimaryKey());
151    
152                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_P,
153                            new Object[] { new Long(resource.getCodeId()), resource.getPrimKey() });
154            }
155    
156            /**
157             * Creates a new resource with the primary key.
158             *
159             * @param resourceId the primary key for the new resource
160             * @return the new resource
161             */
162            public Resource create(long resourceId) {
163                    Resource resource = new ResourceImpl();
164    
165                    resource.setNew(true);
166                    resource.setPrimaryKey(resourceId);
167    
168                    return resource;
169            }
170    
171            /**
172             * Removes the resource with the primary key from the database. Also notifies the appropriate model listeners.
173             *
174             * @param primaryKey the primary key of the resource to remove
175             * @return the resource that was removed
176             * @throws com.liferay.portal.NoSuchModelException if a resource with the primary key could not be found
177             * @throws SystemException if a system exception occurred
178             */
179            public Resource remove(Serializable primaryKey)
180                    throws NoSuchModelException, SystemException {
181                    return remove(((Long)primaryKey).longValue());
182            }
183    
184            /**
185             * Removes the resource with the primary key from the database. Also notifies the appropriate model listeners.
186             *
187             * @param resourceId the primary key of the resource to remove
188             * @return the resource that was removed
189             * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found
190             * @throws SystemException if a system exception occurred
191             */
192            public Resource remove(long resourceId)
193                    throws NoSuchResourceException, SystemException {
194                    Session session = null;
195    
196                    try {
197                            session = openSession();
198    
199                            Resource resource = (Resource)session.get(ResourceImpl.class,
200                                            new Long(resourceId));
201    
202                            if (resource == null) {
203                                    if (_log.isWarnEnabled()) {
204                                            _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + resourceId);
205                                    }
206    
207                                    throw new NoSuchResourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
208                                            resourceId);
209                            }
210    
211                            return remove(resource);
212                    }
213                    catch (NoSuchResourceException nsee) {
214                            throw nsee;
215                    }
216                    catch (Exception e) {
217                            throw processException(e);
218                    }
219                    finally {
220                            closeSession(session);
221                    }
222            }
223    
224            protected Resource removeImpl(Resource resource) throws SystemException {
225                    resource = toUnwrappedModel(resource);
226    
227                    Session session = null;
228    
229                    try {
230                            session = openSession();
231    
232                            if (resource.isCachedModel() || BatchSessionUtil.isEnabled()) {
233                                    Object staleObject = session.get(ResourceImpl.class,
234                                                    resource.getPrimaryKeyObj());
235    
236                                    if (staleObject != null) {
237                                            session.evict(staleObject);
238                                    }
239                            }
240    
241                            session.delete(resource);
242    
243                            session.flush();
244                    }
245                    catch (Exception e) {
246                            throw processException(e);
247                    }
248                    finally {
249                            closeSession(session);
250                    }
251    
252                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
253    
254                    ResourceModelImpl resourceModelImpl = (ResourceModelImpl)resource;
255    
256                    FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_P,
257                            new Object[] {
258                                    new Long(resourceModelImpl.getOriginalCodeId()),
259                                    
260                            resourceModelImpl.getOriginalPrimKey()
261                            });
262    
263                    EntityCacheUtil.removeResult(ResourceModelImpl.ENTITY_CACHE_ENABLED,
264                            ResourceImpl.class, resource.getPrimaryKey());
265    
266                    return resource;
267            }
268    
269            public Resource updateImpl(com.liferay.portal.model.Resource resource,
270                    boolean merge) throws SystemException {
271                    resource = toUnwrappedModel(resource);
272    
273                    boolean isNew = resource.isNew();
274    
275                    ResourceModelImpl resourceModelImpl = (ResourceModelImpl)resource;
276    
277                    Session session = null;
278    
279                    try {
280                            session = openSession();
281    
282                            BatchSessionUtil.update(session, resource, merge);
283    
284                            resource.setNew(false);
285                    }
286                    catch (Exception e) {
287                            throw processException(e);
288                    }
289                    finally {
290                            closeSession(session);
291                    }
292    
293                    FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
294    
295                    EntityCacheUtil.putResult(ResourceModelImpl.ENTITY_CACHE_ENABLED,
296                            ResourceImpl.class, resource.getPrimaryKey(), resource);
297    
298                    if (!isNew &&
299                                    ((resource.getCodeId() != resourceModelImpl.getOriginalCodeId()) ||
300                                    !Validator.equals(resource.getPrimKey(),
301                                            resourceModelImpl.getOriginalPrimKey()))) {
302                            FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_C_P,
303                                    new Object[] {
304                                            new Long(resourceModelImpl.getOriginalCodeId()),
305                                            
306                                    resourceModelImpl.getOriginalPrimKey()
307                                    });
308                    }
309    
310                    if (isNew ||
311                                    ((resource.getCodeId() != resourceModelImpl.getOriginalCodeId()) ||
312                                    !Validator.equals(resource.getPrimKey(),
313                                            resourceModelImpl.getOriginalPrimKey()))) {
314                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_P,
315                                    new Object[] {
316                                            new Long(resource.getCodeId()),
317                                            
318                                    resource.getPrimKey()
319                                    }, resource);
320                    }
321    
322                    return resource;
323            }
324    
325            protected Resource toUnwrappedModel(Resource resource) {
326                    if (resource instanceof ResourceImpl) {
327                            return resource;
328                    }
329    
330                    ResourceImpl resourceImpl = new ResourceImpl();
331    
332                    resourceImpl.setNew(resource.isNew());
333                    resourceImpl.setPrimaryKey(resource.getPrimaryKey());
334    
335                    resourceImpl.setResourceId(resource.getResourceId());
336                    resourceImpl.setCodeId(resource.getCodeId());
337                    resourceImpl.setPrimKey(resource.getPrimKey());
338    
339                    return resourceImpl;
340            }
341    
342            /**
343             * Finds the resource with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
344             *
345             * @param primaryKey the primary key of the resource to find
346             * @return the resource
347             * @throws com.liferay.portal.NoSuchModelException if a resource with the primary key could not be found
348             * @throws SystemException if a system exception occurred
349             */
350            public Resource findByPrimaryKey(Serializable primaryKey)
351                    throws NoSuchModelException, SystemException {
352                    return findByPrimaryKey(((Long)primaryKey).longValue());
353            }
354    
355            /**
356             * Finds the resource with the primary key or throws a {@link com.liferay.portal.NoSuchResourceException} if it could not be found.
357             *
358             * @param resourceId the primary key of the resource to find
359             * @return the resource
360             * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found
361             * @throws SystemException if a system exception occurred
362             */
363            public Resource findByPrimaryKey(long resourceId)
364                    throws NoSuchResourceException, SystemException {
365                    Resource resource = fetchByPrimaryKey(resourceId);
366    
367                    if (resource == null) {
368                            if (_log.isWarnEnabled()) {
369                                    _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + resourceId);
370                            }
371    
372                            throw new NoSuchResourceException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
373                                    resourceId);
374                    }
375    
376                    return resource;
377            }
378    
379            /**
380             * Finds the resource with the primary key or returns <code>null</code> if it could not be found.
381             *
382             * @param primaryKey the primary key of the resource to find
383             * @return the resource, or <code>null</code> if a resource with the primary key could not be found
384             * @throws SystemException if a system exception occurred
385             */
386            public Resource fetchByPrimaryKey(Serializable primaryKey)
387                    throws SystemException {
388                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
389            }
390    
391            /**
392             * Finds the resource with the primary key or returns <code>null</code> if it could not be found.
393             *
394             * @param resourceId the primary key of the resource to find
395             * @return the resource, or <code>null</code> if a resource with the primary key could not be found
396             * @throws SystemException if a system exception occurred
397             */
398            public Resource fetchByPrimaryKey(long resourceId)
399                    throws SystemException {
400                    Resource resource = (Resource)EntityCacheUtil.getResult(ResourceModelImpl.ENTITY_CACHE_ENABLED,
401                                    ResourceImpl.class, resourceId, this);
402    
403                    if (resource == null) {
404                            Session session = null;
405    
406                            try {
407                                    session = openSession();
408    
409                                    resource = (Resource)session.get(ResourceImpl.class,
410                                                    new Long(resourceId));
411                            }
412                            catch (Exception e) {
413                                    throw processException(e);
414                            }
415                            finally {
416                                    if (resource != null) {
417                                            cacheResult(resource);
418                                    }
419    
420                                    closeSession(session);
421                            }
422                    }
423    
424                    return resource;
425            }
426    
427            /**
428             * Finds all the resources where codeId = &#63;.
429             *
430             * @param codeId the code id to search with
431             * @return the matching resources
432             * @throws SystemException if a system exception occurred
433             */
434            public List<Resource> findByCodeId(long codeId) throws SystemException {
435                    return findByCodeId(codeId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
436            }
437    
438            /**
439             * Finds a range of all the resources where codeId = &#63;.
440             *
441             * <p>
442             * 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.
443             * </p>
444             *
445             * @param codeId the code id to search with
446             * @param start the lower bound of the range of resources to return
447             * @param end the upper bound of the range of resources to return (not inclusive)
448             * @return the range of matching resources
449             * @throws SystemException if a system exception occurred
450             */
451            public List<Resource> findByCodeId(long codeId, int start, int end)
452                    throws SystemException {
453                    return findByCodeId(codeId, start, end, null);
454            }
455    
456            /**
457             * Finds an ordered range of all the resources where codeId = &#63;.
458             *
459             * <p>
460             * 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.
461             * </p>
462             *
463             * @param codeId the code id to search with
464             * @param start the lower bound of the range of resources to return
465             * @param end the upper bound of the range of resources to return (not inclusive)
466             * @param orderByComparator the comparator to order the results by
467             * @return the ordered range of matching resources
468             * @throws SystemException if a system exception occurred
469             */
470            public List<Resource> findByCodeId(long codeId, int start, int end,
471                    OrderByComparator orderByComparator) throws SystemException {
472                    Object[] finderArgs = new Object[] {
473                                    codeId,
474                                    
475                                    String.valueOf(start), String.valueOf(end),
476                                    String.valueOf(orderByComparator)
477                            };
478    
479                    List<Resource> list = (List<Resource>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_CODEID,
480                                    finderArgs, this);
481    
482                    if (list == null) {
483                            Session session = null;
484    
485                            try {
486                                    session = openSession();
487    
488                                    StringBundler query = null;
489    
490                                    if (orderByComparator != null) {
491                                            query = new StringBundler(3 +
492                                                            (orderByComparator.getOrderByFields().length * 3));
493                                    }
494                                    else {
495                                            query = new StringBundler(2);
496                                    }
497    
498                                    query.append(_SQL_SELECT_RESOURCE_WHERE);
499    
500                                    query.append(_FINDER_COLUMN_CODEID_CODEID_2);
501    
502                                    if (orderByComparator != null) {
503                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
504                                                    orderByComparator);
505                                    }
506    
507                                    String sql = query.toString();
508    
509                                    Query q = session.createQuery(sql);
510    
511                                    QueryPos qPos = QueryPos.getInstance(q);
512    
513                                    qPos.add(codeId);
514    
515                                    list = (List<Resource>)QueryUtil.list(q, getDialect(), start,
516                                                    end);
517                            }
518                            catch (Exception e) {
519                                    throw processException(e);
520                            }
521                            finally {
522                                    if (list == null) {
523                                            list = new ArrayList<Resource>();
524                                    }
525    
526                                    cacheResult(list);
527    
528                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_CODEID,
529                                            finderArgs, list);
530    
531                                    closeSession(session);
532                            }
533                    }
534    
535                    return list;
536            }
537    
538            /**
539             * Finds the first resource in the ordered set where codeId = &#63;.
540             *
541             * <p>
542             * 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.
543             * </p>
544             *
545             * @param codeId the code id to search with
546             * @param orderByComparator the comparator to order the set by
547             * @return the first matching resource
548             * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
549             * @throws SystemException if a system exception occurred
550             */
551            public Resource findByCodeId_First(long codeId,
552                    OrderByComparator orderByComparator)
553                    throws NoSuchResourceException, SystemException {
554                    List<Resource> list = findByCodeId(codeId, 0, 1, orderByComparator);
555    
556                    if (list.isEmpty()) {
557                            StringBundler msg = new StringBundler(4);
558    
559                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
560    
561                            msg.append("codeId=");
562                            msg.append(codeId);
563    
564                            msg.append(StringPool.CLOSE_CURLY_BRACE);
565    
566                            throw new NoSuchResourceException(msg.toString());
567                    }
568                    else {
569                            return list.get(0);
570                    }
571            }
572    
573            /**
574             * Finds the last resource in the ordered set where codeId = &#63;.
575             *
576             * <p>
577             * 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.
578             * </p>
579             *
580             * @param codeId the code id to search with
581             * @param orderByComparator the comparator to order the set by
582             * @return the last matching resource
583             * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
584             * @throws SystemException if a system exception occurred
585             */
586            public Resource findByCodeId_Last(long codeId,
587                    OrderByComparator orderByComparator)
588                    throws NoSuchResourceException, SystemException {
589                    int count = countByCodeId(codeId);
590    
591                    List<Resource> list = findByCodeId(codeId, count - 1, count,
592                                    orderByComparator);
593    
594                    if (list.isEmpty()) {
595                            StringBundler msg = new StringBundler(4);
596    
597                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
598    
599                            msg.append("codeId=");
600                            msg.append(codeId);
601    
602                            msg.append(StringPool.CLOSE_CURLY_BRACE);
603    
604                            throw new NoSuchResourceException(msg.toString());
605                    }
606                    else {
607                            return list.get(0);
608                    }
609            }
610    
611            /**
612             * Finds the resources before and after the current resource in the ordered set where codeId = &#63;.
613             *
614             * <p>
615             * 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.
616             * </p>
617             *
618             * @param resourceId the primary key of the current resource
619             * @param codeId the code id to search with
620             * @param orderByComparator the comparator to order the set by
621             * @return the previous, current, and next resource
622             * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found
623             * @throws SystemException if a system exception occurred
624             */
625            public Resource[] findByCodeId_PrevAndNext(long resourceId, long codeId,
626                    OrderByComparator orderByComparator)
627                    throws NoSuchResourceException, SystemException {
628                    Resource resource = findByPrimaryKey(resourceId);
629    
630                    Session session = null;
631    
632                    try {
633                            session = openSession();
634    
635                            Resource[] array = new ResourceImpl[3];
636    
637                            array[0] = getByCodeId_PrevAndNext(session, resource, codeId,
638                                            orderByComparator, true);
639    
640                            array[1] = resource;
641    
642                            array[2] = getByCodeId_PrevAndNext(session, resource, codeId,
643                                            orderByComparator, false);
644    
645                            return array;
646                    }
647                    catch (Exception e) {
648                            throw processException(e);
649                    }
650                    finally {
651                            closeSession(session);
652                    }
653            }
654    
655            protected Resource getByCodeId_PrevAndNext(Session session,
656                    Resource resource, long codeId, OrderByComparator orderByComparator,
657                    boolean previous) {
658                    StringBundler query = null;
659    
660                    if (orderByComparator != null) {
661                            query = new StringBundler(6 +
662                                            (orderByComparator.getOrderByFields().length * 6));
663                    }
664                    else {
665                            query = new StringBundler(3);
666                    }
667    
668                    query.append(_SQL_SELECT_RESOURCE_WHERE);
669    
670                    query.append(_FINDER_COLUMN_CODEID_CODEID_2);
671    
672                    if (orderByComparator != null) {
673                            String[] orderByFields = orderByComparator.getOrderByFields();
674    
675                            if (orderByFields.length > 0) {
676                                    query.append(WHERE_AND);
677                            }
678    
679                            for (int i = 0; i < orderByFields.length; i++) {
680                                    query.append(_ORDER_BY_ENTITY_ALIAS);
681                                    query.append(orderByFields[i]);
682    
683                                    if ((i + 1) < orderByFields.length) {
684                                            if (orderByComparator.isAscending() ^ previous) {
685                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
686                                            }
687                                            else {
688                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
689                                            }
690                                    }
691                                    else {
692                                            if (orderByComparator.isAscending() ^ previous) {
693                                                    query.append(WHERE_GREATER_THAN);
694                                            }
695                                            else {
696                                                    query.append(WHERE_LESSER_THAN);
697                                            }
698                                    }
699                            }
700    
701                            query.append(ORDER_BY_CLAUSE);
702    
703                            for (int i = 0; i < orderByFields.length; i++) {
704                                    query.append(_ORDER_BY_ENTITY_ALIAS);
705                                    query.append(orderByFields[i]);
706    
707                                    if ((i + 1) < orderByFields.length) {
708                                            if (orderByComparator.isAscending() ^ previous) {
709                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
710                                            }
711                                            else {
712                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
713                                            }
714                                    }
715                                    else {
716                                            if (orderByComparator.isAscending() ^ previous) {
717                                                    query.append(ORDER_BY_ASC);
718                                            }
719                                            else {
720                                                    query.append(ORDER_BY_DESC);
721                                            }
722                                    }
723                            }
724                    }
725    
726                    String sql = query.toString();
727    
728                    Query q = session.createQuery(sql);
729    
730                    q.setFirstResult(0);
731                    q.setMaxResults(2);
732    
733                    QueryPos qPos = QueryPos.getInstance(q);
734    
735                    qPos.add(codeId);
736    
737                    if (orderByComparator != null) {
738                            Object[] values = orderByComparator.getOrderByValues(resource);
739    
740                            for (Object value : values) {
741                                    qPos.add(value);
742                            }
743                    }
744    
745                    List<Resource> list = q.list();
746    
747                    if (list.size() == 2) {
748                            return list.get(1);
749                    }
750                    else {
751                            return null;
752                    }
753            }
754    
755            /**
756             * Finds the resource where codeId = &#63; and primKey = &#63; or throws a {@link com.liferay.portal.NoSuchResourceException} if it could not be found.
757             *
758             * @param codeId the code id to search with
759             * @param primKey the prim key to search with
760             * @return the matching resource
761             * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found
762             * @throws SystemException if a system exception occurred
763             */
764            public Resource findByC_P(long codeId, String primKey)
765                    throws NoSuchResourceException, SystemException {
766                    Resource resource = fetchByC_P(codeId, primKey);
767    
768                    if (resource == null) {
769                            StringBundler msg = new StringBundler(6);
770    
771                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
772    
773                            msg.append("codeId=");
774                            msg.append(codeId);
775    
776                            msg.append(", primKey=");
777                            msg.append(primKey);
778    
779                            msg.append(StringPool.CLOSE_CURLY_BRACE);
780    
781                            if (_log.isWarnEnabled()) {
782                                    _log.warn(msg.toString());
783                            }
784    
785                            throw new NoSuchResourceException(msg.toString());
786                    }
787    
788                    return resource;
789            }
790    
791            /**
792             * Finds the resource where codeId = &#63; and primKey = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
793             *
794             * @param codeId the code id to search with
795             * @param primKey the prim key to search with
796             * @return the matching resource, or <code>null</code> if a matching resource could not be found
797             * @throws SystemException if a system exception occurred
798             */
799            public Resource fetchByC_P(long codeId, String primKey)
800                    throws SystemException {
801                    return fetchByC_P(codeId, primKey, true);
802            }
803    
804            /**
805             * Finds the resource where codeId = &#63; and primKey = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
806             *
807             * @param codeId the code id to search with
808             * @param primKey the prim key to search with
809             * @return the matching resource, or <code>null</code> if a matching resource could not be found
810             * @throws SystemException if a system exception occurred
811             */
812            public Resource fetchByC_P(long codeId, String primKey,
813                    boolean retrieveFromCache) throws SystemException {
814                    Object[] finderArgs = new Object[] { codeId, primKey };
815    
816                    Object result = null;
817    
818                    if (retrieveFromCache) {
819                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_C_P,
820                                            finderArgs, this);
821                    }
822    
823                    if (result == null) {
824                            Session session = null;
825    
826                            try {
827                                    session = openSession();
828    
829                                    StringBundler query = new StringBundler(3);
830    
831                                    query.append(_SQL_SELECT_RESOURCE_WHERE);
832    
833                                    query.append(_FINDER_COLUMN_C_P_CODEID_2);
834    
835                                    if (primKey == null) {
836                                            query.append(_FINDER_COLUMN_C_P_PRIMKEY_1);
837                                    }
838                                    else {
839                                            if (primKey.equals(StringPool.BLANK)) {
840                                                    query.append(_FINDER_COLUMN_C_P_PRIMKEY_3);
841                                            }
842                                            else {
843                                                    query.append(_FINDER_COLUMN_C_P_PRIMKEY_2);
844                                            }
845                                    }
846    
847                                    String sql = query.toString();
848    
849                                    Query q = session.createQuery(sql);
850    
851                                    QueryPos qPos = QueryPos.getInstance(q);
852    
853                                    qPos.add(codeId);
854    
855                                    if (primKey != null) {
856                                            qPos.add(primKey);
857                                    }
858    
859                                    List<Resource> list = q.list();
860    
861                                    result = list;
862    
863                                    Resource resource = null;
864    
865                                    if (list.isEmpty()) {
866                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_P,
867                                                    finderArgs, list);
868                                    }
869                                    else {
870                                            resource = list.get(0);
871    
872                                            cacheResult(resource);
873    
874                                            if ((resource.getCodeId() != codeId) ||
875                                                            (resource.getPrimKey() == null) ||
876                                                            !resource.getPrimKey().equals(primKey)) {
877                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_P,
878                                                            finderArgs, resource);
879                                            }
880                                    }
881    
882                                    return resource;
883                            }
884                            catch (Exception e) {
885                                    throw processException(e);
886                            }
887                            finally {
888                                    if (result == null) {
889                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_C_P,
890                                                    finderArgs, new ArrayList<Resource>());
891                                    }
892    
893                                    closeSession(session);
894                            }
895                    }
896                    else {
897                            if (result instanceof List<?>) {
898                                    return null;
899                            }
900                            else {
901                                    return (Resource)result;
902                            }
903                    }
904            }
905    
906            /**
907             * Finds all the resources.
908             *
909             * @return the resources
910             * @throws SystemException if a system exception occurred
911             */
912            public List<Resource> findAll() throws SystemException {
913                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
914            }
915    
916            /**
917             * Finds a range of all the resources.
918             *
919             * <p>
920             * 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.
921             * </p>
922             *
923             * @param start the lower bound of the range of resources to return
924             * @param end the upper bound of the range of resources to return (not inclusive)
925             * @return the range of resources
926             * @throws SystemException if a system exception occurred
927             */
928            public List<Resource> findAll(int start, int end) throws SystemException {
929                    return findAll(start, end, null);
930            }
931    
932            /**
933             * Finds an ordered range of all the resources.
934             *
935             * <p>
936             * 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.
937             * </p>
938             *
939             * @param start the lower bound of the range of resources to return
940             * @param end the upper bound of the range of resources to return (not inclusive)
941             * @param orderByComparator the comparator to order the results by
942             * @return the ordered range of resources
943             * @throws SystemException if a system exception occurred
944             */
945            public List<Resource> findAll(int start, int end,
946                    OrderByComparator orderByComparator) throws SystemException {
947                    Object[] finderArgs = new Object[] {
948                                    String.valueOf(start), String.valueOf(end),
949                                    String.valueOf(orderByComparator)
950                            };
951    
952                    List<Resource> list = (List<Resource>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
953                                    finderArgs, this);
954    
955                    if (list == null) {
956                            Session session = null;
957    
958                            try {
959                                    session = openSession();
960    
961                                    StringBundler query = null;
962                                    String sql = null;
963    
964                                    if (orderByComparator != null) {
965                                            query = new StringBundler(2 +
966                                                            (orderByComparator.getOrderByFields().length * 3));
967    
968                                            query.append(_SQL_SELECT_RESOURCE);
969    
970                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
971                                                    orderByComparator);
972    
973                                            sql = query.toString();
974                                    }
975                                    else {
976                                            sql = _SQL_SELECT_RESOURCE;
977                                    }
978    
979                                    Query q = session.createQuery(sql);
980    
981                                    if (orderByComparator == null) {
982                                            list = (List<Resource>)QueryUtil.list(q, getDialect(),
983                                                            start, end, false);
984    
985                                            Collections.sort(list);
986                                    }
987                                    else {
988                                            list = (List<Resource>)QueryUtil.list(q, getDialect(),
989                                                            start, end);
990                                    }
991                            }
992                            catch (Exception e) {
993                                    throw processException(e);
994                            }
995                            finally {
996                                    if (list == null) {
997                                            list = new ArrayList<Resource>();
998                                    }
999    
1000                                    cacheResult(list);
1001    
1002                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
1003    
1004                                    closeSession(session);
1005                            }
1006                    }
1007    
1008                    return list;
1009            }
1010    
1011            /**
1012             * Removes all the resources where codeId = &#63; from the database.
1013             *
1014             * @param codeId the code id to search with
1015             * @throws SystemException if a system exception occurred
1016             */
1017            public void removeByCodeId(long codeId) throws SystemException {
1018                    for (Resource resource : findByCodeId(codeId)) {
1019                            remove(resource);
1020                    }
1021            }
1022    
1023            /**
1024             * Removes the resource where codeId = &#63; and primKey = &#63; from the database.
1025             *
1026             * @param codeId the code id to search with
1027             * @param primKey the prim key to search with
1028             * @throws SystemException if a system exception occurred
1029             */
1030            public void removeByC_P(long codeId, String primKey)
1031                    throws NoSuchResourceException, SystemException {
1032                    Resource resource = findByC_P(codeId, primKey);
1033    
1034                    remove(resource);
1035            }
1036    
1037            /**
1038             * Removes all the resources from the database.
1039             *
1040             * @throws SystemException if a system exception occurred
1041             */
1042            public void removeAll() throws SystemException {
1043                    for (Resource resource : findAll()) {
1044                            remove(resource);
1045                    }
1046            }
1047    
1048            /**
1049             * Counts all the resources where codeId = &#63;.
1050             *
1051             * @param codeId the code id to search with
1052             * @return the number of matching resources
1053             * @throws SystemException if a system exception occurred
1054             */
1055            public int countByCodeId(long codeId) throws SystemException {
1056                    Object[] finderArgs = new Object[] { codeId };
1057    
1058                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_CODEID,
1059                                    finderArgs, this);
1060    
1061                    if (count == null) {
1062                            Session session = null;
1063    
1064                            try {
1065                                    session = openSession();
1066    
1067                                    StringBundler query = new StringBundler(2);
1068    
1069                                    query.append(_SQL_COUNT_RESOURCE_WHERE);
1070    
1071                                    query.append(_FINDER_COLUMN_CODEID_CODEID_2);
1072    
1073                                    String sql = query.toString();
1074    
1075                                    Query q = session.createQuery(sql);
1076    
1077                                    QueryPos qPos = QueryPos.getInstance(q);
1078    
1079                                    qPos.add(codeId);
1080    
1081                                    count = (Long)q.uniqueResult();
1082                            }
1083                            catch (Exception e) {
1084                                    throw processException(e);
1085                            }
1086                            finally {
1087                                    if (count == null) {
1088                                            count = Long.valueOf(0);
1089                                    }
1090    
1091                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_CODEID,
1092                                            finderArgs, count);
1093    
1094                                    closeSession(session);
1095                            }
1096                    }
1097    
1098                    return count.intValue();
1099            }
1100    
1101            /**
1102             * Counts all the resources where codeId = &#63; and primKey = &#63;.
1103             *
1104             * @param codeId the code id to search with
1105             * @param primKey the prim key to search with
1106             * @return the number of matching resources
1107             * @throws SystemException if a system exception occurred
1108             */
1109            public int countByC_P(long codeId, String primKey)
1110                    throws SystemException {
1111                    Object[] finderArgs = new Object[] { codeId, primKey };
1112    
1113                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_P,
1114                                    finderArgs, this);
1115    
1116                    if (count == null) {
1117                            Session session = null;
1118    
1119                            try {
1120                                    session = openSession();
1121    
1122                                    StringBundler query = new StringBundler(3);
1123    
1124                                    query.append(_SQL_COUNT_RESOURCE_WHERE);
1125    
1126                                    query.append(_FINDER_COLUMN_C_P_CODEID_2);
1127    
1128                                    if (primKey == null) {
1129                                            query.append(_FINDER_COLUMN_C_P_PRIMKEY_1);
1130                                    }
1131                                    else {
1132                                            if (primKey.equals(StringPool.BLANK)) {
1133                                                    query.append(_FINDER_COLUMN_C_P_PRIMKEY_3);
1134                                            }
1135                                            else {
1136                                                    query.append(_FINDER_COLUMN_C_P_PRIMKEY_2);
1137                                            }
1138                                    }
1139    
1140                                    String sql = query.toString();
1141    
1142                                    Query q = session.createQuery(sql);
1143    
1144                                    QueryPos qPos = QueryPos.getInstance(q);
1145    
1146                                    qPos.add(codeId);
1147    
1148                                    if (primKey != null) {
1149                                            qPos.add(primKey);
1150                                    }
1151    
1152                                    count = (Long)q.uniqueResult();
1153                            }
1154                            catch (Exception e) {
1155                                    throw processException(e);
1156                            }
1157                            finally {
1158                                    if (count == null) {
1159                                            count = Long.valueOf(0);
1160                                    }
1161    
1162                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_P, finderArgs,
1163                                            count);
1164    
1165                                    closeSession(session);
1166                            }
1167                    }
1168    
1169                    return count.intValue();
1170            }
1171    
1172            /**
1173             * Counts all the resources.
1174             *
1175             * @return the number of resources
1176             * @throws SystemException if a system exception occurred
1177             */
1178            public int countAll() throws SystemException {
1179                    Object[] finderArgs = new Object[0];
1180    
1181                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
1182                                    finderArgs, this);
1183    
1184                    if (count == null) {
1185                            Session session = null;
1186    
1187                            try {
1188                                    session = openSession();
1189    
1190                                    Query q = session.createQuery(_SQL_COUNT_RESOURCE);
1191    
1192                                    count = (Long)q.uniqueResult();
1193                            }
1194                            catch (Exception e) {
1195                                    throw processException(e);
1196                            }
1197                            finally {
1198                                    if (count == null) {
1199                                            count = Long.valueOf(0);
1200                                    }
1201    
1202                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
1203                                            count);
1204    
1205                                    closeSession(session);
1206                            }
1207                    }
1208    
1209                    return count.intValue();
1210            }
1211    
1212            /**
1213             * Initializes the resource persistence.
1214             */
1215            public void afterPropertiesSet() {
1216                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
1217                                            com.liferay.portal.util.PropsUtil.get(
1218                                                    "value.object.listener.com.liferay.portal.model.Resource")));
1219    
1220                    if (listenerClassNames.length > 0) {
1221                            try {
1222                                    List<ModelListener<Resource>> listenersList = new ArrayList<ModelListener<Resource>>();
1223    
1224                                    for (String listenerClassName : listenerClassNames) {
1225                                            listenersList.add((ModelListener<Resource>)InstanceFactory.newInstance(
1226                                                            listenerClassName));
1227                                    }
1228    
1229                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
1230                            }
1231                            catch (Exception e) {
1232                                    _log.error(e);
1233                            }
1234                    }
1235            }
1236    
1237            @BeanReference(type = AccountPersistence.class)
1238            protected AccountPersistence accountPersistence;
1239            @BeanReference(type = AddressPersistence.class)
1240            protected AddressPersistence addressPersistence;
1241            @BeanReference(type = BrowserTrackerPersistence.class)
1242            protected BrowserTrackerPersistence browserTrackerPersistence;
1243            @BeanReference(type = ClassNamePersistence.class)
1244            protected ClassNamePersistence classNamePersistence;
1245            @BeanReference(type = CompanyPersistence.class)
1246            protected CompanyPersistence companyPersistence;
1247            @BeanReference(type = ContactPersistence.class)
1248            protected ContactPersistence contactPersistence;
1249            @BeanReference(type = CountryPersistence.class)
1250            protected CountryPersistence countryPersistence;
1251            @BeanReference(type = EmailAddressPersistence.class)
1252            protected EmailAddressPersistence emailAddressPersistence;
1253            @BeanReference(type = GroupPersistence.class)
1254            protected GroupPersistence groupPersistence;
1255            @BeanReference(type = ImagePersistence.class)
1256            protected ImagePersistence imagePersistence;
1257            @BeanReference(type = LayoutPersistence.class)
1258            protected LayoutPersistence layoutPersistence;
1259            @BeanReference(type = LayoutPrototypePersistence.class)
1260            protected LayoutPrototypePersistence layoutPrototypePersistence;
1261            @BeanReference(type = LayoutSetPersistence.class)
1262            protected LayoutSetPersistence layoutSetPersistence;
1263            @BeanReference(type = LayoutSetPrototypePersistence.class)
1264            protected LayoutSetPrototypePersistence layoutSetPrototypePersistence;
1265            @BeanReference(type = ListTypePersistence.class)
1266            protected ListTypePersistence listTypePersistence;
1267            @BeanReference(type = LockPersistence.class)
1268            protected LockPersistence lockPersistence;
1269            @BeanReference(type = MembershipRequestPersistence.class)
1270            protected MembershipRequestPersistence membershipRequestPersistence;
1271            @BeanReference(type = OrganizationPersistence.class)
1272            protected OrganizationPersistence organizationPersistence;
1273            @BeanReference(type = OrgGroupPermissionPersistence.class)
1274            protected OrgGroupPermissionPersistence orgGroupPermissionPersistence;
1275            @BeanReference(type = OrgGroupRolePersistence.class)
1276            protected OrgGroupRolePersistence orgGroupRolePersistence;
1277            @BeanReference(type = OrgLaborPersistence.class)
1278            protected OrgLaborPersistence orgLaborPersistence;
1279            @BeanReference(type = PasswordPolicyPersistence.class)
1280            protected PasswordPolicyPersistence passwordPolicyPersistence;
1281            @BeanReference(type = PasswordPolicyRelPersistence.class)
1282            protected PasswordPolicyRelPersistence passwordPolicyRelPersistence;
1283            @BeanReference(type = PasswordTrackerPersistence.class)
1284            protected PasswordTrackerPersistence passwordTrackerPersistence;
1285            @BeanReference(type = PermissionPersistence.class)
1286            protected PermissionPersistence permissionPersistence;
1287            @BeanReference(type = PhonePersistence.class)
1288            protected PhonePersistence phonePersistence;
1289            @BeanReference(type = PluginSettingPersistence.class)
1290            protected PluginSettingPersistence pluginSettingPersistence;
1291            @BeanReference(type = PortletPersistence.class)
1292            protected PortletPersistence portletPersistence;
1293            @BeanReference(type = PortletItemPersistence.class)
1294            protected PortletItemPersistence portletItemPersistence;
1295            @BeanReference(type = PortletPreferencesPersistence.class)
1296            protected PortletPreferencesPersistence portletPreferencesPersistence;
1297            @BeanReference(type = RegionPersistence.class)
1298            protected RegionPersistence regionPersistence;
1299            @BeanReference(type = ReleasePersistence.class)
1300            protected ReleasePersistence releasePersistence;
1301            @BeanReference(type = ResourcePersistence.class)
1302            protected ResourcePersistence resourcePersistence;
1303            @BeanReference(type = ResourceActionPersistence.class)
1304            protected ResourceActionPersistence resourceActionPersistence;
1305            @BeanReference(type = ResourceCodePersistence.class)
1306            protected ResourceCodePersistence resourceCodePersistence;
1307            @BeanReference(type = ResourcePermissionPersistence.class)
1308            protected ResourcePermissionPersistence resourcePermissionPersistence;
1309            @BeanReference(type = RolePersistence.class)
1310            protected RolePersistence rolePersistence;
1311            @BeanReference(type = ServiceComponentPersistence.class)
1312            protected ServiceComponentPersistence serviceComponentPersistence;
1313            @BeanReference(type = ShardPersistence.class)
1314            protected ShardPersistence shardPersistence;
1315            @BeanReference(type = SubscriptionPersistence.class)
1316            protected SubscriptionPersistence subscriptionPersistence;
1317            @BeanReference(type = TicketPersistence.class)
1318            protected TicketPersistence ticketPersistence;
1319            @BeanReference(type = TeamPersistence.class)
1320            protected TeamPersistence teamPersistence;
1321            @BeanReference(type = UserPersistence.class)
1322            protected UserPersistence userPersistence;
1323            @BeanReference(type = UserGroupPersistence.class)
1324            protected UserGroupPersistence userGroupPersistence;
1325            @BeanReference(type = UserGroupGroupRolePersistence.class)
1326            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1327            @BeanReference(type = UserGroupRolePersistence.class)
1328            protected UserGroupRolePersistence userGroupRolePersistence;
1329            @BeanReference(type = UserIdMapperPersistence.class)
1330            protected UserIdMapperPersistence userIdMapperPersistence;
1331            @BeanReference(type = UserTrackerPersistence.class)
1332            protected UserTrackerPersistence userTrackerPersistence;
1333            @BeanReference(type = UserTrackerPathPersistence.class)
1334            protected UserTrackerPathPersistence userTrackerPathPersistence;
1335            @BeanReference(type = WebDAVPropsPersistence.class)
1336            protected WebDAVPropsPersistence webDAVPropsPersistence;
1337            @BeanReference(type = WebsitePersistence.class)
1338            protected WebsitePersistence websitePersistence;
1339            @BeanReference(type = WorkflowDefinitionLinkPersistence.class)
1340            protected WorkflowDefinitionLinkPersistence workflowDefinitionLinkPersistence;
1341            @BeanReference(type = WorkflowInstanceLinkPersistence.class)
1342            protected WorkflowInstanceLinkPersistence workflowInstanceLinkPersistence;
1343            private static final String _SQL_SELECT_RESOURCE = "SELECT resource FROM Resource resource";
1344            private static final String _SQL_SELECT_RESOURCE_WHERE = "SELECT resource FROM Resource resource WHERE ";
1345            private static final String _SQL_COUNT_RESOURCE = "SELECT COUNT(resource) FROM Resource resource";
1346            private static final String _SQL_COUNT_RESOURCE_WHERE = "SELECT COUNT(resource) FROM Resource resource WHERE ";
1347            private static final String _FINDER_COLUMN_CODEID_CODEID_2 = "resource.codeId = ?";
1348            private static final String _FINDER_COLUMN_C_P_CODEID_2 = "resource.codeId = ? AND ";
1349            private static final String _FINDER_COLUMN_C_P_PRIMKEY_1 = "resource.primKey IS NULL";
1350            private static final String _FINDER_COLUMN_C_P_PRIMKEY_2 = "resource.primKey = ?";
1351            private static final String _FINDER_COLUMN_C_P_PRIMKEY_3 = "(resource.primKey IS NULL OR resource.primKey = ?)";
1352            private static final String _ORDER_BY_ENTITY_ALIAS = "resource.";
1353            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Resource exists with the primary key ";
1354            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Resource exists with the key {";
1355            private static Log _log = LogFactoryUtil.getLog(ResourcePersistenceImpl.class);
1356    }