001
014
015 package com.liferay.portlet.messageboards.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.parsers.bbcode.BBCodeTranslatorUtil;
020 import com.liferay.portal.kernel.util.HtmlUtil;
021 import com.liferay.portal.kernel.util.ObjectValuePair;
022 import com.liferay.portal.kernel.util.ParamUtil;
023 import com.liferay.portal.kernel.util.StringPool;
024 import com.liferay.portal.kernel.util.StringUtil;
025 import com.liferay.portal.kernel.workflow.WorkflowConstants;
026 import com.liferay.portal.model.Company;
027 import com.liferay.portal.model.Group;
028 import com.liferay.portal.model.User;
029 import com.liferay.portal.security.auth.PrincipalException;
030 import com.liferay.portal.security.permission.ActionKeys;
031 import com.liferay.portal.service.ServiceContext;
032 import com.liferay.portal.theme.ThemeDisplay;
033 import com.liferay.portal.util.PortalUtil;
034 import com.liferay.portal.util.PropsValues;
035 import com.liferay.portlet.messageboards.LockedThreadException;
036 import com.liferay.portlet.messageboards.NoSuchCategoryException;
037 import com.liferay.portlet.messageboards.model.MBCategory;
038 import com.liferay.portlet.messageboards.model.MBCategoryConstants;
039 import com.liferay.portlet.messageboards.model.MBMessage;
040 import com.liferay.portlet.messageboards.model.MBMessageDisplay;
041 import com.liferay.portlet.messageboards.model.MBThread;
042 import com.liferay.portlet.messageboards.model.MBThreadConstants;
043 import com.liferay.portlet.messageboards.service.base.MBMessageServiceBaseImpl;
044 import com.liferay.portlet.messageboards.service.permission.MBCategoryPermission;
045 import com.liferay.portlet.messageboards.service.permission.MBDiscussionPermission;
046 import com.liferay.portlet.messageboards.service.permission.MBMessagePermission;
047 import com.liferay.portlet.messageboards.util.MBUtil;
048 import com.liferay.portlet.messageboards.util.comparator.MessageCreateDateComparator;
049 import com.liferay.util.RSSUtil;
050
051 import com.sun.syndication.feed.synd.SyndContent;
052 import com.sun.syndication.feed.synd.SyndContentImpl;
053 import com.sun.syndication.feed.synd.SyndEntry;
054 import com.sun.syndication.feed.synd.SyndEntryImpl;
055 import com.sun.syndication.feed.synd.SyndFeed;
056 import com.sun.syndication.feed.synd.SyndFeedImpl;
057 import com.sun.syndication.feed.synd.SyndLink;
058 import com.sun.syndication.feed.synd.SyndLinkImpl;
059 import com.sun.syndication.io.FeedException;
060
061 import java.io.InputStream;
062
063 import java.util.ArrayList;
064 import java.util.Collections;
065 import java.util.Date;
066 import java.util.Iterator;
067 import java.util.List;
068
069
074 public class MBMessageServiceImpl extends MBMessageServiceBaseImpl {
075
076 @Override
077 public MBMessage addDiscussionMessage(
078 long groupId, String className, long classPK,
079 String permissionClassName, long permissionClassPK,
080 long permissionOwnerId, long threadId, long parentMessageId,
081 String subject, String body, ServiceContext serviceContext)
082 throws PortalException, SystemException {
083
084 User user = getGuestOrUser();
085
086 MBDiscussionPermission.check(
087 getPermissionChecker(), user.getCompanyId(),
088 serviceContext.getScopeGroupId(), permissionClassName,
089 permissionClassPK, permissionOwnerId, ActionKeys.ADD_DISCUSSION);
090
091 return mbMessageLocalService.addDiscussionMessage(
092 user.getUserId(), null, groupId, className, classPK, threadId,
093 parentMessageId, subject, body, serviceContext);
094 }
095
096
101 @Override
102 public MBMessage addMessage(
103 long groupId, long categoryId, long threadId, long parentMessageId,
104 String subject, String body, String format,
105 List<ObjectValuePair<String, InputStream>> inputStreamOVPs,
106 boolean anonymous, double priority, boolean allowPingbacks,
107 ServiceContext serviceContext)
108 throws PortalException, SystemException {
109
110 return addMessage(
111 parentMessageId, subject, body, format, inputStreamOVPs, anonymous,
112 priority, allowPingbacks, serviceContext);
113 }
114
115 @Override
116 public MBMessage addMessage(
117 long groupId, long categoryId, String subject, String body,
118 String format,
119 List<ObjectValuePair<String, InputStream>> inputStreamOVPs,
120 boolean anonymous, double priority, boolean allowPingbacks,
121 ServiceContext serviceContext)
122 throws PortalException, SystemException {
123
124 MBCategoryPermission.check(
125 getPermissionChecker(), groupId, categoryId,
126 ActionKeys.ADD_MESSAGE);
127
128 if (!MBCategoryPermission.contains(
129 getPermissionChecker(), groupId, categoryId,
130 ActionKeys.ADD_FILE)) {
131
132 inputStreamOVPs = Collections.emptyList();
133 }
134
135 if (!MBCategoryPermission.contains(
136 getPermissionChecker(), groupId, categoryId,
137 ActionKeys.UPDATE_THREAD_PRIORITY)) {
138
139 priority = MBThreadConstants.PRIORITY_NOT_GIVEN;
140 }
141
142 return mbMessageLocalService.addMessage(
143 getGuestOrUserId(), null, groupId, categoryId, subject, body,
144 format, inputStreamOVPs, anonymous, priority, allowPingbacks,
145 serviceContext);
146 }
147
148 @Override
149 public MBMessage addMessage(
150 long parentMessageId, String subject, String body, String format,
151 List<ObjectValuePair<String, InputStream>> inputStreamOVPs,
152 boolean anonymous, double priority, boolean allowPingbacks,
153 ServiceContext serviceContext)
154 throws PortalException, SystemException {
155
156 MBMessage parentMessage = mbMessagePersistence.findByPrimaryKey(
157 parentMessageId);
158
159 checkReplyToPermission(
160 parentMessage.getGroupId(), parentMessage.getCategoryId(),
161 parentMessageId);
162
163 boolean preview = ParamUtil.getBoolean(serviceContext, "preview");
164
165 int workFlowAction = serviceContext.getWorkflowAction();
166
167 if ((workFlowAction == WorkflowConstants.STATUS_DRAFT) && !preview &&
168 !serviceContext.isSignedIn()) {
169
170 MBMessagePermission.check(
171 getPermissionChecker(), parentMessageId, ActionKeys.UPDATE);
172 }
173
174 if (lockLocalService.isLocked(
175 MBThread.class.getName(), parentMessage.getThreadId())) {
176
177 throw new LockedThreadException();
178 }
179
180 if (!MBCategoryPermission.contains(
181 getPermissionChecker(), parentMessage.getGroupId(),
182 parentMessage.getCategoryId(), ActionKeys.ADD_FILE)) {
183
184 inputStreamOVPs = Collections.emptyList();
185 }
186
187 if (!MBCategoryPermission.contains(
188 getPermissionChecker(), parentMessage.getGroupId(),
189 parentMessage.getCategoryId(),
190 ActionKeys.UPDATE_THREAD_PRIORITY)) {
191
192 priority = MBThreadConstants.PRIORITY_NOT_GIVEN;
193 }
194
195 return mbMessageLocalService.addMessage(
196 getGuestOrUserId(), null, parentMessage.getGroupId(),
197 parentMessage.getCategoryId(), parentMessage.getThreadId(),
198 parentMessageId, subject, body, format, inputStreamOVPs, anonymous,
199 priority, allowPingbacks, serviceContext);
200 }
201
202 @Override
203 public void deleteDiscussionMessage(
204 long groupId, String className, long classPK,
205 String permissionClassName, long permissionClassPK,
206 long permissionOwnerId, long messageId)
207 throws PortalException, SystemException {
208
209 User user = getUser();
210
211 MBDiscussionPermission.check(
212 getPermissionChecker(), user.getCompanyId(), groupId,
213 permissionClassName, permissionClassPK, messageId,
214 permissionOwnerId, ActionKeys.DELETE_DISCUSSION);
215
216 mbMessageLocalService.deleteDiscussionMessage(messageId);
217 }
218
219 @Override
220 public void deleteMessage(long messageId)
221 throws PortalException, SystemException {
222
223 MBMessagePermission.check(
224 getPermissionChecker(), messageId, ActionKeys.DELETE);
225
226 mbMessageLocalService.deleteMessage(messageId);
227 }
228
229 @Override
230 public List<MBMessage> getCategoryMessages(
231 long groupId, long categoryId, int status, int start, int end)
232 throws PortalException, SystemException {
233
234 List<MBMessage> messages = new ArrayList<MBMessage>();
235
236 Iterator<MBMessage> itr = mbMessageLocalService.getCategoryMessages(
237 groupId, categoryId, status, start, end).iterator();
238
239 while (itr.hasNext()) {
240 MBMessage message = itr.next();
241
242 if (MBMessagePermission.contains(
243 getPermissionChecker(), message, ActionKeys.VIEW)) {
244
245 messages.add(message);
246 }
247 }
248
249 return messages;
250 }
251
252 @Override
253 public int getCategoryMessagesCount(
254 long groupId, long categoryId, int status)
255 throws SystemException {
256
257 return mbMessageLocalService.getCategoryMessagesCount(
258 groupId, categoryId, status);
259 }
260
261 @Override
262 public String getCategoryMessagesRSS(
263 long groupId, long categoryId, int status, int max, String type,
264 double version, String displayStyle, String feedURL,
265 String entryURL, ThemeDisplay themeDisplay)
266 throws PortalException, SystemException {
267
268 String name = StringPool.BLANK;
269 String description = StringPool.BLANK;
270
271 try {
272 MBCategory category = mbCategoryLocalService.getCategory(
273 categoryId);
274
275 groupId = category.getGroupId();
276 name = category.getName();
277 description = category.getDescription();
278 }
279 catch (NoSuchCategoryException nsce) {
280 Group group = groupLocalService.getGroup(categoryId);
281
282 groupId = group.getGroupId();
283 categoryId = MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID;
284 name = group.getDescriptiveName();
285 description = group.getDescription();
286 }
287
288 List<MBMessage> messages = new ArrayList<MBMessage>();
289
290 int lastIntervalStart = 0;
291 boolean listNotExhausted = true;
292 MessageCreateDateComparator comparator =
293 new MessageCreateDateComparator(false);
294
295 while ((messages.size() < max) && listNotExhausted) {
296 List<MBMessage> messageList =
297 mbMessageLocalService.getCategoryMessages(
298 groupId, categoryId, status, lastIntervalStart,
299 lastIntervalStart + max, comparator);
300
301 Iterator<MBMessage> itr = messageList.iterator();
302
303 lastIntervalStart += max;
304 listNotExhausted = (messageList.size() == max);
305
306 while (itr.hasNext() && (messages.size() < max)) {
307 MBMessage message = itr.next();
308
309 if (MBMessagePermission.contains(
310 getPermissionChecker(), message, ActionKeys.VIEW)) {
311
312 messages.add(message);
313 }
314 }
315 }
316
317 return exportToRSS(
318 name, description, type, version, displayStyle, feedURL, entryURL,
319 messages, themeDisplay);
320 }
321
322 @Override
323 public String getCompanyMessagesRSS(
324 long companyId, int status, int max, String type, double version,
325 String displayStyle, String feedURL, String entryURL,
326 ThemeDisplay themeDisplay)
327 throws PortalException, SystemException {
328
329 Company company = companyPersistence.findByPrimaryKey(companyId);
330
331 String name = company.getName();
332 String description = company.getName();
333
334 List<MBMessage> messages = new ArrayList<MBMessage>();
335
336 int lastIntervalStart = 0;
337 boolean listNotExhausted = true;
338 MessageCreateDateComparator comparator =
339 new MessageCreateDateComparator(false);
340
341 while ((messages.size() < max) && listNotExhausted) {
342 List<MBMessage> messageList =
343 mbMessageLocalService.getCompanyMessages(
344 companyId, status, lastIntervalStart,
345 lastIntervalStart + max, comparator);
346
347 Iterator<MBMessage> itr = messageList.iterator();
348
349 lastIntervalStart += max;
350 listNotExhausted = (messageList.size() == max);
351
352 while (itr.hasNext() && (messages.size() < max)) {
353 MBMessage message = itr.next();
354
355 if (MBMessagePermission.contains(
356 getPermissionChecker(), message, ActionKeys.VIEW)) {
357
358 messages.add(message);
359 }
360 }
361 }
362
363 return exportToRSS(
364 name, description, type, version, displayStyle, feedURL, entryURL,
365 messages, themeDisplay);
366 }
367
368 @Override
369 public int getGroupMessagesCount(long groupId, int status)
370 throws SystemException {
371
372 if (status == WorkflowConstants.STATUS_ANY) {
373 return mbMessagePersistence.filterCountByGroupId(groupId);
374 }
375 else {
376 return mbMessagePersistence.filterCountByG_S(groupId, status);
377 }
378 }
379
380 @Override
381 public String getGroupMessagesRSS(
382 long groupId, int status, int max, String type, double version,
383 String displayStyle, String feedURL, String entryURL,
384 ThemeDisplay themeDisplay)
385 throws PortalException, SystemException {
386
387 String name = StringPool.BLANK;
388 String description = StringPool.BLANK;
389
390 List<MBMessage> messages = new ArrayList<MBMessage>();
391
392 int lastIntervalStart = 0;
393 boolean listNotExhausted = true;
394 MessageCreateDateComparator comparator =
395 new MessageCreateDateComparator(false);
396
397 while ((messages.size() < max) && listNotExhausted) {
398 List<MBMessage> messageList =
399 mbMessageLocalService.getGroupMessages(
400 groupId, status, lastIntervalStart, lastIntervalStart + max,
401 comparator);
402
403 Iterator<MBMessage> itr = messageList.iterator();
404
405 lastIntervalStart += max;
406 listNotExhausted = (messageList.size() == max);
407
408 while (itr.hasNext() && (messages.size() < max)) {
409 MBMessage message = itr.next();
410
411 if (MBMessagePermission.contains(
412 getPermissionChecker(), message, ActionKeys.VIEW)) {
413
414 messages.add(message);
415 }
416 }
417 }
418
419 if (messages.size() > 0) {
420 MBMessage message = messages.get(messages.size() - 1);
421
422 name = message.getSubject();
423 description = message.getSubject();
424 }
425
426 return exportToRSS(
427 name, description, type, version, displayStyle, feedURL, entryURL,
428 messages, themeDisplay);
429 }
430
431 @Override
432 public String getGroupMessagesRSS(
433 long groupId, long userId, int status, int max, String type,
434 double version, String displayStyle, String feedURL,
435 String entryURL, ThemeDisplay themeDisplay)
436 throws PortalException, SystemException {
437
438 String name = StringPool.BLANK;
439 String description = StringPool.BLANK;
440
441 List<MBMessage> messages = new ArrayList<MBMessage>();
442
443 int lastIntervalStart = 0;
444 boolean listNotExhausted = true;
445 MessageCreateDateComparator comparator =
446 new MessageCreateDateComparator(false);
447
448 while ((messages.size() < max) && listNotExhausted) {
449 List<MBMessage> messageList =
450 mbMessageLocalService.getGroupMessages(
451 groupId, userId, status, lastIntervalStart,
452 lastIntervalStart + max, comparator);
453
454 Iterator<MBMessage> itr = messageList.iterator();
455
456 lastIntervalStart += max;
457 listNotExhausted = (messageList.size() == max);
458
459 while (itr.hasNext() && (messages.size() < max)) {
460 MBMessage message = itr.next();
461
462 if (MBMessagePermission.contains(
463 getPermissionChecker(), message, ActionKeys.VIEW)) {
464
465 messages.add(message);
466 }
467 }
468 }
469
470 if (messages.size() > 0) {
471 MBMessage message = messages.get(messages.size() - 1);
472
473 name = message.getSubject();
474 description = message.getSubject();
475 }
476
477 return exportToRSS(
478 name, description, type, version, displayStyle, feedURL, entryURL,
479 messages, themeDisplay);
480 }
481
482 @Override
483 public MBMessage getMessage(long messageId)
484 throws PortalException, SystemException {
485
486 MBMessagePermission.check(
487 getPermissionChecker(), messageId, ActionKeys.VIEW);
488
489 return mbMessageLocalService.getMessage(messageId);
490 }
491
492 @Override
493 public MBMessageDisplay getMessageDisplay(
494 long messageId, int status, String threadView,
495 boolean includePrevAndNext)
496 throws PortalException, SystemException {
497
498 MBMessagePermission.check(
499 getPermissionChecker(), messageId, ActionKeys.VIEW);
500
501 return mbMessageLocalService.getMessageDisplay(
502 getGuestOrUserId(), messageId, status, threadView,
503 includePrevAndNext);
504 }
505
506 @Override
507 public int getThreadAnswersCount(
508 long groupId, long categoryId, long threadId)
509 throws SystemException {
510
511 return mbMessagePersistence.filterCountByG_C_T_A(
512 groupId, categoryId, threadId, true);
513 }
514
515 @Override
516 public List<MBMessage> getThreadMessages(
517 long groupId, long categoryId, long threadId, int status, int start,
518 int end)
519 throws SystemException {
520
521 if (status == WorkflowConstants.STATUS_ANY) {
522 return mbMessagePersistence.filterFindByG_C_T(
523 groupId, categoryId, threadId, start, end);
524 }
525 else {
526 return mbMessagePersistence.filterFindByG_C_T_S(
527 groupId, categoryId, threadId, status, start, end);
528 }
529 }
530
531 @Override
532 public int getThreadMessagesCount(
533 long groupId, long categoryId, long threadId, int status)
534 throws SystemException {
535
536 if (status == WorkflowConstants.STATUS_ANY) {
537 return mbMessagePersistence.filterCountByG_C_T(
538 groupId, categoryId, threadId);
539 }
540 else {
541 return mbMessagePersistence.filterCountByG_C_T_S(
542 groupId, categoryId, threadId, status);
543 }
544 }
545
546 @Override
547 public String getThreadMessagesRSS(
548 long threadId, int status, int max, String type, double version,
549 String displayStyle, String feedURL, String entryURL,
550 ThemeDisplay themeDisplay)
551 throws PortalException, SystemException {
552
553 String name = StringPool.BLANK;
554 String description = StringPool.BLANK;
555
556 List<MBMessage> messages = new ArrayList<MBMessage>();
557
558 MBThread thread = mbThreadLocalService.getThread(threadId);
559
560 if (MBMessagePermission.contains(
561 getPermissionChecker(), thread.getRootMessageId(),
562 ActionKeys.VIEW)) {
563
564 MessageCreateDateComparator comparator =
565 new MessageCreateDateComparator(false);
566
567 Iterator<MBMessage> itr = mbMessageLocalService.getThreadMessages(
568 threadId, status, comparator).iterator();
569
570 while (itr.hasNext() && (messages.size() < max)) {
571 MBMessage message = itr.next();
572
573 if (MBMessagePermission.contains(
574 getPermissionChecker(), message, ActionKeys.VIEW)) {
575
576 messages.add(message);
577 }
578 }
579
580 if (messages.size() > 0) {
581 MBMessage message = messages.get(messages.size() - 1);
582
583 name = message.getSubject();
584 description = message.getSubject();
585 }
586 }
587
588 return exportToRSS(
589 name, description, type, version, displayStyle, feedURL, entryURL,
590 messages, themeDisplay);
591 }
592
593 @Override
594 public void subscribeMessage(long messageId)
595 throws PortalException, SystemException {
596
597 MBMessagePermission.check(
598 getPermissionChecker(), messageId, ActionKeys.SUBSCRIBE);
599
600 mbMessageLocalService.subscribeMessage(getUserId(), messageId);
601 }
602
603 @Override
604 public void unsubscribeMessage(long messageId)
605 throws PortalException, SystemException {
606
607 MBMessagePermission.check(
608 getPermissionChecker(), messageId, ActionKeys.SUBSCRIBE);
609
610 mbMessageLocalService.unsubscribeMessage(getUserId(), messageId);
611 }
612
613 @Override
614 public void updateAnswer(long messageId, boolean answer, boolean cascade)
615 throws PortalException, SystemException {
616
617 mbMessageLocalService.updateAnswer(messageId, answer, cascade);
618 }
619
620 @Override
621 public MBMessage updateDiscussionMessage(
622 String className, long classPK, String permissionClassName,
623 long permissionClassPK, long permissionOwnerId, long messageId,
624 String subject, String body, ServiceContext serviceContext)
625 throws PortalException, SystemException {
626
627 User user = getUser();
628
629 MBDiscussionPermission.check(
630 getPermissionChecker(), user.getCompanyId(),
631 serviceContext.getScopeGroupId(), permissionClassName,
632 permissionClassPK, messageId, permissionOwnerId,
633 ActionKeys.UPDATE_DISCUSSION);
634
635 return mbMessageLocalService.updateDiscussionMessage(
636 getUserId(), messageId, className, classPK, subject, body,
637 serviceContext);
638 }
639
640 @Override
641 public MBMessage updateMessage(
642 long messageId, String subject, String body,
643 List<ObjectValuePair<String, InputStream>> inputStreamOVPs,
644 List<String> existingFiles, double priority, boolean allowPingbacks,
645 ServiceContext serviceContext)
646 throws PortalException, SystemException {
647
648 MBMessage message = mbMessagePersistence.findByPrimaryKey(messageId);
649
650 boolean preview = ParamUtil.getBoolean(serviceContext, "preview");
651
652 if (preview &&
653 MBMessagePermission.contains(
654 getPermissionChecker(), message, ActionKeys.UPDATE)) {
655
656 checkReplyToPermission(
657 message.getGroupId(), message.getCategoryId(),
658 message.getParentMessageId());
659 }
660 else {
661 MBMessagePermission.check(
662 getPermissionChecker(), messageId, ActionKeys.UPDATE);
663 }
664
665 if (lockLocalService.isLocked(
666 MBThread.class.getName(), message.getThreadId())) {
667
668 throw new LockedThreadException();
669 }
670
671 if (!MBCategoryPermission.contains(
672 getPermissionChecker(), message.getGroupId(),
673 message.getCategoryId(), ActionKeys.ADD_FILE)) {
674
675 inputStreamOVPs = Collections.emptyList();
676 }
677
678 if (!MBCategoryPermission.contains(
679 getPermissionChecker(), message.getGroupId(),
680 message.getCategoryId(), ActionKeys.UPDATE_THREAD_PRIORITY)) {
681
682 MBThread thread = mbThreadLocalService.getThread(
683 message.getThreadId());
684
685 priority = thread.getPriority();
686 }
687
688 return mbMessageLocalService.updateMessage(
689 getGuestOrUserId(), messageId, subject, body, inputStreamOVPs,
690 existingFiles, priority, allowPingbacks, serviceContext);
691 }
692
693 protected void checkReplyToPermission(
694 long groupId, long categoryId, long parentMessageId)
695 throws PortalException, SystemException {
696
697 if (parentMessageId > 0) {
698 if (MBCategoryPermission.contains(
699 getPermissionChecker(), groupId, categoryId,
700 ActionKeys.ADD_MESSAGE)) {
701
702 return;
703 }
704
705 if (!MBCategoryPermission.contains(
706 getPermissionChecker(), groupId, categoryId,
707 ActionKeys.REPLY_TO_MESSAGE)) {
708
709 throw new PrincipalException();
710 }
711 }
712 else {
713 MBCategoryPermission.check(
714 getPermissionChecker(), groupId, categoryId,
715 ActionKeys.ADD_MESSAGE);
716 }
717 }
718
719 protected String exportToRSS(
720 String name, String description, String type, double version,
721 String displayStyle, String feedURL, String entryURL,
722 List<MBMessage> messages, ThemeDisplay themeDisplay)
723 throws SystemException {
724
725 SyndFeed syndFeed = new SyndFeedImpl();
726
727 syndFeed.setDescription(description);
728
729 List<SyndEntry> syndEntries = new ArrayList<SyndEntry>();
730
731 syndFeed.setEntries(syndEntries);
732
733 for (MBMessage message : messages) {
734 SyndEntry syndEntry = new SyndEntryImpl();
735
736 if (!message.isAnonymous()) {
737 String author = PortalUtil.getUserName(message);
738
739 syndEntry.setAuthor(author);
740 }
741
742 SyndContent syndContent = new SyndContentImpl();
743
744 syndContent.setType(RSSUtil.ENTRY_TYPE_DEFAULT);
745
746 String value = null;
747
748 if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_ABSTRACT)) {
749 value = StringUtil.shorten(
750 HtmlUtil.extractText(message.getBody()),
751 PropsValues.MESSAGE_BOARDS_RSS_ABSTRACT_LENGTH,
752 StringPool.BLANK);
753 }
754 else if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_TITLE)) {
755 value = StringPool.BLANK;
756 }
757 else if (message.isFormatBBCode()) {
758 value = BBCodeTranslatorUtil.getHTML(message.getBody());
759
760 value = MBUtil.replaceMessageBodyPaths(themeDisplay, value);
761 }
762 else {
763 value = message.getBody();
764 }
765
766 syndContent.setValue(value);
767
768 syndEntry.setDescription(syndContent);
769
770 syndEntry.setLink(
771 entryURL + "&messageId=" + message.getMessageId());
772 syndEntry.setPublishedDate(message.getCreateDate());
773 syndEntry.setTitle(message.getSubject());
774 syndEntry.setUpdatedDate(message.getModifiedDate());
775 syndEntry.setUri(syndEntry.getLink());
776
777 syndEntries.add(syndEntry);
778 }
779
780 syndFeed.setFeedType(RSSUtil.getFeedType(type, version));
781
782 List<SyndLink> syndLinks = new ArrayList<SyndLink>();
783
784 syndFeed.setLinks(syndLinks);
785
786 SyndLink selfSyndLink = new SyndLinkImpl();
787
788 syndLinks.add(selfSyndLink);
789
790 selfSyndLink.setHref(feedURL);
791 selfSyndLink.setRel("self");
792
793 syndFeed.setPublishedDate(new Date());
794 syndFeed.setTitle(name);
795 syndFeed.setUri(feedURL);
796
797 try {
798 return RSSUtil.export(syndFeed);
799 }
800 catch (FeedException fe) {
801 throw new SystemException(fe);
802 }
803 }
804
805 }