001
014
015 package com.liferay.portlet.wiki.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.language.LanguageUtil;
020 import com.liferay.portal.kernel.repository.model.FileEntry;
021 import com.liferay.portal.kernel.util.CalendarFactoryUtil;
022 import com.liferay.portal.kernel.util.HtmlUtil;
023 import com.liferay.portal.kernel.util.HttpUtil;
024 import com.liferay.portal.kernel.util.ObjectValuePair;
025 import com.liferay.portal.kernel.util.OrderByComparator;
026 import com.liferay.portal.kernel.util.StringBundler;
027 import com.liferay.portal.kernel.util.StringPool;
028 import com.liferay.portal.kernel.util.StringUtil;
029 import com.liferay.portal.kernel.workflow.WorkflowConstants;
030 import com.liferay.portal.security.permission.ActionKeys;
031 import com.liferay.portal.service.ServiceContext;
032 import com.liferay.portal.util.PortalUtil;
033 import com.liferay.portal.util.PortletKeys;
034 import com.liferay.portal.util.PropsValues;
035 import com.liferay.portlet.wiki.NoSuchPageException;
036 import com.liferay.portlet.wiki.model.WikiNode;
037 import com.liferay.portlet.wiki.model.WikiPage;
038 import com.liferay.portlet.wiki.model.WikiPageConstants;
039 import com.liferay.portlet.wiki.service.base.WikiPageServiceBaseImpl;
040 import com.liferay.portlet.wiki.service.permission.WikiNodePermission;
041 import com.liferay.portlet.wiki.service.permission.WikiPagePermission;
042 import com.liferay.portlet.wiki.util.WikiUtil;
043 import com.liferay.portlet.wiki.util.comparator.PageCreateDateComparator;
044 import com.liferay.util.RSSUtil;
045
046 import com.sun.syndication.feed.synd.SyndContent;
047 import com.sun.syndication.feed.synd.SyndContentImpl;
048 import com.sun.syndication.feed.synd.SyndEntry;
049 import com.sun.syndication.feed.synd.SyndEntryImpl;
050 import com.sun.syndication.feed.synd.SyndFeed;
051 import com.sun.syndication.feed.synd.SyndFeedImpl;
052 import com.sun.syndication.feed.synd.SyndLink;
053 import com.sun.syndication.feed.synd.SyndLinkImpl;
054 import com.sun.syndication.io.FeedException;
055
056 import java.io.File;
057 import java.io.InputStream;
058
059 import java.util.ArrayList;
060 import java.util.Calendar;
061 import java.util.Date;
062 import java.util.List;
063 import java.util.Locale;
064
065
074 public class WikiPageServiceImpl extends WikiPageServiceBaseImpl {
075
076 @Override
077 public WikiPage addPage(
078 long nodeId, String title, String content, String summary,
079 boolean minorEdit, ServiceContext serviceContext)
080 throws PortalException, SystemException {
081
082 WikiNodePermission.check(
083 getPermissionChecker(), nodeId, ActionKeys.ADD_PAGE);
084
085 return wikiPageLocalService.addPage(
086 getUserId(), nodeId, title, content, summary, minorEdit,
087 serviceContext);
088 }
089
090 @Override
091 public WikiPage addPage(
092 long nodeId, String title, String content, String summary,
093 boolean minorEdit, String format, String parentTitle,
094 String redirectTitle, ServiceContext serviceContext)
095 throws PortalException, SystemException {
096
097 WikiNodePermission.check(
098 getPermissionChecker(), nodeId, ActionKeys.ADD_PAGE);
099
100 return wikiPageLocalService.addPage(
101 getUserId(), nodeId, title, WikiPageConstants.VERSION_DEFAULT,
102 content, summary, minorEdit, format, true, parentTitle,
103 redirectTitle, serviceContext);
104 }
105
106 @Override
107 public void addPageAttachment(
108 long nodeId, String title, String fileName, File file,
109 String mimeType)
110 throws PortalException, SystemException {
111
112 WikiNodePermission.check(
113 getPermissionChecker(), nodeId, ActionKeys.ADD_ATTACHMENT);
114
115 wikiPageLocalService.addPageAttachment(
116 getUserId(), nodeId, title, fileName, file, mimeType);
117 }
118
119 @Override
120 public void addPageAttachment(
121 long nodeId, String title, String fileName, InputStream inputStream,
122 String mimeType)
123 throws PortalException, SystemException {
124
125 WikiNodePermission.check(
126 getPermissionChecker(), nodeId, ActionKeys.ADD_ATTACHMENT);
127
128 wikiPageLocalService.addPageAttachment(
129 getUserId(), nodeId, title, fileName, inputStream, mimeType);
130 }
131
132 @Override
133 public void addPageAttachments(
134 long nodeId, String title,
135 List<ObjectValuePair<String, InputStream>> inputStreamOVPs)
136 throws PortalException, SystemException {
137
138 WikiNodePermission.check(
139 getPermissionChecker(), nodeId, ActionKeys.ADD_ATTACHMENT);
140
141 wikiPageLocalService.addPageAttachments(
142 getUserId(), nodeId, title, inputStreamOVPs);
143 }
144
145 @Override
146 public void addTempPageAttachment(
147 long nodeId, String fileName, String tempFolderName,
148 InputStream inputStream, String mimeType)
149 throws PortalException, SystemException {
150
151 WikiNode node = wikiNodeLocalService.getNode(nodeId);
152
153 WikiNodePermission.check(
154 getPermissionChecker(), node, ActionKeys.ADD_ATTACHMENT);
155
156 wikiPageLocalService.addTempPageAttachment(
157 node.getGroupId(), getUserId(), fileName, tempFolderName,
158 inputStream, mimeType);
159 }
160
161 @Override
162 public void changeParent(
163 long nodeId, String title, String newParentTitle,
164 ServiceContext serviceContext)
165 throws PortalException, SystemException {
166
167 WikiPagePermission.check(
168 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
169
170 WikiNodePermission.check(
171 getPermissionChecker(), nodeId, ActionKeys.ADD_PAGE);
172
173 wikiPageLocalService.changeParent(
174 getUserId(), nodeId, title, newParentTitle, serviceContext);
175 }
176
177 @Override
178 public void copyPageAttachments(
179 long templateNodeId, String templateTitle, long nodeId,
180 String title)
181 throws PortalException, SystemException {
182
183 WikiNodePermission.check(
184 getPermissionChecker(), nodeId, ActionKeys.ADD_ATTACHMENT);
185
186 wikiPageLocalService.copyPageAttachments(
187 getUserId(), templateNodeId, templateTitle, nodeId, title);
188 }
189
190 @Override
191 public void deletePage(long nodeId, String title)
192 throws PortalException, SystemException {
193
194 WikiPagePermission.check(
195 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
196
197 wikiPageLocalService.deletePage(nodeId, title);
198 }
199
200
204 @Override
205 public void deletePage(long nodeId, String title, double version)
206 throws PortalException, SystemException {
207
208 discardDraft(nodeId, title, version);
209 }
210
211 @Override
212 public void deletePageAttachment(long nodeId, String title, String fileName)
213 throws PortalException, SystemException {
214
215 WikiPagePermission.check(
216 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
217
218 wikiPageLocalService.deletePageAttachment(nodeId, title, fileName);
219 }
220
221 @Override
222 public void deletePageAttachments(long nodeId, String title)
223 throws PortalException, SystemException {
224
225 WikiPagePermission.check(
226 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
227
228 wikiPageLocalService.deletePageAttachments(nodeId, title);
229 }
230
231 @Override
232 public void deleteTempPageAttachment(
233 long nodeId, String fileName, String tempFolderName)
234 throws PortalException, SystemException {
235
236 WikiNode node = wikiNodeLocalService.getNode(nodeId);
237
238 WikiNodePermission.check(
239 getPermissionChecker(), node, ActionKeys.ADD_ATTACHMENT);
240
241 wikiPageLocalService.deleteTempPageAttachment(
242 node.getGroupId(), getUserId(), fileName, tempFolderName);
243 }
244
245 @Override
246 public void deleteTrashPageAttachments(long nodeId, String title)
247 throws PortalException, SystemException {
248
249 WikiPagePermission.check(
250 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
251
252 wikiPageLocalService.deleteTrashPageAttachments(nodeId, title);
253 }
254
255 @Override
256 public void discardDraft(long nodeId, String title, double version)
257 throws PortalException, SystemException {
258
259 WikiPagePermission.check(
260 getPermissionChecker(), nodeId, title, version, ActionKeys.DELETE);
261
262 wikiPageLocalService.discardDraft(nodeId, title, version);
263 }
264
265 @Override
266 public List<WikiPage> getChildren(
267 long groupId, long nodeId, boolean head, String parentTitle)
268 throws PortalException, SystemException {
269
270 WikiNodePermission.check(
271 getPermissionChecker(), nodeId, ActionKeys.VIEW);
272
273 return wikiPagePersistence.filterFindByG_N_H_P_S(
274 groupId, nodeId, head, parentTitle,
275 WorkflowConstants.STATUS_APPROVED);
276 }
277
278 @Override
279 public WikiPage getDraftPage(long nodeId, String title)
280 throws PortalException, SystemException {
281
282 WikiPagePermission.check(
283 getPermissionChecker(), nodeId, title, ActionKeys.VIEW);
284
285 return wikiPageLocalService.getDraftPage(nodeId, title);
286 }
287
288 @Override
289 public List<WikiPage> getNodePages(long nodeId, int max)
290 throws PortalException, SystemException {
291
292 List<WikiPage> pages = new ArrayList<WikiPage>();
293
294 int lastIntervalStart = 0;
295 boolean listNotExhausted = true;
296
297 while ((pages.size() < max) && listNotExhausted) {
298 List<WikiPage> pageList = wikiPageLocalService.getPages(
299 nodeId, true, lastIntervalStart, lastIntervalStart + max);
300
301 lastIntervalStart += max;
302 listNotExhausted = (pageList.size() == max);
303
304 for (WikiPage page : pageList) {
305 if (pages.size() >= max) {
306 break;
307 }
308
309 if (WikiPagePermission.contains(
310 getPermissionChecker(), page, ActionKeys.VIEW)) {
311
312 pages.add(page);
313 }
314 }
315 }
316
317 return pages;
318 }
319
320
324 @Override
325 public String getNodePagesRSS(
326 long nodeId, int max, String type, double version,
327 String displayStyle, String feedURL, String entryURL)
328 throws PortalException, SystemException {
329
330 return getNodePagesRSS(
331 nodeId, max, type, version, displayStyle, feedURL, entryURL, null);
332 }
333
334 @Override
335 public String getNodePagesRSS(
336 long nodeId, int max, String type, double version,
337 String displayStyle, String feedURL, String entryURL,
338 String attachmentURLPrefix)
339 throws PortalException, SystemException {
340
341 WikiNodePermission.check(
342 getPermissionChecker(), nodeId, ActionKeys.VIEW);
343
344 WikiNode node = wikiNodePersistence.findByPrimaryKey(nodeId);
345
346 List<WikiPage> pages = getNodePages(nodeId, max);
347
348 return exportToRSS(
349 node.getCompanyId(), node.getName(), node.getDescription(), type,
350 version, displayStyle, feedURL, entryURL, attachmentURLPrefix,
351 pages, false, null);
352 }
353
354 @Override
355 public List<WikiPage> getOrphans(long groupId, long nodeId)
356 throws PortalException, SystemException {
357
358 WikiNodePermission.check(
359 getPermissionChecker(), nodeId, ActionKeys.VIEW);
360
361 List<WikiPage> pages = wikiPagePersistence.filterFindByG_N_H_S(
362 groupId, nodeId, true, WorkflowConstants.STATUS_APPROVED);
363
364 return WikiUtil.filterOrphans(pages);
365 }
366
367 @Override
368 public WikiPage getPage(long groupId, long nodeId, String title)
369 throws PortalException, SystemException {
370
371 List<WikiPage> pages = wikiPagePersistence.filterFindByG_N_T_H(
372 groupId, nodeId, title, true, 0, 1);
373
374 if (!pages.isEmpty()) {
375 return pages.get(0);
376 }
377 else {
378 throw new NoSuchPageException();
379 }
380 }
381
382 @Override
383 public WikiPage getPage(long nodeId, String title)
384 throws PortalException, SystemException {
385
386 WikiPagePermission.check(
387 getPermissionChecker(), nodeId, title, ActionKeys.VIEW);
388
389 return wikiPageLocalService.getPage(nodeId, title);
390 }
391
392 @Override
393 public WikiPage getPage(long nodeId, String title, Boolean head)
394 throws PortalException, SystemException {
395
396 WikiPagePermission.check(
397 getPermissionChecker(), nodeId, title, ActionKeys.VIEW);
398
399 return wikiPageLocalService.getPage(nodeId, title, head);
400 }
401
402 @Override
403 public WikiPage getPage(long nodeId, String title, double version)
404 throws PortalException, SystemException {
405
406 WikiPagePermission.check(
407 getPermissionChecker(), nodeId, title, ActionKeys.VIEW);
408
409 return wikiPageLocalService.getPage(nodeId, title, version);
410 }
411
412 @Override
413 public List<WikiPage> getPages(
414 long groupId, long nodeId, boolean head, int status, int start,
415 int end, OrderByComparator obc)
416 throws PortalException, SystemException {
417
418 WikiNodePermission.check(
419 getPermissionChecker(), nodeId, ActionKeys.VIEW);
420
421 if (status == WorkflowConstants.STATUS_ANY) {
422 return wikiPagePersistence.filterFindByG_N_H(
423 groupId, nodeId, head, start, end, obc);
424 }
425 else {
426 return wikiPagePersistence.filterFindByG_N_H_S(
427 groupId, nodeId, head, status, start, end, obc);
428 }
429 }
430
431 @Override
432 public List<WikiPage> getPages(
433 long groupId, long userId, long nodeId, int status, int start,
434 int end)
435 throws PortalException, SystemException {
436
437 WikiNodePermission.check(
438 getPermissionChecker(), nodeId, ActionKeys.VIEW);
439
440 if (userId > 0) {
441 return wikiPagePersistence.filterFindByG_U_N_S(
442 groupId, userId, nodeId, status, start, end,
443 new PageCreateDateComparator(false));
444 }
445 else {
446 return wikiPagePersistence.filterFindByG_N_S(
447 groupId, nodeId, status, start, end,
448 new PageCreateDateComparator(false));
449 }
450 }
451
452 @Override
453 public int getPagesCount(long groupId, long nodeId, boolean head)
454 throws PortalException, SystemException {
455
456 WikiNodePermission.check(
457 getPermissionChecker(), nodeId, ActionKeys.VIEW);
458
459 return wikiPagePersistence.filterCountByG_N_H_S(
460 groupId, nodeId, head, WorkflowConstants.STATUS_APPROVED);
461 }
462
463 @Override
464 public int getPagesCount(long groupId, long userId, long nodeId, int status)
465 throws PortalException, SystemException {
466
467 WikiNodePermission.check(
468 getPermissionChecker(), nodeId, ActionKeys.VIEW);
469
470 if (userId > 0) {
471 return wikiPagePersistence.filterCountByG_U_N_S(
472 groupId, userId, nodeId, status);
473 }
474 else {
475 return wikiPagePersistence.filterCountByG_N_S(
476 groupId, nodeId, status);
477 }
478 }
479
480
485 @Override
486 public String getPagesRSS(
487 long companyId, long nodeId, String title, int max, String type,
488 double version, String displayStyle, String feedURL,
489 String entryURL, Locale locale)
490 throws PortalException, SystemException {
491
492 return getPagesRSS(
493 companyId, nodeId, title, max, type, version, displayStyle, feedURL,
494 entryURL, null, locale);
495 }
496
497 @Override
498 public String getPagesRSS(
499 long companyId, long nodeId, String title, int max, String type,
500 double version, String displayStyle, String feedURL,
501 String entryURL, String attachmentURLPrefix, Locale locale)
502 throws PortalException, SystemException {
503
504 WikiPagePermission.check(
505 getPermissionChecker(), nodeId, title, ActionKeys.VIEW);
506
507 List<WikiPage> pages = wikiPageLocalService.getPages(
508 nodeId, title, 0, max, new PageCreateDateComparator(true));
509
510 return exportToRSS(
511 companyId, title, title, type, version, displayStyle, feedURL,
512 entryURL, attachmentURLPrefix, pages, true, locale);
513 }
514
515 @Override
516 public List<WikiPage> getRecentChanges(
517 long groupId, long nodeId, int start, int end)
518 throws PortalException, SystemException {
519
520 WikiNodePermission.check(
521 getPermissionChecker(), nodeId, ActionKeys.VIEW);
522
523 Calendar calendar = CalendarFactoryUtil.getCalendar();
524
525 calendar.add(Calendar.WEEK_OF_YEAR, -1);
526
527 return wikiPageFinder.filterFindByCreateDate(
528 groupId, nodeId, calendar.getTime(), false, start, end);
529 }
530
531 @Override
532 public int getRecentChangesCount(long groupId, long nodeId)
533 throws PortalException, SystemException {
534
535 WikiNodePermission.check(
536 getPermissionChecker(), nodeId, ActionKeys.VIEW);
537
538 Calendar calendar = CalendarFactoryUtil.getCalendar();
539
540 calendar.add(Calendar.WEEK_OF_YEAR, -1);
541
542 return wikiPageFinder.filterCountByCreateDate(
543 groupId, nodeId, calendar.getTime(), false);
544 }
545
546 @Override
547 public String[] getTempPageAttachmentNames(
548 long nodeId, String tempFolderName)
549 throws PortalException, SystemException {
550
551 WikiNode node = wikiNodeLocalService.getNode(nodeId);
552
553 WikiNodePermission.check(
554 getPermissionChecker(), node, ActionKeys.ADD_ATTACHMENT);
555
556 return wikiPageLocalService.getTempPageAttachmentNames(
557 node.getGroupId(), getUserId(), tempFolderName);
558 }
559
560 @Override
561 public void movePage(
562 long nodeId, String title, String newTitle,
563 ServiceContext serviceContext)
564 throws PortalException, SystemException {
565
566 WikiPagePermission.check(
567 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
568
569 WikiNodePermission.check(
570 getPermissionChecker(), nodeId, ActionKeys.ADD_PAGE);
571
572 wikiPageLocalService.movePage(
573 getUserId(), nodeId, title, newTitle, serviceContext);
574 }
575
576 @Override
577 public FileEntry movePageAttachmentToTrash(
578 long nodeId, String title, String fileName)
579 throws PortalException, SystemException {
580
581 WikiPagePermission.check(
582 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
583
584 return wikiPageLocalService.movePageAttachmentToTrash(
585 getUserId(), nodeId, title, fileName);
586 }
587
588 @Override
589 public void movePageToTrash(long nodeId, String title)
590 throws PortalException, SystemException {
591
592 WikiPagePermission.check(
593 getPermissionChecker(), nodeId, title, ActionKeys.DELETE);
594
595 wikiPageLocalService.movePageToTrash(getUserId(), nodeId, title);
596 }
597
598 @Override
599 public WikiPage movePageToTrash(long nodeId, String title, double version)
600 throws PortalException, SystemException {
601
602 WikiPagePermission.check(
603 getPermissionChecker(), nodeId, title, version, ActionKeys.DELETE);
604
605 return wikiPageLocalService.movePageToTrash(
606 getUserId(), nodeId, title, version);
607 }
608
609 @Override
610 public void restorePageAttachmentFromTrash(
611 long nodeId, String title, String fileName)
612 throws PortalException, SystemException {
613
614 WikiNodePermission.check(
615 getPermissionChecker(), nodeId, ActionKeys.ADD_ATTACHMENT);
616
617 wikiPageLocalService.restorePageAttachmentFromTrash(
618 getUserId(), nodeId, title, fileName);
619 }
620
621 @Override
622 public void restorePageFromTrash(long resourcePrimKey)
623 throws PortalException, SystemException {
624
625 WikiPage page = wikiPageLocalService.getPage(resourcePrimKey);
626
627 WikiPagePermission.check(
628 getPermissionChecker(), page, ActionKeys.DELETE);
629
630 wikiPageLocalService.restorePageFromTrash(getUserId(), page);
631 }
632
633 @Override
634 public WikiPage revertPage(
635 long nodeId, String title, double version,
636 ServiceContext serviceContext)
637 throws PortalException, SystemException {
638
639 WikiPagePermission.check(
640 getPermissionChecker(), nodeId, title, ActionKeys.UPDATE);
641
642 return wikiPageLocalService.revertPage(
643 getUserId(), nodeId, title, version, serviceContext);
644 }
645
646 @Override
647 public void subscribePage(long nodeId, String title)
648 throws PortalException, SystemException {
649
650 WikiPagePermission.check(
651 getPermissionChecker(), nodeId, title, ActionKeys.SUBSCRIBE);
652
653 wikiPageLocalService.subscribePage(getUserId(), nodeId, title);
654 }
655
656 @Override
657 public void unsubscribePage(long nodeId, String title)
658 throws PortalException, SystemException {
659
660 WikiPagePermission.check(
661 getPermissionChecker(), nodeId, title, ActionKeys.SUBSCRIBE);
662
663 wikiPageLocalService.unsubscribePage(getUserId(), nodeId, title);
664 }
665
666 @Override
667 public WikiPage updatePage(
668 long nodeId, String title, double version, String content,
669 String summary, boolean minorEdit, String format,
670 String parentTitle, String redirectTitle,
671 ServiceContext serviceContext)
672 throws PortalException, SystemException {
673
674 WikiPagePermission.check(
675 getPermissionChecker(), nodeId, title, ActionKeys.UPDATE);
676
677 return wikiPageLocalService.updatePage(
678 getUserId(), nodeId, title, version, content, summary, minorEdit,
679 format, parentTitle, redirectTitle, serviceContext);
680 }
681
682 protected String exportToRSS(
683 long companyId, String name, String description, String type,
684 double version, String displayStyle, String feedURL,
685 String entryURL, String attachmentURLPrefix, List<WikiPage> pages,
686 boolean diff, Locale locale)
687 throws PortalException, SystemException {
688
689 SyndFeed syndFeed = new SyndFeedImpl();
690
691 syndFeed.setDescription(description);
692
693 List<SyndEntry> syndEntries = new ArrayList<SyndEntry>();
694
695 syndFeed.setEntries(syndEntries);
696
697 WikiPage latestPage = null;
698
699 StringBundler sb = new StringBundler(6);
700
701 for (WikiPage page : pages) {
702 SyndEntry syndEntry = new SyndEntryImpl();
703
704 String author = PortalUtil.getUserName(page);
705
706 syndEntry.setAuthor(author);
707
708 SyndContent syndContent = new SyndContentImpl();
709
710 syndContent.setType(RSSUtil.ENTRY_TYPE_DEFAULT);
711
712 sb.setIndex(0);
713
714 sb.append(entryURL);
715
716 if (entryURL.endsWith(StringPool.SLASH)) {
717 sb.append(HttpUtil.encodeURL(page.getTitle()));
718 }
719
720 if (diff) {
721 if ((latestPage != null) || (pages.size() == 1)) {
722 sb.append(StringPool.QUESTION);
723 sb.append(PortalUtil.getPortletNamespace(PortletKeys.WIKI));
724 sb.append("version=");
725 sb.append(page.getVersion());
726
727 String value = null;
728
729 if (latestPage == null) {
730 value = WikiUtil.convert(
731 page, null, null, attachmentURLPrefix);
732 }
733 else {
734 try {
735 value = WikiUtil.diffHtml(
736 latestPage, page, null, null,
737 attachmentURLPrefix);
738 }
739 catch (PortalException pe) {
740 throw pe;
741 }
742 catch (SystemException se) {
743 throw se;
744 }
745 catch (Exception e) {
746 throw new SystemException(e);
747 }
748 }
749
750 syndContent.setValue(value);
751
752 syndEntry.setDescription(syndContent);
753
754 syndEntries.add(syndEntry);
755 }
756 }
757 else {
758 String value = null;
759
760 if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_ABSTRACT)) {
761 value = StringUtil.shorten(
762 HtmlUtil.extractText(page.getContent()),
763 PropsValues.WIKI_RSS_ABSTRACT_LENGTH, StringPool.BLANK);
764 }
765 else if (displayStyle.equals(RSSUtil.DISPLAY_STYLE_TITLE)) {
766 value = StringPool.BLANK;
767 }
768 else {
769 value = WikiUtil.convert(
770 page, null, null, attachmentURLPrefix);
771 }
772
773 syndContent.setValue(value);
774
775 syndEntry.setDescription(syndContent);
776
777 syndEntries.add(syndEntry);
778 }
779
780 syndEntry.setLink(sb.toString());
781 syndEntry.setPublishedDate(page.getCreateDate());
782
783 String title =
784 page.getTitle() + StringPool.SPACE + page.getVersion();
785
786 if (page.isMinorEdit()) {
787 title +=
788 StringPool.SPACE + StringPool.OPEN_PARENTHESIS +
789 LanguageUtil.get(locale, "minor-edit") +
790 StringPool.CLOSE_PARENTHESIS;
791 }
792
793 syndEntry.setTitle(title);
794
795 syndEntry.setUpdatedDate(page.getModifiedDate());
796 syndEntry.setUri(sb.toString());
797
798 latestPage = page;
799 }
800
801 syndFeed.setFeedType(RSSUtil.getFeedType(type, version));
802
803 List<SyndLink> syndLinks = new ArrayList<SyndLink>();
804
805 syndFeed.setLinks(syndLinks);
806
807 SyndLink syndLinkSelf = new SyndLinkImpl();
808
809 syndLinks.add(syndLinkSelf);
810
811 syndLinkSelf.setHref(feedURL);
812 syndLinkSelf.setRel("self");
813
814 syndFeed.setPublishedDate(new Date());
815 syndFeed.setTitle(name);
816 syndFeed.setUri(feedURL);
817
818 try {
819 return RSSUtil.export(syndFeed);
820 }
821 catch (FeedException fe) {
822 throw new SystemException(fe);
823 }
824 }
825
826 }