use of com.celements.blog.article.ArticleLoadParameter.SubscriptionMode in project celements-blog by celements.
the class ArticleEngineHQL method getArticles.
@Override
public List<Article> getArticles(ArticleLoadParameter param) throws ArticleLoadException {
try {
SpaceReference spaceRef = blogService.getBlogSpaceRef(param.getBlogDocRef());
String blogArticleSpace = spaceRef != null ? spaceRef.getName() : "";
List<String> subscribedBlogs = new ArrayList<>();
for (DocumentReference subsDocRef : param.getSubscribedToBlogs()) {
SpaceReference subsSpaceRef = blogService.getBlogSpaceRef(subsDocRef);
if (subsSpaceRef != null) {
subscribedBlogs.add(subsSpaceRef.getName());
}
}
String language = param.getLanguage();
Set<DateMode> dateModes = param.getDateModes();
boolean archiveOnly = ((dateModes.size() == 1) && dateModes.contains(DateMode.ARCHIVED)) || (dateModes.size() == 0);
boolean futurOnly = ((dateModes.size() == 1) && dateModes.contains(DateMode.FUTURE)) || (dateModes.size() == 0);
boolean subscribableOnly = !param.isWithBlogArticles();
boolean withArchive = dateModes.contains(DateMode.ARCHIVED);
boolean withFutur = dateModes.contains(DateMode.FUTURE);
Set<SubscriptionMode> subsModes = param.getSubscriptionModes();
boolean withSubscribable = subsModes.size() > 0;
boolean withSubscribed = subsModes.contains(SubscriptionMode.SUBSCRIBED);
boolean withUnsubscribed = subsModes.contains(SubscriptionMode.UNSUBSCRIBED);
boolean withUndecided = subsModes.contains(SubscriptionMode.UNDECIDED);
boolean checkAccessRights = true;
LOGGER.debug(param + "' translated to: blogArticleSpace=" + blogArticleSpace + ", subscribedBlogs=" + subscribedBlogs + ", language=" + language + ", archiveOnly=" + archiveOnly + ", futurOnly=" + futurOnly + ", withArchive=" + withArchive + ", withFutur=" + withFutur + ", subscribableOnly=" + subscribableOnly + ", withSubscribable=" + withSubscribable + ", withSubscribed=" + withSubscribed + ", withUnsubscribed=" + withUnsubscribed + ", withUndecided=" + withUndecided + ", checkAccessRights=" + checkAccessRights);
return getBlogArticles(blogArticleSpace, subscribedBlogs, language, archiveOnly, futurOnly, subscribableOnly, withArchive, withFutur, withSubscribable, withSubscribed, withUnsubscribed, withUndecided, checkAccessRights);
} catch (XWikiException xwe) {
throw new ArticleLoadException(xwe);
}
}
Aggregations