1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.social.service.persistence;
21  
22  import com.liferay.portal.SystemException;
23  import com.liferay.portal.kernel.annotation.BeanReference;
24  import com.liferay.portal.kernel.cache.CacheRegistry;
25  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
26  import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
27  import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
28  import com.liferay.portal.kernel.dao.orm.FinderPath;
29  import com.liferay.portal.kernel.dao.orm.Query;
30  import com.liferay.portal.kernel.dao.orm.QueryPos;
31  import com.liferay.portal.kernel.dao.orm.QueryUtil;
32  import com.liferay.portal.kernel.dao.orm.Session;
33  import com.liferay.portal.kernel.log.Log;
34  import com.liferay.portal.kernel.log.LogFactoryUtil;
35  import com.liferay.portal.kernel.util.GetterUtil;
36  import com.liferay.portal.kernel.util.OrderByComparator;
37  import com.liferay.portal.kernel.util.StringPool;
38  import com.liferay.portal.kernel.util.StringUtil;
39  import com.liferay.portal.kernel.util.Validator;
40  import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
41  import com.liferay.portal.model.ModelListener;
42  import com.liferay.portal.service.persistence.BatchSessionUtil;
43  import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
44  
45  import com.liferay.portlet.social.NoSuchRelationException;
46  import com.liferay.portlet.social.model.SocialRelation;
47  import com.liferay.portlet.social.model.impl.SocialRelationImpl;
48  import com.liferay.portlet.social.model.impl.SocialRelationModelImpl;
49  
50  import java.util.ArrayList;
51  import java.util.Collections;
52  import java.util.List;
53  
54  /**
55   * <a href="SocialRelationPersistenceImpl.java.html"><b><i>View Source</i></b></a>
56   *
57   * @author Brian Wing Shun Chan
58   *
59   */
60  public class SocialRelationPersistenceImpl extends BasePersistenceImpl
61      implements SocialRelationPersistence {
62      public static final String FINDER_CLASS_NAME_ENTITY = SocialRelationImpl.class.getName();
63      public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
64          ".List";
65      public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
66              SocialRelationModelImpl.FINDER_CACHE_ENABLED,
67              FINDER_CLASS_NAME_LIST, "findByUuid",
68              new String[] { String.class.getName() });
69      public static final FinderPath FINDER_PATH_FIND_BY_OBC_UUID = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
70              SocialRelationModelImpl.FINDER_CACHE_ENABLED,
71              FINDER_CLASS_NAME_LIST, "findByUuid",
72              new String[] {
73                  String.class.getName(),
74                  
75              "java.lang.Integer", "java.lang.Integer",
76                  "com.liferay.portal.kernel.util.OrderByComparator"
77              });
78      public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
79              SocialRelationModelImpl.FINDER_CACHE_ENABLED,
80              FINDER_CLASS_NAME_LIST, "countByUuid",
81              new String[] { String.class.getName() });
82      public static final FinderPath FINDER_PATH_FIND_BY_COMPANYID = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
83              SocialRelationModelImpl.FINDER_CACHE_ENABLED,
84              FINDER_CLASS_NAME_LIST, "findByCompanyId",
85              new String[] { Long.class.getName() });
86      public static final FinderPath FINDER_PATH_FIND_BY_OBC_COMPANYID = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
87              SocialRelationModelImpl.FINDER_CACHE_ENABLED,
88              FINDER_CLASS_NAME_LIST, "findByCompanyId",
89              new String[] {
90                  Long.class.getName(),
91                  
92              "java.lang.Integer", "java.lang.Integer",
93                  "com.liferay.portal.kernel.util.OrderByComparator"
94              });
95      public static final FinderPath FINDER_PATH_COUNT_BY_COMPANYID = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
96              SocialRelationModelImpl.FINDER_CACHE_ENABLED,
97              FINDER_CLASS_NAME_LIST, "countByCompanyId",
98              new String[] { Long.class.getName() });
99      public static final FinderPath FINDER_PATH_FIND_BY_USERID1 = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
100             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
101             FINDER_CLASS_NAME_LIST, "findByUserId1",
102             new String[] { Long.class.getName() });
103     public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERID1 = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
104             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
105             FINDER_CLASS_NAME_LIST, "findByUserId1",
106             new String[] {
107                 Long.class.getName(),
108                 
109             "java.lang.Integer", "java.lang.Integer",
110                 "com.liferay.portal.kernel.util.OrderByComparator"
111             });
112     public static final FinderPath FINDER_PATH_COUNT_BY_USERID1 = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
113             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
114             FINDER_CLASS_NAME_LIST, "countByUserId1",
115             new String[] { Long.class.getName() });
116     public static final FinderPath FINDER_PATH_FIND_BY_USERID2 = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
117             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
118             FINDER_CLASS_NAME_LIST, "findByUserId2",
119             new String[] { Long.class.getName() });
120     public static final FinderPath FINDER_PATH_FIND_BY_OBC_USERID2 = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
121             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
122             FINDER_CLASS_NAME_LIST, "findByUserId2",
123             new String[] {
124                 Long.class.getName(),
125                 
126             "java.lang.Integer", "java.lang.Integer",
127                 "com.liferay.portal.kernel.util.OrderByComparator"
128             });
129     public static final FinderPath FINDER_PATH_COUNT_BY_USERID2 = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
130             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
131             FINDER_CLASS_NAME_LIST, "countByUserId2",
132             new String[] { Long.class.getName() });
133     public static final FinderPath FINDER_PATH_FIND_BY_TYPE = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
134             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
135             FINDER_CLASS_NAME_LIST, "findByType",
136             new String[] { Integer.class.getName() });
137     public static final FinderPath FINDER_PATH_FIND_BY_OBC_TYPE = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
138             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
139             FINDER_CLASS_NAME_LIST, "findByType",
140             new String[] {
141                 Integer.class.getName(),
142                 
143             "java.lang.Integer", "java.lang.Integer",
144                 "com.liferay.portal.kernel.util.OrderByComparator"
145             });
146     public static final FinderPath FINDER_PATH_COUNT_BY_TYPE = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
147             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
148             FINDER_CLASS_NAME_LIST, "countByType",
149             new String[] { Integer.class.getName() });
150     public static final FinderPath FINDER_PATH_FIND_BY_C_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
151             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
152             FINDER_CLASS_NAME_LIST, "findByC_T",
153             new String[] { Long.class.getName(), Integer.class.getName() });
154     public static final FinderPath FINDER_PATH_FIND_BY_OBC_C_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
155             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
156             FINDER_CLASS_NAME_LIST, "findByC_T",
157             new String[] {
158                 Long.class.getName(), Integer.class.getName(),
159                 
160             "java.lang.Integer", "java.lang.Integer",
161                 "com.liferay.portal.kernel.util.OrderByComparator"
162             });
163     public static final FinderPath FINDER_PATH_COUNT_BY_C_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
164             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
165             FINDER_CLASS_NAME_LIST, "countByC_T",
166             new String[] { Long.class.getName(), Integer.class.getName() });
167     public static final FinderPath FINDER_PATH_FIND_BY_U1_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
168             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
169             FINDER_CLASS_NAME_LIST, "findByU1_T",
170             new String[] { Long.class.getName(), Integer.class.getName() });
171     public static final FinderPath FINDER_PATH_FIND_BY_OBC_U1_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
172             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
173             FINDER_CLASS_NAME_LIST, "findByU1_T",
174             new String[] {
175                 Long.class.getName(), Integer.class.getName(),
176                 
177             "java.lang.Integer", "java.lang.Integer",
178                 "com.liferay.portal.kernel.util.OrderByComparator"
179             });
180     public static final FinderPath FINDER_PATH_COUNT_BY_U1_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
181             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
182             FINDER_CLASS_NAME_LIST, "countByU1_T",
183             new String[] { Long.class.getName(), Integer.class.getName() });
184     public static final FinderPath FINDER_PATH_FIND_BY_U2_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
185             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
186             FINDER_CLASS_NAME_LIST, "findByU2_T",
187             new String[] { Long.class.getName(), Integer.class.getName() });
188     public static final FinderPath FINDER_PATH_FIND_BY_OBC_U2_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
189             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
190             FINDER_CLASS_NAME_LIST, "findByU2_T",
191             new String[] {
192                 Long.class.getName(), Integer.class.getName(),
193                 
194             "java.lang.Integer", "java.lang.Integer",
195                 "com.liferay.portal.kernel.util.OrderByComparator"
196             });
197     public static final FinderPath FINDER_PATH_COUNT_BY_U2_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
198             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
199             FINDER_CLASS_NAME_LIST, "countByU2_T",
200             new String[] { Long.class.getName(), Integer.class.getName() });
201     public static final FinderPath FINDER_PATH_FETCH_BY_U1_U2_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
202             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
203             FINDER_CLASS_NAME_ENTITY, "fetchByU1_U2_T",
204             new String[] {
205                 Long.class.getName(), Long.class.getName(),
206                 Integer.class.getName()
207             });
208     public static final FinderPath FINDER_PATH_COUNT_BY_U1_U2_T = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
209             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
210             FINDER_CLASS_NAME_LIST, "countByU1_U2_T",
211             new String[] {
212                 Long.class.getName(), Long.class.getName(),
213                 Integer.class.getName()
214             });
215     public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
216             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
217             FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
218     public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
219             SocialRelationModelImpl.FINDER_CACHE_ENABLED,
220             FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
221 
222     public void cacheResult(SocialRelation socialRelation) {
223         EntityCacheUtil.putResult(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
224             SocialRelationImpl.class, socialRelation.getPrimaryKey(),
225             socialRelation);
226 
227         FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U1_U2_T,
228             new Object[] {
229                 new Long(socialRelation.getUserId1()),
230                 new Long(socialRelation.getUserId2()),
231                 new Integer(socialRelation.getType())
232             }, socialRelation);
233     }
234 
235     public void cacheResult(List<SocialRelation> socialRelations) {
236         for (SocialRelation socialRelation : socialRelations) {
237             if (EntityCacheUtil.getResult(
238                         SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
239                         SocialRelationImpl.class,
240                         socialRelation.getPrimaryKey(), this) == null) {
241                 cacheResult(socialRelation);
242             }
243         }
244     }
245 
246     public void clearCache() {
247         CacheRegistry.clear(SocialRelationImpl.class.getName());
248         EntityCacheUtil.clearCache(SocialRelationImpl.class.getName());
249         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
250         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
251     }
252 
253     public SocialRelation create(long relationId) {
254         SocialRelation socialRelation = new SocialRelationImpl();
255 
256         socialRelation.setNew(true);
257         socialRelation.setPrimaryKey(relationId);
258 
259         String uuid = PortalUUIDUtil.generate();
260 
261         socialRelation.setUuid(uuid);
262 
263         return socialRelation;
264     }
265 
266     public SocialRelation remove(long relationId)
267         throws NoSuchRelationException, SystemException {
268         Session session = null;
269 
270         try {
271             session = openSession();
272 
273             SocialRelation socialRelation = (SocialRelation)session.get(SocialRelationImpl.class,
274                     new Long(relationId));
275 
276             if (socialRelation == null) {
277                 if (_log.isWarnEnabled()) {
278                     _log.warn("No SocialRelation exists with the primary key " +
279                         relationId);
280                 }
281 
282                 throw new NoSuchRelationException(
283                     "No SocialRelation exists with the primary key " +
284                     relationId);
285             }
286 
287             return remove(socialRelation);
288         }
289         catch (NoSuchRelationException nsee) {
290             throw nsee;
291         }
292         catch (Exception e) {
293             throw processException(e);
294         }
295         finally {
296             closeSession(session);
297         }
298     }
299 
300     public SocialRelation remove(SocialRelation socialRelation)
301         throws SystemException {
302         for (ModelListener<SocialRelation> listener : listeners) {
303             listener.onBeforeRemove(socialRelation);
304         }
305 
306         socialRelation = removeImpl(socialRelation);
307 
308         for (ModelListener<SocialRelation> listener : listeners) {
309             listener.onAfterRemove(socialRelation);
310         }
311 
312         return socialRelation;
313     }
314 
315     protected SocialRelation removeImpl(SocialRelation socialRelation)
316         throws SystemException {
317         Session session = null;
318 
319         try {
320             session = openSession();
321 
322             if (socialRelation.isCachedModel() || BatchSessionUtil.isEnabled()) {
323                 Object staleObject = session.get(SocialRelationImpl.class,
324                         socialRelation.getPrimaryKeyObj());
325 
326                 if (staleObject != null) {
327                     session.evict(staleObject);
328                 }
329             }
330 
331             session.delete(socialRelation);
332 
333             session.flush();
334         }
335         catch (Exception e) {
336             throw processException(e);
337         }
338         finally {
339             closeSession(session);
340         }
341 
342         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
343 
344         SocialRelationModelImpl socialRelationModelImpl = (SocialRelationModelImpl)socialRelation;
345 
346         FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U1_U2_T,
347             new Object[] {
348                 new Long(socialRelationModelImpl.getOriginalUserId1()),
349                 new Long(socialRelationModelImpl.getOriginalUserId2()),
350                 new Integer(socialRelationModelImpl.getOriginalType())
351             });
352 
353         EntityCacheUtil.removeResult(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
354             SocialRelationImpl.class, socialRelation.getPrimaryKey());
355 
356         return socialRelation;
357     }
358 
359     /**
360      * @deprecated Use <code>update(SocialRelation socialRelation, boolean merge)</code>.
361      */
362     public SocialRelation update(SocialRelation socialRelation)
363         throws SystemException {
364         if (_log.isWarnEnabled()) {
365             _log.warn(
366                 "Using the deprecated update(SocialRelation socialRelation) method. Use update(SocialRelation socialRelation, boolean merge) instead.");
367         }
368 
369         return update(socialRelation, false);
370     }
371 
372     /**
373      * Add, update, or merge, the entity. This method also calls the model
374      * listeners to trigger the proper events associated with adding, deleting,
375      * or updating an entity.
376      *
377      * @param        socialRelation the entity to add, update, or merge
378      * @param        merge boolean value for whether to merge the entity. The
379      *                default value is false. Setting merge to true is more
380      *                expensive and should only be true when socialRelation is
381      *                transient. See LEP-5473 for a detailed discussion of this
382      *                method.
383      * @return        true if the portlet can be displayed via Ajax
384      */
385     public SocialRelation update(SocialRelation socialRelation, boolean merge)
386         throws SystemException {
387         boolean isNew = socialRelation.isNew();
388 
389         for (ModelListener<SocialRelation> listener : listeners) {
390             if (isNew) {
391                 listener.onBeforeCreate(socialRelation);
392             }
393             else {
394                 listener.onBeforeUpdate(socialRelation);
395             }
396         }
397 
398         socialRelation = updateImpl(socialRelation, merge);
399 
400         for (ModelListener<SocialRelation> listener : listeners) {
401             if (isNew) {
402                 listener.onAfterCreate(socialRelation);
403             }
404             else {
405                 listener.onAfterUpdate(socialRelation);
406             }
407         }
408 
409         return socialRelation;
410     }
411 
412     public SocialRelation updateImpl(
413         com.liferay.portlet.social.model.SocialRelation socialRelation,
414         boolean merge) throws SystemException {
415         boolean isNew = socialRelation.isNew();
416 
417         SocialRelationModelImpl socialRelationModelImpl = (SocialRelationModelImpl)socialRelation;
418 
419         if (Validator.isNull(socialRelation.getUuid())) {
420             String uuid = PortalUUIDUtil.generate();
421 
422             socialRelation.setUuid(uuid);
423         }
424 
425         Session session = null;
426 
427         try {
428             session = openSession();
429 
430             BatchSessionUtil.update(session, socialRelation, merge);
431 
432             socialRelation.setNew(false);
433         }
434         catch (Exception e) {
435             throw processException(e);
436         }
437         finally {
438             closeSession(session);
439         }
440 
441         FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
442 
443         EntityCacheUtil.putResult(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
444             SocialRelationImpl.class, socialRelation.getPrimaryKey(),
445             socialRelation);
446 
447         if (!isNew &&
448                 ((socialRelation.getUserId1() != socialRelationModelImpl.getOriginalUserId1()) ||
449                 (socialRelation.getUserId2() != socialRelationModelImpl.getOriginalUserId2()) ||
450                 (socialRelation.getType() != socialRelationModelImpl.getOriginalType()))) {
451             FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_U1_U2_T,
452                 new Object[] {
453                     new Long(socialRelationModelImpl.getOriginalUserId1()),
454                     new Long(socialRelationModelImpl.getOriginalUserId2()),
455                     new Integer(socialRelationModelImpl.getOriginalType())
456                 });
457         }
458 
459         if (isNew ||
460                 ((socialRelation.getUserId1() != socialRelationModelImpl.getOriginalUserId1()) ||
461                 (socialRelation.getUserId2() != socialRelationModelImpl.getOriginalUserId2()) ||
462                 (socialRelation.getType() != socialRelationModelImpl.getOriginalType()))) {
463             FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U1_U2_T,
464                 new Object[] {
465                     new Long(socialRelation.getUserId1()),
466                     new Long(socialRelation.getUserId2()),
467                     new Integer(socialRelation.getType())
468                 }, socialRelation);
469         }
470 
471         return socialRelation;
472     }
473 
474     public SocialRelation findByPrimaryKey(long relationId)
475         throws NoSuchRelationException, SystemException {
476         SocialRelation socialRelation = fetchByPrimaryKey(relationId);
477 
478         if (socialRelation == null) {
479             if (_log.isWarnEnabled()) {
480                 _log.warn("No SocialRelation exists with the primary key " +
481                     relationId);
482             }
483 
484             throw new NoSuchRelationException(
485                 "No SocialRelation exists with the primary key " + relationId);
486         }
487 
488         return socialRelation;
489     }
490 
491     public SocialRelation fetchByPrimaryKey(long relationId)
492         throws SystemException {
493         SocialRelation socialRelation = (SocialRelation)EntityCacheUtil.getResult(SocialRelationModelImpl.ENTITY_CACHE_ENABLED,
494                 SocialRelationImpl.class, relationId, this);
495 
496         if (socialRelation == null) {
497             Session session = null;
498 
499             try {
500                 session = openSession();
501 
502                 socialRelation = (SocialRelation)session.get(SocialRelationImpl.class,
503                         new Long(relationId));
504             }
505             catch (Exception e) {
506                 throw processException(e);
507             }
508             finally {
509                 if (socialRelation != null) {
510                     cacheResult(socialRelation);
511                 }
512 
513                 closeSession(session);
514             }
515         }
516 
517         return socialRelation;
518     }
519 
520     public List<SocialRelation> findByUuid(String uuid)
521         throws SystemException {
522         Object[] finderArgs = new Object[] { uuid };
523 
524         List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
525                 finderArgs, this);
526 
527         if (list == null) {
528             Session session = null;
529 
530             try {
531                 session = openSession();
532 
533                 StringBuilder query = new StringBuilder();
534 
535                 query.append(
536                     "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
537 
538                 if (uuid == null) {
539                     query.append("uuid_ IS NULL");
540                 }
541                 else {
542                     query.append("uuid_ = ?");
543                 }
544 
545                 query.append(" ");
546 
547                 Query q = session.createQuery(query.toString());
548 
549                 QueryPos qPos = QueryPos.getInstance(q);
550 
551                 if (uuid != null) {
552                     qPos.add(uuid);
553                 }
554 
555                 list = q.list();
556             }
557             catch (Exception e) {
558                 throw processException(e);
559             }
560             finally {
561                 if (list == null) {
562                     list = new ArrayList<SocialRelation>();
563                 }
564 
565                 cacheResult(list);
566 
567                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
568                     list);
569 
570                 closeSession(session);
571             }
572         }
573 
574         return list;
575     }
576 
577     public List<SocialRelation> findByUuid(String uuid, int start, int end)
578         throws SystemException {
579         return findByUuid(uuid, start, end, null);
580     }
581 
582     public List<SocialRelation> findByUuid(String uuid, int start, int end,
583         OrderByComparator obc) throws SystemException {
584         Object[] finderArgs = new Object[] {
585                 uuid,
586                 
587                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
588             };
589 
590         List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_UUID,
591                 finderArgs, this);
592 
593         if (list == null) {
594             Session session = null;
595 
596             try {
597                 session = openSession();
598 
599                 StringBuilder query = new StringBuilder();
600 
601                 query.append(
602                     "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
603 
604                 if (uuid == null) {
605                     query.append("uuid_ IS NULL");
606                 }
607                 else {
608                     query.append("uuid_ = ?");
609                 }
610 
611                 query.append(" ");
612 
613                 if (obc != null) {
614                     query.append("ORDER BY ");
615                     query.append(obc.getOrderBy());
616                 }
617 
618                 Query q = session.createQuery(query.toString());
619 
620                 QueryPos qPos = QueryPos.getInstance(q);
621 
622                 if (uuid != null) {
623                     qPos.add(uuid);
624                 }
625 
626                 list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
627                         start, end);
628             }
629             catch (Exception e) {
630                 throw processException(e);
631             }
632             finally {
633                 if (list == null) {
634                     list = new ArrayList<SocialRelation>();
635                 }
636 
637                 cacheResult(list);
638 
639                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_UUID,
640                     finderArgs, list);
641 
642                 closeSession(session);
643             }
644         }
645 
646         return list;
647     }
648 
649     public SocialRelation findByUuid_First(String uuid, OrderByComparator obc)
650         throws NoSuchRelationException, SystemException {
651         List<SocialRelation> list = findByUuid(uuid, 0, 1, obc);
652 
653         if (list.isEmpty()) {
654             StringBuilder msg = new StringBuilder();
655 
656             msg.append("No SocialRelation exists with the key {");
657 
658             msg.append("uuid=" + uuid);
659 
660             msg.append(StringPool.CLOSE_CURLY_BRACE);
661 
662             throw new NoSuchRelationException(msg.toString());
663         }
664         else {
665             return list.get(0);
666         }
667     }
668 
669     public SocialRelation findByUuid_Last(String uuid, OrderByComparator obc)
670         throws NoSuchRelationException, SystemException {
671         int count = countByUuid(uuid);
672 
673         List<SocialRelation> list = findByUuid(uuid, count - 1, count, obc);
674 
675         if (list.isEmpty()) {
676             StringBuilder msg = new StringBuilder();
677 
678             msg.append("No SocialRelation exists with the key {");
679 
680             msg.append("uuid=" + uuid);
681 
682             msg.append(StringPool.CLOSE_CURLY_BRACE);
683 
684             throw new NoSuchRelationException(msg.toString());
685         }
686         else {
687             return list.get(0);
688         }
689     }
690 
691     public SocialRelation[] findByUuid_PrevAndNext(long relationId,
692         String uuid, OrderByComparator obc)
693         throws NoSuchRelationException, SystemException {
694         SocialRelation socialRelation = findByPrimaryKey(relationId);
695 
696         int count = countByUuid(uuid);
697 
698         Session session = null;
699 
700         try {
701             session = openSession();
702 
703             StringBuilder query = new StringBuilder();
704 
705             query.append(
706                 "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
707 
708             if (uuid == null) {
709                 query.append("uuid_ IS NULL");
710             }
711             else {
712                 query.append("uuid_ = ?");
713             }
714 
715             query.append(" ");
716 
717             if (obc != null) {
718                 query.append("ORDER BY ");
719                 query.append(obc.getOrderBy());
720             }
721 
722             Query q = session.createQuery(query.toString());
723 
724             QueryPos qPos = QueryPos.getInstance(q);
725 
726             if (uuid != null) {
727                 qPos.add(uuid);
728             }
729 
730             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
731                     socialRelation);
732 
733             SocialRelation[] array = new SocialRelationImpl[3];
734 
735             array[0] = (SocialRelation)objArray[0];
736             array[1] = (SocialRelation)objArray[1];
737             array[2] = (SocialRelation)objArray[2];
738 
739             return array;
740         }
741         catch (Exception e) {
742             throw processException(e);
743         }
744         finally {
745             closeSession(session);
746         }
747     }
748 
749     public List<SocialRelation> findByCompanyId(long companyId)
750         throws SystemException {
751         Object[] finderArgs = new Object[] { new Long(companyId) };
752 
753         List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_COMPANYID,
754                 finderArgs, this);
755 
756         if (list == null) {
757             Session session = null;
758 
759             try {
760                 session = openSession();
761 
762                 StringBuilder query = new StringBuilder();
763 
764                 query.append(
765                     "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
766 
767                 query.append("companyId = ?");
768 
769                 query.append(" ");
770 
771                 Query q = session.createQuery(query.toString());
772 
773                 QueryPos qPos = QueryPos.getInstance(q);
774 
775                 qPos.add(companyId);
776 
777                 list = q.list();
778             }
779             catch (Exception e) {
780                 throw processException(e);
781             }
782             finally {
783                 if (list == null) {
784                     list = new ArrayList<SocialRelation>();
785                 }
786 
787                 cacheResult(list);
788 
789                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_COMPANYID,
790                     finderArgs, list);
791 
792                 closeSession(session);
793             }
794         }
795 
796         return list;
797     }
798 
799     public List<SocialRelation> findByCompanyId(long companyId, int start,
800         int end) throws SystemException {
801         return findByCompanyId(companyId, start, end, null);
802     }
803 
804     public List<SocialRelation> findByCompanyId(long companyId, int start,
805         int end, OrderByComparator obc) throws SystemException {
806         Object[] finderArgs = new Object[] {
807                 new Long(companyId),
808                 
809                 String.valueOf(start), String.valueOf(end), String.valueOf(obc)
810             };
811 
812         List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
813                 finderArgs, this);
814 
815         if (list == null) {
816             Session session = null;
817 
818             try {
819                 session = openSession();
820 
821                 StringBuilder query = new StringBuilder();
822 
823                 query.append(
824                     "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
825 
826                 query.append("companyId = ?");
827 
828                 query.append(" ");
829 
830                 if (obc != null) {
831                     query.append("ORDER BY ");
832                     query.append(obc.getOrderBy());
833                 }
834 
835                 Query q = session.createQuery(query.toString());
836 
837                 QueryPos qPos = QueryPos.getInstance(q);
838 
839                 qPos.add(companyId);
840 
841                 list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
842                         start, end);
843             }
844             catch (Exception e) {
845                 throw processException(e);
846             }
847             finally {
848                 if (list == null) {
849                     list = new ArrayList<SocialRelation>();
850                 }
851 
852                 cacheResult(list);
853 
854                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_COMPANYID,
855                     finderArgs, list);
856 
857                 closeSession(session);
858             }
859         }
860 
861         return list;
862     }
863 
864     public SocialRelation findByCompanyId_First(long companyId,
865         OrderByComparator obc) throws NoSuchRelationException, SystemException {
866         List<SocialRelation> list = findByCompanyId(companyId, 0, 1, obc);
867 
868         if (list.isEmpty()) {
869             StringBuilder msg = new StringBuilder();
870 
871             msg.append("No SocialRelation exists with the key {");
872 
873             msg.append("companyId=" + companyId);
874 
875             msg.append(StringPool.CLOSE_CURLY_BRACE);
876 
877             throw new NoSuchRelationException(msg.toString());
878         }
879         else {
880             return list.get(0);
881         }
882     }
883 
884     public SocialRelation findByCompanyId_Last(long companyId,
885         OrderByComparator obc) throws NoSuchRelationException, SystemException {
886         int count = countByCompanyId(companyId);
887 
888         List<SocialRelation> list = findByCompanyId(companyId, count - 1,
889                 count, obc);
890 
891         if (list.isEmpty()) {
892             StringBuilder msg = new StringBuilder();
893 
894             msg.append("No SocialRelation exists with the key {");
895 
896             msg.append("companyId=" + companyId);
897 
898             msg.append(StringPool.CLOSE_CURLY_BRACE);
899 
900             throw new NoSuchRelationException(msg.toString());
901         }
902         else {
903             return list.get(0);
904         }
905     }
906 
907     public SocialRelation[] findByCompanyId_PrevAndNext(long relationId,
908         long companyId, OrderByComparator obc)
909         throws NoSuchRelationException, SystemException {
910         SocialRelation socialRelation = findByPrimaryKey(relationId);
911 
912         int count = countByCompanyId(companyId);
913 
914         Session session = null;
915 
916         try {
917             session = openSession();
918 
919             StringBuilder query = new StringBuilder();
920 
921             query.append(
922                 "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
923 
924             query.append("companyId = ?");
925 
926             query.append(" ");
927 
928             if (obc != null) {
929                 query.append("ORDER BY ");
930                 query.append(obc.getOrderBy());
931             }
932 
933             Query q = session.createQuery(query.toString());
934 
935             QueryPos qPos = QueryPos.getInstance(q);
936 
937             qPos.add(companyId);
938 
939             Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
940                     socialRelation);
941 
942             SocialRelation[] array = new SocialRelationImpl[3];
943 
944             array[0] = (SocialRelation)objArray[0];
945             array[1] = (SocialRelation)objArray[1];
946             array[2] = (SocialRelation)objArray[2];
947 
948             return array;
949         }
950         catch (Exception e) {
951             throw processException(e);
952         }
953         finally {
954             closeSession(session);
955         }
956     }
957 
958     public List<SocialRelation> findByUserId1(long userId1)
959         throws SystemException {
960         Object[] finderArgs = new Object[] { new Long(userId1) };
961 
962         List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID1,
963                 finderArgs, this);
964 
965         if (list == null) {
966             Session session = null;
967 
968             try {
969                 session = openSession();
970 
971                 StringBuilder query = new StringBuilder();
972 
973                 query.append(
974                     "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
975 
976                 query.append("userId1 = ?");
977 
978                 query.append(" ");
979 
980                 Query q = session.createQuery(query.toString());
981 
982                 QueryPos qPos = QueryPos.getInstance(q);
983 
984                 qPos.add(userId1);
985 
986                 list = q.list();
987             }
988             catch (Exception e) {
989                 throw processException(e);
990             }
991             finally {
992                 if (list == null) {
993                     list = new ArrayList<SocialRelation>();
994                 }
995 
996                 cacheResult(list);
997 
998                 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID1,
999                     finderArgs, list);
1000
1001                closeSession(session);
1002            }
1003        }
1004
1005        return list;
1006    }
1007
1008    public List<SocialRelation> findByUserId1(long userId1, int start, int end)
1009        throws SystemException {
1010        return findByUserId1(userId1, start, end, null);
1011    }
1012
1013    public List<SocialRelation> findByUserId1(long userId1, int start, int end,
1014        OrderByComparator obc) throws SystemException {
1015        Object[] finderArgs = new Object[] {
1016                new Long(userId1),
1017                
1018                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1019            };
1020
1021        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERID1,
1022                finderArgs, this);
1023
1024        if (list == null) {
1025            Session session = null;
1026
1027            try {
1028                session = openSession();
1029
1030                StringBuilder query = new StringBuilder();
1031
1032                query.append(
1033                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1034
1035                query.append("userId1 = ?");
1036
1037                query.append(" ");
1038
1039                if (obc != null) {
1040                    query.append("ORDER BY ");
1041                    query.append(obc.getOrderBy());
1042                }
1043
1044                Query q = session.createQuery(query.toString());
1045
1046                QueryPos qPos = QueryPos.getInstance(q);
1047
1048                qPos.add(userId1);
1049
1050                list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
1051                        start, end);
1052            }
1053            catch (Exception e) {
1054                throw processException(e);
1055            }
1056            finally {
1057                if (list == null) {
1058                    list = new ArrayList<SocialRelation>();
1059                }
1060
1061                cacheResult(list);
1062
1063                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERID1,
1064                    finderArgs, list);
1065
1066                closeSession(session);
1067            }
1068        }
1069
1070        return list;
1071    }
1072
1073    public SocialRelation findByUserId1_First(long userId1,
1074        OrderByComparator obc) throws NoSuchRelationException, SystemException {
1075        List<SocialRelation> list = findByUserId1(userId1, 0, 1, obc);
1076
1077        if (list.isEmpty()) {
1078            StringBuilder msg = new StringBuilder();
1079
1080            msg.append("No SocialRelation exists with the key {");
1081
1082            msg.append("userId1=" + userId1);
1083
1084            msg.append(StringPool.CLOSE_CURLY_BRACE);
1085
1086            throw new NoSuchRelationException(msg.toString());
1087        }
1088        else {
1089            return list.get(0);
1090        }
1091    }
1092
1093    public SocialRelation findByUserId1_Last(long userId1, OrderByComparator obc)
1094        throws NoSuchRelationException, SystemException {
1095        int count = countByUserId1(userId1);
1096
1097        List<SocialRelation> list = findByUserId1(userId1, count - 1, count, obc);
1098
1099        if (list.isEmpty()) {
1100            StringBuilder msg = new StringBuilder();
1101
1102            msg.append("No SocialRelation exists with the key {");
1103
1104            msg.append("userId1=" + userId1);
1105
1106            msg.append(StringPool.CLOSE_CURLY_BRACE);
1107
1108            throw new NoSuchRelationException(msg.toString());
1109        }
1110        else {
1111            return list.get(0);
1112        }
1113    }
1114
1115    public SocialRelation[] findByUserId1_PrevAndNext(long relationId,
1116        long userId1, OrderByComparator obc)
1117        throws NoSuchRelationException, SystemException {
1118        SocialRelation socialRelation = findByPrimaryKey(relationId);
1119
1120        int count = countByUserId1(userId1);
1121
1122        Session session = null;
1123
1124        try {
1125            session = openSession();
1126
1127            StringBuilder query = new StringBuilder();
1128
1129            query.append(
1130                "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1131
1132            query.append("userId1 = ?");
1133
1134            query.append(" ");
1135
1136            if (obc != null) {
1137                query.append("ORDER BY ");
1138                query.append(obc.getOrderBy());
1139            }
1140
1141            Query q = session.createQuery(query.toString());
1142
1143            QueryPos qPos = QueryPos.getInstance(q);
1144
1145            qPos.add(userId1);
1146
1147            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1148                    socialRelation);
1149
1150            SocialRelation[] array = new SocialRelationImpl[3];
1151
1152            array[0] = (SocialRelation)objArray[0];
1153            array[1] = (SocialRelation)objArray[1];
1154            array[2] = (SocialRelation)objArray[2];
1155
1156            return array;
1157        }
1158        catch (Exception e) {
1159            throw processException(e);
1160        }
1161        finally {
1162            closeSession(session);
1163        }
1164    }
1165
1166    public List<SocialRelation> findByUserId2(long userId2)
1167        throws SystemException {
1168        Object[] finderArgs = new Object[] { new Long(userId2) };
1169
1170        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_USERID2,
1171                finderArgs, this);
1172
1173        if (list == null) {
1174            Session session = null;
1175
1176            try {
1177                session = openSession();
1178
1179                StringBuilder query = new StringBuilder();
1180
1181                query.append(
1182                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1183
1184                query.append("userId2 = ?");
1185
1186                query.append(" ");
1187
1188                Query q = session.createQuery(query.toString());
1189
1190                QueryPos qPos = QueryPos.getInstance(q);
1191
1192                qPos.add(userId2);
1193
1194                list = q.list();
1195            }
1196            catch (Exception e) {
1197                throw processException(e);
1198            }
1199            finally {
1200                if (list == null) {
1201                    list = new ArrayList<SocialRelation>();
1202                }
1203
1204                cacheResult(list);
1205
1206                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_USERID2,
1207                    finderArgs, list);
1208
1209                closeSession(session);
1210            }
1211        }
1212
1213        return list;
1214    }
1215
1216    public List<SocialRelation> findByUserId2(long userId2, int start, int end)
1217        throws SystemException {
1218        return findByUserId2(userId2, start, end, null);
1219    }
1220
1221    public List<SocialRelation> findByUserId2(long userId2, int start, int end,
1222        OrderByComparator obc) throws SystemException {
1223        Object[] finderArgs = new Object[] {
1224                new Long(userId2),
1225                
1226                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1227            };
1228
1229        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_USERID2,
1230                finderArgs, this);
1231
1232        if (list == null) {
1233            Session session = null;
1234
1235            try {
1236                session = openSession();
1237
1238                StringBuilder query = new StringBuilder();
1239
1240                query.append(
1241                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1242
1243                query.append("userId2 = ?");
1244
1245                query.append(" ");
1246
1247                if (obc != null) {
1248                    query.append("ORDER BY ");
1249                    query.append(obc.getOrderBy());
1250                }
1251
1252                Query q = session.createQuery(query.toString());
1253
1254                QueryPos qPos = QueryPos.getInstance(q);
1255
1256                qPos.add(userId2);
1257
1258                list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
1259                        start, end);
1260            }
1261            catch (Exception e) {
1262                throw processException(e);
1263            }
1264            finally {
1265                if (list == null) {
1266                    list = new ArrayList<SocialRelation>();
1267                }
1268
1269                cacheResult(list);
1270
1271                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_USERID2,
1272                    finderArgs, list);
1273
1274                closeSession(session);
1275            }
1276        }
1277
1278        return list;
1279    }
1280
1281    public SocialRelation findByUserId2_First(long userId2,
1282        OrderByComparator obc) throws NoSuchRelationException, SystemException {
1283        List<SocialRelation> list = findByUserId2(userId2, 0, 1, obc);
1284
1285        if (list.isEmpty()) {
1286            StringBuilder msg = new StringBuilder();
1287
1288            msg.append("No SocialRelation exists with the key {");
1289
1290            msg.append("userId2=" + userId2);
1291
1292            msg.append(StringPool.CLOSE_CURLY_BRACE);
1293
1294            throw new NoSuchRelationException(msg.toString());
1295        }
1296        else {
1297            return list.get(0);
1298        }
1299    }
1300
1301    public SocialRelation findByUserId2_Last(long userId2, OrderByComparator obc)
1302        throws NoSuchRelationException, SystemException {
1303        int count = countByUserId2(userId2);
1304
1305        List<SocialRelation> list = findByUserId2(userId2, count - 1, count, obc);
1306
1307        if (list.isEmpty()) {
1308            StringBuilder msg = new StringBuilder();
1309
1310            msg.append("No SocialRelation exists with the key {");
1311
1312            msg.append("userId2=" + userId2);
1313
1314            msg.append(StringPool.CLOSE_CURLY_BRACE);
1315
1316            throw new NoSuchRelationException(msg.toString());
1317        }
1318        else {
1319            return list.get(0);
1320        }
1321    }
1322
1323    public SocialRelation[] findByUserId2_PrevAndNext(long relationId,
1324        long userId2, OrderByComparator obc)
1325        throws NoSuchRelationException, SystemException {
1326        SocialRelation socialRelation = findByPrimaryKey(relationId);
1327
1328        int count = countByUserId2(userId2);
1329
1330        Session session = null;
1331
1332        try {
1333            session = openSession();
1334
1335            StringBuilder query = new StringBuilder();
1336
1337            query.append(
1338                "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1339
1340            query.append("userId2 = ?");
1341
1342            query.append(" ");
1343
1344            if (obc != null) {
1345                query.append("ORDER BY ");
1346                query.append(obc.getOrderBy());
1347            }
1348
1349            Query q = session.createQuery(query.toString());
1350
1351            QueryPos qPos = QueryPos.getInstance(q);
1352
1353            qPos.add(userId2);
1354
1355            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1356                    socialRelation);
1357
1358            SocialRelation[] array = new SocialRelationImpl[3];
1359
1360            array[0] = (SocialRelation)objArray[0];
1361            array[1] = (SocialRelation)objArray[1];
1362            array[2] = (SocialRelation)objArray[2];
1363
1364            return array;
1365        }
1366        catch (Exception e) {
1367            throw processException(e);
1368        }
1369        finally {
1370            closeSession(session);
1371        }
1372    }
1373
1374    public List<SocialRelation> findByType(int type) throws SystemException {
1375        Object[] finderArgs = new Object[] { new Integer(type) };
1376
1377        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_TYPE,
1378                finderArgs, this);
1379
1380        if (list == null) {
1381            Session session = null;
1382
1383            try {
1384                session = openSession();
1385
1386                StringBuilder query = new StringBuilder();
1387
1388                query.append(
1389                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1390
1391                query.append("type_ = ?");
1392
1393                query.append(" ");
1394
1395                Query q = session.createQuery(query.toString());
1396
1397                QueryPos qPos = QueryPos.getInstance(q);
1398
1399                qPos.add(type);
1400
1401                list = q.list();
1402            }
1403            catch (Exception e) {
1404                throw processException(e);
1405            }
1406            finally {
1407                if (list == null) {
1408                    list = new ArrayList<SocialRelation>();
1409                }
1410
1411                cacheResult(list);
1412
1413                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_TYPE, finderArgs,
1414                    list);
1415
1416                closeSession(session);
1417            }
1418        }
1419
1420        return list;
1421    }
1422
1423    public List<SocialRelation> findByType(int type, int start, int end)
1424        throws SystemException {
1425        return findByType(type, start, end, null);
1426    }
1427
1428    public List<SocialRelation> findByType(int type, int start, int end,
1429        OrderByComparator obc) throws SystemException {
1430        Object[] finderArgs = new Object[] {
1431                new Integer(type),
1432                
1433                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1434            };
1435
1436        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_TYPE,
1437                finderArgs, this);
1438
1439        if (list == null) {
1440            Session session = null;
1441
1442            try {
1443                session = openSession();
1444
1445                StringBuilder query = new StringBuilder();
1446
1447                query.append(
1448                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1449
1450                query.append("type_ = ?");
1451
1452                query.append(" ");
1453
1454                if (obc != null) {
1455                    query.append("ORDER BY ");
1456                    query.append(obc.getOrderBy());
1457                }
1458
1459                Query q = session.createQuery(query.toString());
1460
1461                QueryPos qPos = QueryPos.getInstance(q);
1462
1463                qPos.add(type);
1464
1465                list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
1466                        start, end);
1467            }
1468            catch (Exception e) {
1469                throw processException(e);
1470            }
1471            finally {
1472                if (list == null) {
1473                    list = new ArrayList<SocialRelation>();
1474                }
1475
1476                cacheResult(list);
1477
1478                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_TYPE,
1479                    finderArgs, list);
1480
1481                closeSession(session);
1482            }
1483        }
1484
1485        return list;
1486    }
1487
1488    public SocialRelation findByType_First(int type, OrderByComparator obc)
1489        throws NoSuchRelationException, SystemException {
1490        List<SocialRelation> list = findByType(type, 0, 1, obc);
1491
1492        if (list.isEmpty()) {
1493            StringBuilder msg = new StringBuilder();
1494
1495            msg.append("No SocialRelation exists with the key {");
1496
1497            msg.append("type=" + type);
1498
1499            msg.append(StringPool.CLOSE_CURLY_BRACE);
1500
1501            throw new NoSuchRelationException(msg.toString());
1502        }
1503        else {
1504            return list.get(0);
1505        }
1506    }
1507
1508    public SocialRelation findByType_Last(int type, OrderByComparator obc)
1509        throws NoSuchRelationException, SystemException {
1510        int count = countByType(type);
1511
1512        List<SocialRelation> list = findByType(type, count - 1, count, obc);
1513
1514        if (list.isEmpty()) {
1515            StringBuilder msg = new StringBuilder();
1516
1517            msg.append("No SocialRelation exists with the key {");
1518
1519            msg.append("type=" + type);
1520
1521            msg.append(StringPool.CLOSE_CURLY_BRACE);
1522
1523            throw new NoSuchRelationException(msg.toString());
1524        }
1525        else {
1526            return list.get(0);
1527        }
1528    }
1529
1530    public SocialRelation[] findByType_PrevAndNext(long relationId, int type,
1531        OrderByComparator obc) throws NoSuchRelationException, SystemException {
1532        SocialRelation socialRelation = findByPrimaryKey(relationId);
1533
1534        int count = countByType(type);
1535
1536        Session session = null;
1537
1538        try {
1539            session = openSession();
1540
1541            StringBuilder query = new StringBuilder();
1542
1543            query.append(
1544                "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1545
1546            query.append("type_ = ?");
1547
1548            query.append(" ");
1549
1550            if (obc != null) {
1551                query.append("ORDER BY ");
1552                query.append(obc.getOrderBy());
1553            }
1554
1555            Query q = session.createQuery(query.toString());
1556
1557            QueryPos qPos = QueryPos.getInstance(q);
1558
1559            qPos.add(type);
1560
1561            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1562                    socialRelation);
1563
1564            SocialRelation[] array = new SocialRelationImpl[3];
1565
1566            array[0] = (SocialRelation)objArray[0];
1567            array[1] = (SocialRelation)objArray[1];
1568            array[2] = (SocialRelation)objArray[2];
1569
1570            return array;
1571        }
1572        catch (Exception e) {
1573            throw processException(e);
1574        }
1575        finally {
1576            closeSession(session);
1577        }
1578    }
1579
1580    public List<SocialRelation> findByC_T(long companyId, int type)
1581        throws SystemException {
1582        Object[] finderArgs = new Object[] {
1583                new Long(companyId), new Integer(type)
1584            };
1585
1586        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_C_T,
1587                finderArgs, this);
1588
1589        if (list == null) {
1590            Session session = null;
1591
1592            try {
1593                session = openSession();
1594
1595                StringBuilder query = new StringBuilder();
1596
1597                query.append(
1598                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1599
1600                query.append("companyId = ?");
1601
1602                query.append(" AND ");
1603
1604                query.append("type_ = ?");
1605
1606                query.append(" ");
1607
1608                Query q = session.createQuery(query.toString());
1609
1610                QueryPos qPos = QueryPos.getInstance(q);
1611
1612                qPos.add(companyId);
1613
1614                qPos.add(type);
1615
1616                list = q.list();
1617            }
1618            catch (Exception e) {
1619                throw processException(e);
1620            }
1621            finally {
1622                if (list == null) {
1623                    list = new ArrayList<SocialRelation>();
1624                }
1625
1626                cacheResult(list);
1627
1628                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_C_T, finderArgs,
1629                    list);
1630
1631                closeSession(session);
1632            }
1633        }
1634
1635        return list;
1636    }
1637
1638    public List<SocialRelation> findByC_T(long companyId, int type, int start,
1639        int end) throws SystemException {
1640        return findByC_T(companyId, type, start, end, null);
1641    }
1642
1643    public List<SocialRelation> findByC_T(long companyId, int type, int start,
1644        int end, OrderByComparator obc) throws SystemException {
1645        Object[] finderArgs = new Object[] {
1646                new Long(companyId), new Integer(type),
1647                
1648                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1649            };
1650
1651        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_C_T,
1652                finderArgs, this);
1653
1654        if (list == null) {
1655            Session session = null;
1656
1657            try {
1658                session = openSession();
1659
1660                StringBuilder query = new StringBuilder();
1661
1662                query.append(
1663                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1664
1665                query.append("companyId = ?");
1666
1667                query.append(" AND ");
1668
1669                query.append("type_ = ?");
1670
1671                query.append(" ");
1672
1673                if (obc != null) {
1674                    query.append("ORDER BY ");
1675                    query.append(obc.getOrderBy());
1676                }
1677
1678                Query q = session.createQuery(query.toString());
1679
1680                QueryPos qPos = QueryPos.getInstance(q);
1681
1682                qPos.add(companyId);
1683
1684                qPos.add(type);
1685
1686                list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
1687                        start, end);
1688            }
1689            catch (Exception e) {
1690                throw processException(e);
1691            }
1692            finally {
1693                if (list == null) {
1694                    list = new ArrayList<SocialRelation>();
1695                }
1696
1697                cacheResult(list);
1698
1699                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_C_T,
1700                    finderArgs, list);
1701
1702                closeSession(session);
1703            }
1704        }
1705
1706        return list;
1707    }
1708
1709    public SocialRelation findByC_T_First(long companyId, int type,
1710        OrderByComparator obc) throws NoSuchRelationException, SystemException {
1711        List<SocialRelation> list = findByC_T(companyId, type, 0, 1, obc);
1712
1713        if (list.isEmpty()) {
1714            StringBuilder msg = new StringBuilder();
1715
1716            msg.append("No SocialRelation exists with the key {");
1717
1718            msg.append("companyId=" + companyId);
1719
1720            msg.append(", ");
1721            msg.append("type=" + type);
1722
1723            msg.append(StringPool.CLOSE_CURLY_BRACE);
1724
1725            throw new NoSuchRelationException(msg.toString());
1726        }
1727        else {
1728            return list.get(0);
1729        }
1730    }
1731
1732    public SocialRelation findByC_T_Last(long companyId, int type,
1733        OrderByComparator obc) throws NoSuchRelationException, SystemException {
1734        int count = countByC_T(companyId, type);
1735
1736        List<SocialRelation> list = findByC_T(companyId, type, count - 1,
1737                count, obc);
1738
1739        if (list.isEmpty()) {
1740            StringBuilder msg = new StringBuilder();
1741
1742            msg.append("No SocialRelation exists with the key {");
1743
1744            msg.append("companyId=" + companyId);
1745
1746            msg.append(", ");
1747            msg.append("type=" + type);
1748
1749            msg.append(StringPool.CLOSE_CURLY_BRACE);
1750
1751            throw new NoSuchRelationException(msg.toString());
1752        }
1753        else {
1754            return list.get(0);
1755        }
1756    }
1757
1758    public SocialRelation[] findByC_T_PrevAndNext(long relationId,
1759        long companyId, int type, OrderByComparator obc)
1760        throws NoSuchRelationException, SystemException {
1761        SocialRelation socialRelation = findByPrimaryKey(relationId);
1762
1763        int count = countByC_T(companyId, type);
1764
1765        Session session = null;
1766
1767        try {
1768            session = openSession();
1769
1770            StringBuilder query = new StringBuilder();
1771
1772            query.append(
1773                "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1774
1775            query.append("companyId = ?");
1776
1777            query.append(" AND ");
1778
1779            query.append("type_ = ?");
1780
1781            query.append(" ");
1782
1783            if (obc != null) {
1784                query.append("ORDER BY ");
1785                query.append(obc.getOrderBy());
1786            }
1787
1788            Query q = session.createQuery(query.toString());
1789
1790            QueryPos qPos = QueryPos.getInstance(q);
1791
1792            qPos.add(companyId);
1793
1794            qPos.add(type);
1795
1796            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
1797                    socialRelation);
1798
1799            SocialRelation[] array = new SocialRelationImpl[3];
1800
1801            array[0] = (SocialRelation)objArray[0];
1802            array[1] = (SocialRelation)objArray[1];
1803            array[2] = (SocialRelation)objArray[2];
1804
1805            return array;
1806        }
1807        catch (Exception e) {
1808            throw processException(e);
1809        }
1810        finally {
1811            closeSession(session);
1812        }
1813    }
1814
1815    public List<SocialRelation> findByU1_T(long userId1, int type)
1816        throws SystemException {
1817        Object[] finderArgs = new Object[] { new Long(userId1), new Integer(type) };
1818
1819        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U1_T,
1820                finderArgs, this);
1821
1822        if (list == null) {
1823            Session session = null;
1824
1825            try {
1826                session = openSession();
1827
1828                StringBuilder query = new StringBuilder();
1829
1830                query.append(
1831                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1832
1833                query.append("userId1 = ?");
1834
1835                query.append(" AND ");
1836
1837                query.append("type_ = ?");
1838
1839                query.append(" ");
1840
1841                Query q = session.createQuery(query.toString());
1842
1843                QueryPos qPos = QueryPos.getInstance(q);
1844
1845                qPos.add(userId1);
1846
1847                qPos.add(type);
1848
1849                list = q.list();
1850            }
1851            catch (Exception e) {
1852                throw processException(e);
1853            }
1854            finally {
1855                if (list == null) {
1856                    list = new ArrayList<SocialRelation>();
1857                }
1858
1859                cacheResult(list);
1860
1861                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U1_T, finderArgs,
1862                    list);
1863
1864                closeSession(session);
1865            }
1866        }
1867
1868        return list;
1869    }
1870
1871    public List<SocialRelation> findByU1_T(long userId1, int type, int start,
1872        int end) throws SystemException {
1873        return findByU1_T(userId1, type, start, end, null);
1874    }
1875
1876    public List<SocialRelation> findByU1_T(long userId1, int type, int start,
1877        int end, OrderByComparator obc) throws SystemException {
1878        Object[] finderArgs = new Object[] {
1879                new Long(userId1), new Integer(type),
1880                
1881                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
1882            };
1883
1884        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_U1_T,
1885                finderArgs, this);
1886
1887        if (list == null) {
1888            Session session = null;
1889
1890            try {
1891                session = openSession();
1892
1893                StringBuilder query = new StringBuilder();
1894
1895                query.append(
1896                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
1897
1898                query.append("userId1 = ?");
1899
1900                query.append(" AND ");
1901
1902                query.append("type_ = ?");
1903
1904                query.append(" ");
1905
1906                if (obc != null) {
1907                    query.append("ORDER BY ");
1908                    query.append(obc.getOrderBy());
1909                }
1910
1911                Query q = session.createQuery(query.toString());
1912
1913                QueryPos qPos = QueryPos.getInstance(q);
1914
1915                qPos.add(userId1);
1916
1917                qPos.add(type);
1918
1919                list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
1920                        start, end);
1921            }
1922            catch (Exception e) {
1923                throw processException(e);
1924            }
1925            finally {
1926                if (list == null) {
1927                    list = new ArrayList<SocialRelation>();
1928                }
1929
1930                cacheResult(list);
1931
1932                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_U1_T,
1933                    finderArgs, list);
1934
1935                closeSession(session);
1936            }
1937        }
1938
1939        return list;
1940    }
1941
1942    public SocialRelation findByU1_T_First(long userId1, int type,
1943        OrderByComparator obc) throws NoSuchRelationException, SystemException {
1944        List<SocialRelation> list = findByU1_T(userId1, type, 0, 1, obc);
1945
1946        if (list.isEmpty()) {
1947            StringBuilder msg = new StringBuilder();
1948
1949            msg.append("No SocialRelation exists with the key {");
1950
1951            msg.append("userId1=" + userId1);
1952
1953            msg.append(", ");
1954            msg.append("type=" + type);
1955
1956            msg.append(StringPool.CLOSE_CURLY_BRACE);
1957
1958            throw new NoSuchRelationException(msg.toString());
1959        }
1960        else {
1961            return list.get(0);
1962        }
1963    }
1964
1965    public SocialRelation findByU1_T_Last(long userId1, int type,
1966        OrderByComparator obc) throws NoSuchRelationException, SystemException {
1967        int count = countByU1_T(userId1, type);
1968
1969        List<SocialRelation> list = findByU1_T(userId1, type, count - 1, count,
1970                obc);
1971
1972        if (list.isEmpty()) {
1973            StringBuilder msg = new StringBuilder();
1974
1975            msg.append("No SocialRelation exists with the key {");
1976
1977            msg.append("userId1=" + userId1);
1978
1979            msg.append(", ");
1980            msg.append("type=" + type);
1981
1982            msg.append(StringPool.CLOSE_CURLY_BRACE);
1983
1984            throw new NoSuchRelationException(msg.toString());
1985        }
1986        else {
1987            return list.get(0);
1988        }
1989    }
1990
1991    public SocialRelation[] findByU1_T_PrevAndNext(long relationId,
1992        long userId1, int type, OrderByComparator obc)
1993        throws NoSuchRelationException, SystemException {
1994        SocialRelation socialRelation = findByPrimaryKey(relationId);
1995
1996        int count = countByU1_T(userId1, type);
1997
1998        Session session = null;
1999
2000        try {
2001            session = openSession();
2002
2003            StringBuilder query = new StringBuilder();
2004
2005            query.append(
2006                "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2007
2008            query.append("userId1 = ?");
2009
2010            query.append(" AND ");
2011
2012            query.append("type_ = ?");
2013
2014            query.append(" ");
2015
2016            if (obc != null) {
2017                query.append("ORDER BY ");
2018                query.append(obc.getOrderBy());
2019            }
2020
2021            Query q = session.createQuery(query.toString());
2022
2023            QueryPos qPos = QueryPos.getInstance(q);
2024
2025            qPos.add(userId1);
2026
2027            qPos.add(type);
2028
2029            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2030                    socialRelation);
2031
2032            SocialRelation[] array = new SocialRelationImpl[3];
2033
2034            array[0] = (SocialRelation)objArray[0];
2035            array[1] = (SocialRelation)objArray[1];
2036            array[2] = (SocialRelation)objArray[2];
2037
2038            return array;
2039        }
2040        catch (Exception e) {
2041            throw processException(e);
2042        }
2043        finally {
2044            closeSession(session);
2045        }
2046    }
2047
2048    public List<SocialRelation> findByU2_T(long userId2, int type)
2049        throws SystemException {
2050        Object[] finderArgs = new Object[] { new Long(userId2), new Integer(type) };
2051
2052        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_U2_T,
2053                finderArgs, this);
2054
2055        if (list == null) {
2056            Session session = null;
2057
2058            try {
2059                session = openSession();
2060
2061                StringBuilder query = new StringBuilder();
2062
2063                query.append(
2064                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2065
2066                query.append("userId2 = ?");
2067
2068                query.append(" AND ");
2069
2070                query.append("type_ = ?");
2071
2072                query.append(" ");
2073
2074                Query q = session.createQuery(query.toString());
2075
2076                QueryPos qPos = QueryPos.getInstance(q);
2077
2078                qPos.add(userId2);
2079
2080                qPos.add(type);
2081
2082                list = q.list();
2083            }
2084            catch (Exception e) {
2085                throw processException(e);
2086            }
2087            finally {
2088                if (list == null) {
2089                    list = new ArrayList<SocialRelation>();
2090                }
2091
2092                cacheResult(list);
2093
2094                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_U2_T, finderArgs,
2095                    list);
2096
2097                closeSession(session);
2098            }
2099        }
2100
2101        return list;
2102    }
2103
2104    public List<SocialRelation> findByU2_T(long userId2, int type, int start,
2105        int end) throws SystemException {
2106        return findByU2_T(userId2, type, start, end, null);
2107    }
2108
2109    public List<SocialRelation> findByU2_T(long userId2, int type, int start,
2110        int end, OrderByComparator obc) throws SystemException {
2111        Object[] finderArgs = new Object[] {
2112                new Long(userId2), new Integer(type),
2113                
2114                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2115            };
2116
2117        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_OBC_U2_T,
2118                finderArgs, this);
2119
2120        if (list == null) {
2121            Session session = null;
2122
2123            try {
2124                session = openSession();
2125
2126                StringBuilder query = new StringBuilder();
2127
2128                query.append(
2129                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2130
2131                query.append("userId2 = ?");
2132
2133                query.append(" AND ");
2134
2135                query.append("type_ = ?");
2136
2137                query.append(" ");
2138
2139                if (obc != null) {
2140                    query.append("ORDER BY ");
2141                    query.append(obc.getOrderBy());
2142                }
2143
2144                Query q = session.createQuery(query.toString());
2145
2146                QueryPos qPos = QueryPos.getInstance(q);
2147
2148                qPos.add(userId2);
2149
2150                qPos.add(type);
2151
2152                list = (List<SocialRelation>)QueryUtil.list(q, getDialect(),
2153                        start, end);
2154            }
2155            catch (Exception e) {
2156                throw processException(e);
2157            }
2158            finally {
2159                if (list == null) {
2160                    list = new ArrayList<SocialRelation>();
2161                }
2162
2163                cacheResult(list);
2164
2165                FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_OBC_U2_T,
2166                    finderArgs, list);
2167
2168                closeSession(session);
2169            }
2170        }
2171
2172        return list;
2173    }
2174
2175    public SocialRelation findByU2_T_First(long userId2, int type,
2176        OrderByComparator obc) throws NoSuchRelationException, SystemException {
2177        List<SocialRelation> list = findByU2_T(userId2, type, 0, 1, obc);
2178
2179        if (list.isEmpty()) {
2180            StringBuilder msg = new StringBuilder();
2181
2182            msg.append("No SocialRelation exists with the key {");
2183
2184            msg.append("userId2=" + userId2);
2185
2186            msg.append(", ");
2187            msg.append("type=" + type);
2188
2189            msg.append(StringPool.CLOSE_CURLY_BRACE);
2190
2191            throw new NoSuchRelationException(msg.toString());
2192        }
2193        else {
2194            return list.get(0);
2195        }
2196    }
2197
2198    public SocialRelation findByU2_T_Last(long userId2, int type,
2199        OrderByComparator obc) throws NoSuchRelationException, SystemException {
2200        int count = countByU2_T(userId2, type);
2201
2202        List<SocialRelation> list = findByU2_T(userId2, type, count - 1, count,
2203                obc);
2204
2205        if (list.isEmpty()) {
2206            StringBuilder msg = new StringBuilder();
2207
2208            msg.append("No SocialRelation exists with the key {");
2209
2210            msg.append("userId2=" + userId2);
2211
2212            msg.append(", ");
2213            msg.append("type=" + type);
2214
2215            msg.append(StringPool.CLOSE_CURLY_BRACE);
2216
2217            throw new NoSuchRelationException(msg.toString());
2218        }
2219        else {
2220            return list.get(0);
2221        }
2222    }
2223
2224    public SocialRelation[] findByU2_T_PrevAndNext(long relationId,
2225        long userId2, int type, OrderByComparator obc)
2226        throws NoSuchRelationException, SystemException {
2227        SocialRelation socialRelation = findByPrimaryKey(relationId);
2228
2229        int count = countByU2_T(userId2, type);
2230
2231        Session session = null;
2232
2233        try {
2234            session = openSession();
2235
2236            StringBuilder query = new StringBuilder();
2237
2238            query.append(
2239                "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2240
2241            query.append("userId2 = ?");
2242
2243            query.append(" AND ");
2244
2245            query.append("type_ = ?");
2246
2247            query.append(" ");
2248
2249            if (obc != null) {
2250                query.append("ORDER BY ");
2251                query.append(obc.getOrderBy());
2252            }
2253
2254            Query q = session.createQuery(query.toString());
2255
2256            QueryPos qPos = QueryPos.getInstance(q);
2257
2258            qPos.add(userId2);
2259
2260            qPos.add(type);
2261
2262            Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc,
2263                    socialRelation);
2264
2265            SocialRelation[] array = new SocialRelationImpl[3];
2266
2267            array[0] = (SocialRelation)objArray[0];
2268            array[1] = (SocialRelation)objArray[1];
2269            array[2] = (SocialRelation)objArray[2];
2270
2271            return array;
2272        }
2273        catch (Exception e) {
2274            throw processException(e);
2275        }
2276        finally {
2277            closeSession(session);
2278        }
2279    }
2280
2281    public SocialRelation findByU1_U2_T(long userId1, long userId2, int type)
2282        throws NoSuchRelationException, SystemException {
2283        SocialRelation socialRelation = fetchByU1_U2_T(userId1, userId2, type);
2284
2285        if (socialRelation == null) {
2286            StringBuilder msg = new StringBuilder();
2287
2288            msg.append("No SocialRelation exists with the key {");
2289
2290            msg.append("userId1=" + userId1);
2291
2292            msg.append(", ");
2293            msg.append("userId2=" + userId2);
2294
2295            msg.append(", ");
2296            msg.append("type=" + type);
2297
2298            msg.append(StringPool.CLOSE_CURLY_BRACE);
2299
2300            if (_log.isWarnEnabled()) {
2301                _log.warn(msg.toString());
2302            }
2303
2304            throw new NoSuchRelationException(msg.toString());
2305        }
2306
2307        return socialRelation;
2308    }
2309
2310    public SocialRelation fetchByU1_U2_T(long userId1, long userId2, int type)
2311        throws SystemException {
2312        return fetchByU1_U2_T(userId1, userId2, type, true);
2313    }
2314
2315    public SocialRelation fetchByU1_U2_T(long userId1, long userId2, int type,
2316        boolean retrieveFromCache) throws SystemException {
2317        Object[] finderArgs = new Object[] {
2318                new Long(userId1), new Long(userId2), new Integer(type)
2319            };
2320
2321        Object result = null;
2322
2323        if (retrieveFromCache) {
2324            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_U1_U2_T,
2325                    finderArgs, this);
2326        }
2327
2328        if (result == null) {
2329            Session session = null;
2330
2331            try {
2332                session = openSession();
2333
2334                StringBuilder query = new StringBuilder();
2335
2336                query.append(
2337                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2338
2339                query.append("userId1 = ?");
2340
2341                query.append(" AND ");
2342
2343                query.append("userId2 = ?");
2344
2345                query.append(" AND ");
2346
2347                query.append("type_ = ?");
2348
2349                query.append(" ");
2350
2351                Query q = session.createQuery(query.toString());
2352
2353                QueryPos qPos = QueryPos.getInstance(q);
2354
2355                qPos.add(userId1);
2356
2357                qPos.add(userId2);
2358
2359                qPos.add(type);
2360
2361                List<SocialRelation> list = q.list();
2362
2363                result = list;
2364
2365                SocialRelation socialRelation = null;
2366
2367                if (list.isEmpty()) {
2368                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U1_U2_T,
2369                        finderArgs, list);
2370                }
2371                else {
2372                    socialRelation = list.get(0);
2373
2374                    cacheResult(socialRelation);
2375
2376                    if ((socialRelation.getUserId1() != userId1) ||
2377                            (socialRelation.getUserId2() != userId2) ||
2378                            (socialRelation.getType() != type)) {
2379                        FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U1_U2_T,
2380                            finderArgs, list);
2381                    }
2382                }
2383
2384                return socialRelation;
2385            }
2386            catch (Exception e) {
2387                throw processException(e);
2388            }
2389            finally {
2390                if (result == null) {
2391                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_U1_U2_T,
2392                        finderArgs, new ArrayList<SocialRelation>());
2393                }
2394
2395                closeSession(session);
2396            }
2397        }
2398        else {
2399            if (result instanceof List) {
2400                return null;
2401            }
2402            else {
2403                return (SocialRelation)result;
2404            }
2405        }
2406    }
2407
2408    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
2409        throws SystemException {
2410        Session session = null;
2411
2412        try {
2413            session = openSession();
2414
2415            dynamicQuery.compile(session);
2416
2417            return dynamicQuery.list();
2418        }
2419        catch (Exception e) {
2420            throw processException(e);
2421        }
2422        finally {
2423            closeSession(session);
2424        }
2425    }
2426
2427    public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery,
2428        int start, int end) throws SystemException {
2429        Session session = null;
2430
2431        try {
2432            session = openSession();
2433
2434            dynamicQuery.setLimit(start, end);
2435
2436            dynamicQuery.compile(session);
2437
2438            return dynamicQuery.list();
2439        }
2440        catch (Exception e) {
2441            throw processException(e);
2442        }
2443        finally {
2444            closeSession(session);
2445        }
2446    }
2447
2448    public List<SocialRelation> findAll() throws SystemException {
2449        return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2450    }
2451
2452    public List<SocialRelation> findAll(int start, int end)
2453        throws SystemException {
2454        return findAll(start, end, null);
2455    }
2456
2457    public List<SocialRelation> findAll(int start, int end,
2458        OrderByComparator obc) throws SystemException {
2459        Object[] finderArgs = new Object[] {
2460                String.valueOf(start), String.valueOf(end), String.valueOf(obc)
2461            };
2462
2463        List<SocialRelation> list = (List<SocialRelation>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2464                finderArgs, this);
2465
2466        if (list == null) {
2467            Session session = null;
2468
2469            try {
2470                session = openSession();
2471
2472                StringBuilder query = new StringBuilder();
2473
2474                query.append(
2475                    "FROM com.liferay.portlet.social.model.SocialRelation ");
2476
2477                if (obc != null) {
2478                    query.append("ORDER BY ");
2479                    query.append(obc.getOrderBy());
2480                }
2481
2482                Query q = session.createQuery(query.toString());
2483
2484                if (obc == null) {
2485                    list = (List<SocialRelation>)QueryUtil.list(q,
2486                            getDialect(), start, end, false);
2487
2488                    Collections.sort(list);
2489                }
2490                else {
2491                    list = (List<SocialRelation>)QueryUtil.list(q,
2492                            getDialect(), start, end);
2493                }
2494            }
2495            catch (Exception e) {
2496                throw processException(e);
2497            }
2498            finally {
2499                if (list == null) {
2500                    list = new ArrayList<SocialRelation>();
2501                }
2502
2503                cacheResult(list);
2504
2505                FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2506
2507                closeSession(session);
2508            }
2509        }
2510
2511        return list;
2512    }
2513
2514    public void removeByUuid(String uuid) throws SystemException {
2515        for (SocialRelation socialRelation : findByUuid(uuid)) {
2516            remove(socialRelation);
2517        }
2518    }
2519
2520    public void removeByCompanyId(long companyId) throws SystemException {
2521        for (SocialRelation socialRelation : findByCompanyId(companyId)) {
2522            remove(socialRelation);
2523        }
2524    }
2525
2526    public void removeByUserId1(long userId1) throws SystemException {
2527        for (SocialRelation socialRelation : findByUserId1(userId1)) {
2528            remove(socialRelation);
2529        }
2530    }
2531
2532    public void removeByUserId2(long userId2) throws SystemException {
2533        for (SocialRelation socialRelation : findByUserId2(userId2)) {
2534            remove(socialRelation);
2535        }
2536    }
2537
2538    public void removeByType(int type) throws SystemException {
2539        for (SocialRelation socialRelation : findByType(type)) {
2540            remove(socialRelation);
2541        }
2542    }
2543
2544    public void removeByC_T(long companyId, int type) throws SystemException {
2545        for (SocialRelation socialRelation : findByC_T(companyId, type)) {
2546            remove(socialRelation);
2547        }
2548    }
2549
2550    public void removeByU1_T(long userId1, int type) throws SystemException {
2551        for (SocialRelation socialRelation : findByU1_T(userId1, type)) {
2552            remove(socialRelation);
2553        }
2554    }
2555
2556    public void removeByU2_T(long userId2, int type) throws SystemException {
2557        for (SocialRelation socialRelation : findByU2_T(userId2, type)) {
2558            remove(socialRelation);
2559        }
2560    }
2561
2562    public void removeByU1_U2_T(long userId1, long userId2, int type)
2563        throws NoSuchRelationException, SystemException {
2564        SocialRelation socialRelation = findByU1_U2_T(userId1, userId2, type);
2565
2566        remove(socialRelation);
2567    }
2568
2569    public void removeAll() throws SystemException {
2570        for (SocialRelation socialRelation : findAll()) {
2571            remove(socialRelation);
2572        }
2573    }
2574
2575    public int countByUuid(String uuid) throws SystemException {
2576        Object[] finderArgs = new Object[] { uuid };
2577
2578        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2579                finderArgs, this);
2580
2581        if (count == null) {
2582            Session session = null;
2583
2584            try {
2585                session = openSession();
2586
2587                StringBuilder query = new StringBuilder();
2588
2589                query.append("SELECT COUNT(*) ");
2590                query.append(
2591                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2592
2593                if (uuid == null) {
2594                    query.append("uuid_ IS NULL");
2595                }
2596                else {
2597                    query.append("uuid_ = ?");
2598                }
2599
2600                query.append(" ");
2601
2602                Query q = session.createQuery(query.toString());
2603
2604                QueryPos qPos = QueryPos.getInstance(q);
2605
2606                if (uuid != null) {
2607                    qPos.add(uuid);
2608                }
2609
2610                count = (Long)q.uniqueResult();
2611            }
2612            catch (Exception e) {
2613                throw processException(e);
2614            }
2615            finally {
2616                if (count == null) {
2617                    count = Long.valueOf(0);
2618                }
2619
2620                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2621                    finderArgs, count);
2622
2623                closeSession(session);
2624            }
2625        }
2626
2627        return count.intValue();
2628    }
2629
2630    public int countByCompanyId(long companyId) throws SystemException {
2631        Object[] finderArgs = new Object[] { new Long(companyId) };
2632
2633        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_COMPANYID,
2634                finderArgs, this);
2635
2636        if (count == null) {
2637            Session session = null;
2638
2639            try {
2640                session = openSession();
2641
2642                StringBuilder query = new StringBuilder();
2643
2644                query.append("SELECT COUNT(*) ");
2645                query.append(
2646                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2647
2648                query.append("companyId = ?");
2649
2650                query.append(" ");
2651
2652                Query q = session.createQuery(query.toString());
2653
2654                QueryPos qPos = QueryPos.getInstance(q);
2655
2656                qPos.add(companyId);
2657
2658                count = (Long)q.uniqueResult();
2659            }
2660            catch (Exception e) {
2661                throw processException(e);
2662            }
2663            finally {
2664                if (count == null) {
2665                    count = Long.valueOf(0);
2666                }
2667
2668                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_COMPANYID,
2669                    finderArgs, count);
2670
2671                closeSession(session);
2672            }
2673        }
2674
2675        return count.intValue();
2676    }
2677
2678    public int countByUserId1(long userId1) throws SystemException {
2679        Object[] finderArgs = new Object[] { new Long(userId1) };
2680
2681        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID1,
2682                finderArgs, this);
2683
2684        if (count == null) {
2685            Session session = null;
2686
2687            try {
2688                session = openSession();
2689
2690                StringBuilder query = new StringBuilder();
2691
2692                query.append("SELECT COUNT(*) ");
2693                query.append(
2694                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2695
2696                query.append("userId1 = ?");
2697
2698                query.append(" ");
2699
2700                Query q = session.createQuery(query.toString());
2701
2702                QueryPos qPos = QueryPos.getInstance(q);
2703
2704                qPos.add(userId1);
2705
2706                count = (Long)q.uniqueResult();
2707            }
2708            catch (Exception e) {
2709                throw processException(e);
2710            }
2711            finally {
2712                if (count == null) {
2713                    count = Long.valueOf(0);
2714                }
2715
2716                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID1,
2717                    finderArgs, count);
2718
2719                closeSession(session);
2720            }
2721        }
2722
2723        return count.intValue();
2724    }
2725
2726    public int countByUserId2(long userId2) throws SystemException {
2727        Object[] finderArgs = new Object[] { new Long(userId2) };
2728
2729        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID2,
2730                finderArgs, this);
2731
2732        if (count == null) {
2733            Session session = null;
2734
2735            try {
2736                session = openSession();
2737
2738                StringBuilder query = new StringBuilder();
2739
2740                query.append("SELECT COUNT(*) ");
2741                query.append(
2742                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2743
2744                query.append("userId2 = ?");
2745
2746                query.append(" ");
2747
2748                Query q = session.createQuery(query.toString());
2749
2750                QueryPos qPos = QueryPos.getInstance(q);
2751
2752                qPos.add(userId2);
2753
2754                count = (Long)q.uniqueResult();
2755            }
2756            catch (Exception e) {
2757                throw processException(e);
2758            }
2759            finally {
2760                if (count == null) {
2761                    count = Long.valueOf(0);
2762                }
2763
2764                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID2,
2765                    finderArgs, count);
2766
2767                closeSession(session);
2768            }
2769        }
2770
2771        return count.intValue();
2772    }
2773
2774    public int countByType(int type) throws SystemException {
2775        Object[] finderArgs = new Object[] { new Integer(type) };
2776
2777        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_TYPE,
2778                finderArgs, this);
2779
2780        if (count == null) {
2781            Session session = null;
2782
2783            try {
2784                session = openSession();
2785
2786                StringBuilder query = new StringBuilder();
2787
2788                query.append("SELECT COUNT(*) ");
2789                query.append(
2790                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2791
2792                query.append("type_ = ?");
2793
2794                query.append(" ");
2795
2796                Query q = session.createQuery(query.toString());
2797
2798                QueryPos qPos = QueryPos.getInstance(q);
2799
2800                qPos.add(type);
2801
2802                count = (Long)q.uniqueResult();
2803            }
2804            catch (Exception e) {
2805                throw processException(e);
2806            }
2807            finally {
2808                if (count == null) {
2809                    count = Long.valueOf(0);
2810                }
2811
2812                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_TYPE,
2813                    finderArgs, count);
2814
2815                closeSession(session);
2816            }
2817        }
2818
2819        return count.intValue();
2820    }
2821
2822    public int countByC_T(long companyId, int type) throws SystemException {
2823        Object[] finderArgs = new Object[] {
2824                new Long(companyId), new Integer(type)
2825            };
2826
2827        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_T,
2828                finderArgs, this);
2829
2830        if (count == null) {
2831            Session session = null;
2832
2833            try {
2834                session = openSession();
2835
2836                StringBuilder query = new StringBuilder();
2837
2838                query.append("SELECT COUNT(*) ");
2839                query.append(
2840                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2841
2842                query.append("companyId = ?");
2843
2844                query.append(" AND ");
2845
2846                query.append("type_ = ?");
2847
2848                query.append(" ");
2849
2850                Query q = session.createQuery(query.toString());
2851
2852                QueryPos qPos = QueryPos.getInstance(q);
2853
2854                qPos.add(companyId);
2855
2856                qPos.add(type);
2857
2858                count = (Long)q.uniqueResult();
2859            }
2860            catch (Exception e) {
2861                throw processException(e);
2862            }
2863            finally {
2864                if (count == null) {
2865                    count = Long.valueOf(0);
2866                }
2867
2868                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_T, finderArgs,
2869                    count);
2870
2871                closeSession(session);
2872            }
2873        }
2874
2875        return count.intValue();
2876    }
2877
2878    public int countByU1_T(long userId1, int type) throws SystemException {
2879        Object[] finderArgs = new Object[] { new Long(userId1), new Integer(type) };
2880
2881        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U1_T,
2882                finderArgs, this);
2883
2884        if (count == null) {
2885            Session session = null;
2886
2887            try {
2888                session = openSession();
2889
2890                StringBuilder query = new StringBuilder();
2891
2892                query.append("SELECT COUNT(*) ");
2893                query.append(
2894                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2895
2896                query.append("userId1 = ?");
2897
2898                query.append(" AND ");
2899
2900                query.append("type_ = ?");
2901
2902                query.append(" ");
2903
2904                Query q = session.createQuery(query.toString());
2905
2906                QueryPos qPos = QueryPos.getInstance(q);
2907
2908                qPos.add(userId1);
2909
2910                qPos.add(type);
2911
2912                count = (Long)q.uniqueResult();
2913            }
2914            catch (Exception e) {
2915                throw processException(e);
2916            }
2917            finally {
2918                if (count == null) {
2919                    count = Long.valueOf(0);
2920                }
2921
2922                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U1_T,
2923                    finderArgs, count);
2924
2925                closeSession(session);
2926            }
2927        }
2928
2929        return count.intValue();
2930    }
2931
2932    public int countByU2_T(long userId2, int type) throws SystemException {
2933        Object[] finderArgs = new Object[] { new Long(userId2), new Integer(type) };
2934
2935        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U2_T,
2936                finderArgs, this);
2937
2938        if (count == null) {
2939            Session session = null;
2940
2941            try {
2942                session = openSession();
2943
2944                StringBuilder query = new StringBuilder();
2945
2946                query.append("SELECT COUNT(*) ");
2947                query.append(
2948                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
2949
2950                query.append("userId2 = ?");
2951
2952                query.append(" AND ");
2953
2954                query.append("type_ = ?");
2955
2956                query.append(" ");
2957
2958                Query q = session.createQuery(query.toString());
2959
2960                QueryPos qPos = QueryPos.getInstance(q);
2961
2962                qPos.add(userId2);
2963
2964                qPos.add(type);
2965
2966                count = (Long)q.uniqueResult();
2967            }
2968            catch (Exception e) {
2969                throw processException(e);
2970            }
2971            finally {
2972                if (count == null) {
2973                    count = Long.valueOf(0);
2974                }
2975
2976                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U2_T,
2977                    finderArgs, count);
2978
2979                closeSession(session);
2980            }
2981        }
2982
2983        return count.intValue();
2984    }
2985
2986    public int countByU1_U2_T(long userId1, long userId2, int type)
2987        throws SystemException {
2988        Object[] finderArgs = new Object[] {
2989                new Long(userId1), new Long(userId2), new Integer(type)
2990            };
2991
2992        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_U1_U2_T,
2993                finderArgs, this);
2994
2995        if (count == null) {
2996            Session session = null;
2997
2998            try {
2999                session = openSession();
3000
3001                StringBuilder query = new StringBuilder();
3002
3003                query.append("SELECT COUNT(*) ");
3004                query.append(
3005                    "FROM com.liferay.portlet.social.model.SocialRelation WHERE ");
3006
3007                query.append("userId1 = ?");
3008
3009                query.append(" AND ");
3010
3011                query.append("userId2 = ?");
3012
3013                query.append(" AND ");
3014
3015                query.append("type_ = ?");
3016
3017                query.append(" ");
3018
3019                Query q = session.createQuery(query.toString());
3020
3021                QueryPos qPos = QueryPos.getInstance(q);
3022
3023                qPos.add(userId1);
3024
3025                qPos.add(userId2);
3026
3027                qPos.add(type);
3028
3029                count = (Long)q.uniqueResult();
3030            }
3031            catch (Exception e) {
3032                throw processException(e);
3033            }
3034            finally {
3035                if (count == null) {
3036                    count = Long.valueOf(0);
3037                }
3038
3039                FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_U1_U2_T,
3040                    finderArgs, count);
3041
3042                closeSession(session);
3043            }
3044        }
3045
3046        return count.intValue();
3047    }
3048
3049    public int countAll() throws SystemException {
3050        Object[] finderArgs = new Object[0];
3051
3052        Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3053                finderArgs, this);
3054
3055        if (count == null) {
3056            Session session = null;
3057
3058            try {
3059                session = openSession();
3060
3061                Query q = session.createQuery(
3062                        "SELECT COUNT(*) FROM com.liferay.portlet.social.model.SocialRelation");
3063
3064                count = (Long)q.uniqueResult();
3065            }
3066            catch (Exception e) {
3067                throw processException(e);
3068            }
3069            finally {
3070                if (count == null) {
3071                    count = Long.valueOf(0);
3072                }
3073
3074                FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3075                    count);
3076
3077                closeSession(session);
3078            }
3079        }
3080
3081        return count.intValue();
3082    }
3083
3084    public void afterPropertiesSet() {
3085        String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3086                    com.liferay.portal.util.PropsUtil.get(
3087                        "value.object.listener.com.liferay.portlet.social.model.SocialRelation")));
3088
3089        if (listenerClassNames.length > 0) {
3090            try {
3091                List<ModelListener<SocialRelation>> listenersList = new ArrayList<ModelListener<SocialRelation>>();
3092
3093                for (String listenerClassName : listenerClassNames) {
3094                    listenersList.add((ModelListener<SocialRelation>)Class.forName(
3095                            listenerClassName).newInstance());
3096                }
3097
3098                listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3099            }
3100            catch (Exception e) {
3101                _log.error(e);
3102            }
3103        }
3104    }
3105
3106    @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialActivityPersistence.impl")
3107    protected com.liferay.portlet.social.service.persistence.SocialActivityPersistence socialActivityPersistence;
3108    @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialRelationPersistence.impl")
3109    protected com.liferay.portlet.social.service.persistence.SocialRelationPersistence socialRelationPersistence;
3110    @BeanReference(name = "com.liferay.portlet.social.service.persistence.SocialRequestPersistence.impl")
3111    protected com.liferay.portlet.social.service.persistence.SocialRequestPersistence socialRequestPersistence;
3112    @BeanReference(name = "com.liferay.portal.service.persistence.UserPersistence.impl")
3113    protected com.liferay.portal.service.persistence.UserPersistence userPersistence;
3114    private static Log _log = LogFactoryUtil.getLog(SocialRelationPersistenceImpl.class);
3115}