/**
  * Overwrites the current values of the given feed entry with new ones computed from the specified
  * source document.
  *
  * @param entry the feed entry whose fields are going to be overwritten
  * @param doc the source for the new values to be set on the fields of the feed entry
  * @param params parameters to adjust the computation. Each concrete strategy may define its own
  *     (key, value) pairs
  * @param context the XWiki context
  * @throws XWikiException
  */
 public void sourceDocument(
     SyndEntry entry, Document doc, Map<String, Object> params, XWikiContext context)
     throws XWikiException {
   entry.setUri(getURI(doc, params, context));
   entry.setLink(getLink(doc, params, context));
   entry.setTitle(getTitle(doc, params, context));
   entry.setDescription(getDescription(doc, params, context));
   entry.setCategories(getCategories(doc, params, context));
   entry.setPublishedDate(getPublishedDate(doc, params, context));
   entry.setUpdatedDate(getUpdateDate(doc, params, context));
   entry.setAuthor(getAuthor(doc, params, context));
   entry.setContributors(getContributors(doc, params, context));
 }
Example #2
0
  public SyndEntry build() {
    final SyndEntry entry = new SyndEntryImpl();

    if (uri != null) {
      entry.setUri(uri);
    }
    if (title != null) {
      entry.setTitleEx(title);
    }
    if (link != null) {
      entry.setLink(link);
    }
    if (links != null) {
      entry.setLinks(links);
    }
    if (description != null) {
      entry.setDescription(description);
    }
    if (contents != null) {
      entry.setContents(contents);
    }
    if (enclosures != null) {
      entry.setEnclosures(enclosures);
    }
    if (publishedDate != null) {
      entry.setPublishedDate(publishedDate);
    }
    if (updatedDate != null) {
      entry.setUpdatedDate(updatedDate);
    }
    if (author != null) {
      entry.setAuthor(author);
    }
    if (authors != null) {
      entry.setAuthors(authors);
    }
    if (contributors != null) {
      entry.setContributors(contributors);
    }
    if (categories != null) {
      entry.setCategories(categories);
    }

    return entry;
  }
Example #3
0
 /**
  * Create new entry
  *
  * @param uri uri of item
  * @param title title of item
  * @param link link to this item
  * @param listContent the content of item
  * @param description the description for this item
  * @return SyndEntry
  */
 public static SyndEntry createNewEntry(
     String uri,
     String title,
     String link,
     List<String> listContent,
     SyndContent description,
     Date pubDate,
     String author) {
   SyndEntry entry = new SyndEntryImpl();
   entry.setUri(uri);
   entry.setTitle(title);
   entry.setLink(link + uri);
   entry.setContributors(listContent);
   entry.setDescription(description);
   entry.setPublishedDate(pubDate);
   entry.setAuthor(author);
   return entry;
 }