Package org.b3log.latke.repository

Examples of org.b3log.latke.repository.RepositoryException


    public void importArticle(final JSONObject article)
            throws RepositoryException {
        String articleId = null;
        try {
            if (!article.has(Keys.OBJECT_ID)) {
                throw new RepositoryException("The article to import MUST exist "
                                              + "id");
            }
            articleId = article.getString(Keys.OBJECT_ID);

            if (!article.has(Article.ARTICLE_CREATE_DATE)) {
                throw new RepositoryException("The article to import MUST exist "
                                              + "create date");
            }

            // XXX:  check other params

            // Remove external attributes, such as "blogSyncExternal...."
            article.remove(BlogSync.BLOG_SYNC_EXTERNAL_ARTICLE_ABSTRACT);
            article.remove(BlogSync.BLOG_SYNC_EXTERNAL_ARTICLE_CATEGORIES);
            article.remove(BlogSync.BLOG_SYNC_EXTERNAL_ARTICLE_CONTENT);
            article.remove(BlogSync.BLOG_SYNC_EXTERNAL_ARTICLE_CREATE_DATE);
            article.remove(BlogSync.BLOG_SYNC_EXTERNAL_ARTICLE_ID);
            article.remove(BlogSync.BLOG_SYNC_EXTERNAL_ARTICLE_TITLE);

            super.add(article);
        } catch (final Exception e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw new RepositoryException(e);
        }

        LOGGER.log(Level.FINER, "Imported an article[oId={0}]", articleId);
    }
View Full Code Here


            try {
                return article.getBoolean(Article.ARTICLE_IS_PUBLISHED);
            } catch (final JSONException e) {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);

                throw new RepositoryException(e);
            }
        }
    }
View Full Code Here

        try {
            return array.getJSONObject(0);
        } catch (final JSONException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw new RepositoryException(e);
        }
    }
View Full Code Here

            final JSONArray articleComments = result.getJSONArray(Keys.RESULTS);

            return CollectionUtils.jsonArrayToList(articleComments);
        } catch (final JSONException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw new RepositoryException(e);
        }
    }
View Full Code Here

        try {
            return Role.ADMIN_ROLE.equals(user.getString(User.USER_ROLE));
        } catch (final JSONException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);

            throw new RepositoryException(e);
        }
    }
View Full Code Here

            ret.remove(BlogSync.BLOG_SYNC_EXTERNAL_BLOGGING_SYS);
            ret.remove(BlogSync.BLOG_SYNC_EXTERNAL_ARTICLE_ID);

            return ret;
        } catch (final JSONException e) {
            throw new RepositoryException(e);
        }
    }
View Full Code Here

        try {
            return array.getJSONObject(0).getInt(Link.LINK_ORDER);
        } catch (final JSONException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw new RepositoryException(e);
        }
    }
View Full Code Here

        try {
            return array.getJSONObject(0).getInt(Page.PAGE_ORDER);
        } catch (final JSONException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw new RepositoryException(e);
        }
    }
View Full Code Here

                ret =
                        org.b3log.latke.util.CollectionUtils.jsonArrayToList(result.
                        getJSONArray(Keys.RESULTS));
            } catch (final JSONException e) {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                throw new RepositoryException(e);
            }

            CACHE.put(cacheKey, ret);

            LOGGER.log(Level.FINEST,
View Full Code Here

                final JSONObject archiveDate = archiveDates.getJSONObject(i);
                ret.add(archiveDate);
            }
        } catch (final JSONException e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
            throw new RepositoryException(e);
        }

        return ret;
    }
View Full Code Here

TOP

Related Classes of org.b3log.latke.repository.RepositoryException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.