Search in sources :

Example 1 with NewsEntry

use of org.nzbhydra.news.NewsProvider.NewsEntry in project nzbhydra2 by theotherp.

the class NewsProviderTest method getNewsJson.

protected List<NewsEntry> getNewsJson() throws ParseException, JsonProcessingException {
    NewsEntry entry1 = new NewsEntry(new SemanticVersion("1.0.0"), "news1.0.0");
    NewsEntry entry2 = new NewsEntry(new SemanticVersion("2.0.0"), "news2.0.0");
    NewsEntry entry3 = new NewsEntry(new SemanticVersion("3.0.0"), "news3.0.0");
    List<NewsEntry> entries = Arrays.asList(entry2, entry1, entry3);
    return entries;
}
Also used : NewsEntry(org.nzbhydra.news.NewsProvider.NewsEntry) SemanticVersion(org.nzbhydra.mapping.SemanticVersion)

Example 2 with NewsEntry

use of org.nzbhydra.news.NewsProvider.NewsEntry in project nzbhydra2 by theotherp.

the class NewsWeb method transform.

private List<NewsEntryForWeb> transform(List<NewsEntry> entries) {
    List<NewsEntryForWeb> transformedEntries = new ArrayList<>();
    for (NewsEntry entry : entries) {
        boolean isForCurrentVersion = entry.getShowForVersion().equals(new SemanticVersion(updateManager.getCurrentVersionString()));
        boolean isForNewerVersion = entry.getShowForVersion().isUpdateFor(new SemanticVersion(updateManager.getCurrentVersionString()));
        transformedEntries.add(new NewsEntryForWeb(entry.getShowForVersion().getAsString(), Markdown.renderMarkdownAsHtml(entry.getNewsAsMarkdown()), isForCurrentVersion, isForNewerVersion));
    }
    return transformedEntries;
}
Also used : ArrayList(java.util.ArrayList) NewsEntry(org.nzbhydra.news.NewsProvider.NewsEntry) SemanticVersion(org.nzbhydra.mapping.SemanticVersion)

Aggregations

SemanticVersion (org.nzbhydra.mapping.SemanticVersion)2 NewsEntry (org.nzbhydra.news.NewsProvider.NewsEntry)2 ArrayList (java.util.ArrayList)1