Search in sources :

Example 6 with ArticleLoadException

use of com.celements.blog.article.ArticleLoadException in project celements-blog by celements.

the class BlogPlugin method getBlogArticles.

/**
 * @deprecated since 1.32 instead use
 *             {@link BlogService#getArticles(DocumentReference, ArticleLoadParameter)}
 * @param blogArticleSpace
 *          Space where the blog's articles are saved.
 * @param subscribedBlogsStr
 *          Comma separated String with all the blog article spaces the blog has subscribed to.
 * @param language
 *          default language
 * @param archiveOnly
 *          Only get articles from the archive (archivedate < now)
 * @param futurOnly
 *          Only get articles that are not yet published (publishdate > now)
 * @param subscribableOnly
 *          Only get articles from subscribed blogs, but not the ones from the blog the user is
 *          on.
 * @param withArchive
 *          Include archived articles in the answer. Has no effect if archiveOnly = true.
 * @param withFutur
 *          Include not yet published articles. Only possible if the page has been saved with
 *          programmingrights or the user has edit right on the article. Has no effect if
 *          futurOnly = true.
 * @param withSubscribable
 *          Include articles from subscribed blogs.
 * @param withSubscribed
 *          Include articles the blog has subscribed to.
 * @param withUnsubscribed
 *          Include articles the blog has unsubscribed from. Only works with edit rights or
 *          programmingrights.
 * @param withUndecided
 *          Include articles the blog has not yet desided about a subscription. Only works with
 *          edit rights or programmingrights.
 * @param checkAccessRights
 *          Do pay attention to the rights. Default = true if no programmingrights.
 * @param context
 * @return
 * @throws XWikiException
 */
@Deprecated
public List<Article> getBlogArticles(String blogArticleSpace, String subscribedBlogsStr, String language, boolean archiveOnly, boolean futurOnly, boolean subscribableOnly, boolean withArchive, boolean withFutur, boolean withSubscribable, boolean withSubscribed, boolean withUnsubscribed, boolean withUndecided, boolean checkAccessRights, XWikiContext context) throws ArticleLoadException {
    try {
        SpaceReference spaceRef = new SpaceReference(blogArticleSpace, new WikiReference(context.getDatabase()));
        DocumentReference blogConfDocRef = getBlogService().getBlogConfigDocRef(spaceRef);
        ArticleLoadParameter param = new ArticleLoadParameter();
        param.setBlogDocRef(blogConfDocRef);
        param.setWithBlogArticles(!subscribableOnly);
        param.setLanguage(language);
        if (withSubscribable) {
            param.setSubscriptionModes(getSubsModes(withSubscribed, withUnsubscribed, withUndecided));
        }
        param.setDateModes(getDateModes(archiveOnly, futurOnly, withArchive, withFutur));
        LOGGER.debug("Got " + param + "' for: blogArticleSpace=" + blogArticleSpace + ", subscribedBlogs=" + subscribedBlogsStr + ", language=" + language + ", archiveOnly=" + archiveOnly + ", futurOnly=" + futurOnly + ", withArchive=" + withArchive + ", withFutur=" + withFutur + ", subscribableOnly=" + subscribableOnly + ", withSubscribable=" + withSubscribable + ", withSubscribed=" + withSubscribed + ", withUnsubscribed=" + withUnsubscribed + ", withUndecided=" + withUndecided + ", checkAccessRights=" + checkAccessRights);
        return getBlogService().getArticles(blogConfDocRef, param);
    } catch (XWikiException xwe) {
        throw new ArticleLoadException(xwe);
    } catch (QueryException qexc) {
        throw new ArticleLoadException(qexc);
    }
}
Also used : ArticleLoadParameter(com.celements.blog.article.ArticleLoadParameter) QueryException(org.xwiki.query.QueryException) SpaceReference(org.xwiki.model.reference.SpaceReference) WikiReference(org.xwiki.model.reference.WikiReference) ArticleLoadException(com.celements.blog.article.ArticleLoadException) DocumentReference(org.xwiki.model.reference.DocumentReference) XWikiException(com.xpn.xwiki.XWikiException)

Aggregations

ArticleLoadException (com.celements.blog.article.ArticleLoadException)6 ArticleLoadParameter (com.celements.blog.article.ArticleLoadParameter)3 XWikiException (com.xpn.xwiki.XWikiException)3 DocumentReference (org.xwiki.model.reference.DocumentReference)3 Article (com.celements.blog.article.Article)2 Test (org.junit.Test)2 QueryException (org.xwiki.query.QueryException)2 IArticleEngineRole (com.celements.blog.article.IArticleEngineRole)1 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)1 Date (java.util.Date)1 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1 SpaceReference (org.xwiki.model.reference.SpaceReference)1 WikiReference (org.xwiki.model.reference.WikiReference)1