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);
}