Andreas Schaefer wrote: > Hi Marius > >>> Andreas Schaefer a écrit : > >>>> I tried to use get this working but I turned out that there are some >>>> basic flaws in the FeedPlugin/Api. First many of the "getBlogFeed" >>>> method use the Collections.EMPTY_MAP but this one is immutable but >>>> the >>>> Feed Plugin still wants to add Metadata making it fail with an >>>> UnsupportedOperationException. >>>> >>> Maybe Marius can provide some help on it. >> Collections.EMPTY_MAP is used to fill a "missing" parameter when a >> method is overloaded. Use the signature that specifies the parameter: >> >> public SyndEntrySourceApi getSyndEntryArticleSource() >> public SyndEntrySourceApi getSyndEntryArticleSource(Map params) >
> I noticed that but the problem is that later these maps are used to Used where? In your code or in the feed plug-in code? I doubt it's in the feed plug-in code because the semantic I choose was: if you don't specify any parameters then you don't have any parameters and thus there's no need to change the map. If you want to specify parameters then you have to provide at least an empty (mutable) map. Can you give me a code snipped that shows the failure? > add values to it and that subsequently fails because these maps are > immutable. I had to use an empty map to make it work and so maybe we > should do that there as well. > >>>> Secondly the Feed Plugin expects the document class to be of type >>>> 'XWiki.ArticleClass' but for a Blog it is 'Blog.BlogPostClass' >>>> making >>>> it fail to create entries on the SyncedFeed. >> Can you try something like http://tinyurl.com/cps7oa ? > > The FeedPlugin has two problems. A default query is not working > because it looks for XWiki.ArticleClass which I changed but also it > uses the XWiki.ArticleClass to define the properties to read out the > values and that fails with a NPE. I had to change the Source > Parameters in order to make it work. I will have a closer look at the > Feed Plugin and provide a patch when I could make it work. Again, can you provide a code snipped that shows the issue? SyndEntryDocumentSource is a generic feed entry source that knows nothing about XWiki.ArticleClass. It can generate a feed entry by collecting values from different properties of different objects attached to the source document. You can even specify velocity expressions to fill feed entry fields. Feed plug-in provides some helper methods for generating a feed from XWiki.ArticleClass objects. Forget about it. For the new blog you have to use the generic API and specify the mapping between feed entry fields and Blog.BlogPostClass properties. Take a closer look at my example http://tinyurl.com/cps7oa . As you can see I map: * ContentLength field -> a constant, 10 * title field -> document title * description field -> the content property of the first XWiki.ArticleClass object attached to the source document * publishedDate -> the date property of the XWiki.ArticleClass object with index 0 among all the XWiki.ArticleClass objects attached to the source document * updatedDate -> a velocity expression, $doc.date.time * categories -> a list: $doc.space, $doc.name, $doc.isNew() So what stops you from mapping feed entry fields to Blog.BlogPostClass properties ? Hope this helps, Marius > > Cheers - Andy > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

