Commit 31033e81 authored by Liang Ding's avatar Liang Ding

🚚 #12515 数据模型填充服务

parent e7534422
...@@ -44,7 +44,7 @@ import org.b3log.solo.SoloServletListener; ...@@ -44,7 +44,7 @@ import org.b3log.solo.SoloServletListener;
import org.b3log.solo.event.EventTypes; import org.b3log.solo.event.EventTypes;
import org.b3log.solo.model.*; import org.b3log.solo.model.*;
import org.b3log.solo.processor.console.ConsoleRenderer; import org.b3log.solo.processor.console.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.*; import org.b3log.solo.service.*;
import org.b3log.solo.util.Skins; import org.b3log.solo.util.Skins;
import org.b3log.solo.util.Thumbnails; import org.b3log.solo.util.Thumbnails;
...@@ -93,10 +93,10 @@ public class ArticleProcessor { ...@@ -93,10 +93,10 @@ public class ArticleProcessor {
private CommentQueryService commentQueryService; private CommentQueryService commentQueryService;
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Language service. * Language service.
...@@ -188,7 +188,7 @@ public class ArticleProcessor { ...@@ -188,7 +188,7 @@ public class ArticleProcessor {
dataModel.put(Common.YEAR, String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); dataModel.put(Common.YEAR, String.valueOf(Calendar.getInstance().get(Calendar.YEAR)));
Keys.fillRuntime(dataModel); Keys.fillRuntime(dataModel);
filler.fillMinified(dataModel); dataModelService.fillMinified(dataModel);
} }
/** /**
...@@ -378,7 +378,7 @@ public class ArticleProcessor { ...@@ -378,7 +378,7 @@ public class ArticleProcessor {
requestJSONObject.put(Option.ID_C_ENABLE_ARTICLE_UPDATE_HINT, preference.optBoolean(Option.ID_C_ENABLE_ARTICLE_UPDATE_HINT)); requestJSONObject.put(Option.ID_C_ENABLE_ARTICLE_UPDATE_HINT, preference.optBoolean(Option.ID_C_ENABLE_ARTICLE_UPDATE_HINT));
final JSONObject result = articleQueryService.getArticles(requestJSONObject); final JSONObject result = articleQueryService.getArticles(requestJSONObject);
final List<JSONObject> articles = org.b3log.latke.util.CollectionUtils.jsonArrayToList(result.getJSONArray(Article.ARTICLES)); final List<JSONObject> articles = org.b3log.latke.util.CollectionUtils.jsonArrayToList(result.getJSONArray(Article.ARTICLES));
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
jsonObject.put(Keys.RESULTS, result); jsonObject.put(Keys.RESULTS, result);
} catch (final Exception e) { } catch (final Exception e) {
...@@ -431,7 +431,7 @@ public class ArticleProcessor { ...@@ -431,7 +431,7 @@ public class ArticleProcessor {
final int tagArticleCount = tag.getInt(Tag.TAG_PUBLISHED_REFERENCE_COUNT); final int tagArticleCount = tag.getInt(Tag.TAG_PUBLISHED_REFERENCE_COUNT);
final int pageCount = (int) Math.ceil((double) tagArticleCount / (double) pageSize); final int pageCount = (int) Math.ceil((double) tagArticleCount / (double) pageSize);
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
final JSONObject result = new JSONObject(); final JSONObject result = new JSONObject();
final JSONObject pagination = new JSONObject(); final JSONObject pagination = new JSONObject();
...@@ -483,7 +483,7 @@ public class ArticleProcessor { ...@@ -483,7 +483,7 @@ public class ArticleProcessor {
final int pageCount = (int) Math.ceil((double) articleCount / (double) pageSize); final int pageCount = (int) Math.ceil((double) articleCount / (double) pageSize);
final List<JSONObject> articles = articleQueryService.getArticlesByArchiveDate(archiveDateId, currentPageNum, pageSize); final List<JSONObject> articles = articleQueryService.getArticlesByArchiveDate(archiveDateId, currentPageNum, pageSize);
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
final JSONObject result = new JSONObject(); final JSONObject result = new JSONObject();
final JSONObject pagination = new JSONObject(); final JSONObject pagination = new JSONObject();
...@@ -534,7 +534,7 @@ public class ArticleProcessor { ...@@ -534,7 +534,7 @@ public class ArticleProcessor {
final JSONObject author = authorRet.getJSONObject(User.USER); final JSONObject author = authorRet.getJSONObject(User.USER);
final List<JSONObject> articles = articleQueryService.getArticlesByAuthorId(authorId, currentPageNum, pageSize); final List<JSONObject> articles = articleQueryService.getArticlesByAuthorId(authorId, currentPageNum, pageSize);
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
final int articleCount = author.getInt(UserExt.USER_PUBLISHED_ARTICLE_COUNT); final int articleCount = author.getInt(UserExt.USER_PUBLISHED_ARTICLE_COUNT);
final int pageCount = (int) Math.ceil((double) articleCount / (double) pageSize); final int pageCount = (int) Math.ceil((double) articleCount / (double) pageSize);
...@@ -616,7 +616,7 @@ public class ArticleProcessor { ...@@ -616,7 +616,7 @@ public class ArticleProcessor {
return; return;
} }
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
final int articleCount = author.getInt(UserExt.USER_PUBLISHED_ARTICLE_COUNT); final int articleCount = author.getInt(UserExt.USER_PUBLISHED_ARTICLE_COUNT);
final int pageCount = (int) Math.ceil((double) articleCount / (double) pageSize); final int pageCount = (int) Math.ceil((double) articleCount / (double) pageSize);
...@@ -624,7 +624,7 @@ public class ArticleProcessor { ...@@ -624,7 +624,7 @@ public class ArticleProcessor {
final Map<String, Object> dataModel = renderer.getDataModel(); final Map<String, Object> dataModel = renderer.getDataModel();
prepareShowAuthorArticles(pageNums, dataModel, pageCount, currentPageNum, articles, author); prepareShowAuthorArticles(pageNums, dataModel, pageCount, currentPageNum, articles, author);
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
...@@ -690,12 +690,12 @@ public class ArticleProcessor { ...@@ -690,12 +690,12 @@ public class ArticleProcessor {
return; return;
} }
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
final Map<String, Object> dataModel = renderer.getDataModel(); final Map<String, Object> dataModel = renderer.getDataModel();
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
prepareShowArchiveArticles(preference, dataModel, articles, currentPageNum, pageCount, archiveDateString, archiveDate); prepareShowArchiveArticles(preference, dataModel, articles, currentPageNum, pageCount, archiveDateString, archiveDate);
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
} catch (final Exception e) { } catch (final Exception e) {
...@@ -776,7 +776,7 @@ public class ArticleProcessor { ...@@ -776,7 +776,7 @@ public class ArticleProcessor {
prepareShowArticle(preference, dataModel, article); prepareShowArticle(preference, dataModel, article);
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
if (!StatisticMgmtService.hasBeenServed(request, response)) { if (!StatisticMgmtService.hasBeenServed(request, response)) {
......
...@@ -36,7 +36,7 @@ import org.b3log.solo.model.Article; ...@@ -36,7 +36,7 @@ import org.b3log.solo.model.Article;
import org.b3log.solo.model.Category; import org.b3log.solo.model.Category;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.*; import org.b3log.solo.service.*;
import org.b3log.solo.util.Skins; import org.b3log.solo.util.Skins;
import org.json.JSONException; import org.json.JSONException;
...@@ -64,10 +64,10 @@ public class CategoryProcessor { ...@@ -64,10 +64,10 @@ public class CategoryProcessor {
private static final Logger LOGGER = Logger.getLogger(CategoryProcessor.class); private static final Logger LOGGER = Logger.getLogger(CategoryProcessor.class);
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Language service. * Language service.
...@@ -193,13 +193,13 @@ public class CategoryProcessor { ...@@ -193,13 +193,13 @@ public class CategoryProcessor {
} }
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
final List<Integer> pageNums = (List) result.optJSONObject(Pagination.PAGINATION).opt(Pagination.PAGINATION_PAGE_NUMS); final List<Integer> pageNums = (List) result.optJSONObject(Pagination.PAGINATION).opt(Pagination.PAGINATION_PAGE_NUMS);
fillPagination(dataModel, pageCount, currentPageNum, articles, pageNums); fillPagination(dataModel, pageCount, currentPageNum, articles, pageNums);
dataModel.put(Common.PATH, "/category/" + URLEncoder.encode(categoryURI, "UTF-8")); dataModel.put(Common.PATH, "/category/" + URLEncoder.encode(categoryURI, "UTF-8"));
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
} catch (final ServiceException | JSONException e) { } catch (final ServiceException | JSONException e) {
......
...@@ -29,7 +29,7 @@ import org.b3log.latke.servlet.annotation.RequestProcessor; ...@@ -29,7 +29,7 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.util.Locales; import org.b3log.latke.util.Locales;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.processor.console.ConsoleRenderer; import org.b3log.solo.processor.console.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.UserQueryService; import org.b3log.solo.service.UserQueryService;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -54,10 +54,10 @@ public class ErrorProcessor { ...@@ -54,10 +54,10 @@ public class ErrorProcessor {
private static final Logger LOGGER = Logger.getLogger(ArticleProcessor.class); private static final Logger LOGGER = Logger.getLogger(ArticleProcessor.class);
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Preference query service. * Preference query service.
...@@ -103,7 +103,7 @@ public class ErrorProcessor { ...@@ -103,7 +103,7 @@ public class ErrorProcessor {
final Map<String, String> langs = langPropsService.getAll(Locales.getLocale(request)); final Map<String, String> langs = langPropsService.getAll(Locales.getLocale(request));
dataModel.putAll(langs); dataModel.putAll(langs);
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
dataModel.put(Common.LOGIN_URL, userQueryService.getLoginURL(Common.ADMIN_INDEX_URI)); dataModel.put(Common.LOGIN_URL, userQueryService.getLoginURL(Common.ADMIN_INDEX_URI));
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
......
...@@ -39,7 +39,7 @@ import org.b3log.solo.model.Common; ...@@ -39,7 +39,7 @@ import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Skin; import org.b3log.solo.model.Skin;
import org.b3log.solo.processor.console.ConsoleRenderer; import org.b3log.solo.processor.console.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.StatisticMgmtService; import org.b3log.solo.service.StatisticMgmtService;
import org.b3log.solo.util.Skins; import org.b3log.solo.util.Skins;
...@@ -67,10 +67,10 @@ public class IndexProcessor { ...@@ -67,10 +67,10 @@ public class IndexProcessor {
private static final Logger LOGGER = Logger.getLogger(IndexProcessor.class); private static final Logger LOGGER = Logger.getLogger(IndexProcessor.class);
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Preference query service. * Preference query service.
...@@ -128,8 +128,8 @@ public class IndexProcessor { ...@@ -128,8 +128,8 @@ public class IndexProcessor {
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
filler.fillIndexArticles(request, dataModel, currentPageNum, preference); dataModelService.fillIndexArticles(request, dataModel, currentPageNum, preference);
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
dataModel.put(Pagination.PAGINATION_CURRENT_PAGE_NUM, currentPageNum); dataModel.put(Pagination.PAGINATION_CURRENT_PAGE_NUM, currentPageNum);
final int previousPageNum = currentPageNum > 1 ? currentPageNum - 1 : 0; final int previousPageNum = currentPageNum > 1 ? currentPageNum - 1 : 0;
...@@ -177,10 +177,10 @@ public class IndexProcessor { ...@@ -177,10 +177,10 @@ public class IndexProcessor {
final Map<String, String> langs = langPropsService.getAll(Locales.getLocale(request)); final Map<String, String> langs = langPropsService.getAll(Locales.getLocale(request));
dataModel.putAll(langs); dataModel.putAll(langs);
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
Keys.fillServer(dataModel); Keys.fillServer(dataModel);
Keys.fillRuntime(dataModel); Keys.fillRuntime(dataModel);
filler.fillMinified(dataModel); dataModelService.fillMinified(dataModel);
} catch (final ServiceException e) { } catch (final ServiceException e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
...@@ -208,8 +208,8 @@ public class IndexProcessor { ...@@ -208,8 +208,8 @@ public class IndexProcessor {
final Map<String, String> langs = langPropsService.getAll(Latkes.getLocale()); final Map<String, String> langs = langPropsService.getAll(Latkes.getLocale());
dataModel.putAll(langs); dataModel.putAll(langs);
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
filler.fillMinified(dataModel); dataModelService.fillMinified(dataModel);
} catch (final ServiceException e) { } catch (final ServiceException e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
......
...@@ -39,7 +39,7 @@ import org.b3log.solo.SoloServletListener; ...@@ -39,7 +39,7 @@ import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.UserExt; import org.b3log.solo.model.UserExt;
import org.b3log.solo.processor.console.ConsoleRenderer; import org.b3log.solo.processor.console.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.InitService; import org.b3log.solo.service.InitService;
import org.b3log.solo.util.Thumbnails; import org.b3log.solo.util.Thumbnails;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -72,10 +72,10 @@ public class InitProcessor { ...@@ -72,10 +72,10 @@ public class InitProcessor {
private InitService initService; private InitService initService;
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Language service. * Language service.
...@@ -110,7 +110,7 @@ public class InitProcessor { ...@@ -110,7 +110,7 @@ public class InitProcessor {
dataModel.put(Common.STATIC_RESOURCE_VERSION, Latkes.getStaticResourceVersion()); dataModel.put(Common.STATIC_RESOURCE_VERSION, Latkes.getStaticResourceVersion());
dataModel.put(Common.YEAR, String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); dataModel.put(Common.YEAR, String.valueOf(Calendar.getInstance().get(Calendar.YEAR)));
Keys.fillRuntime(dataModel); Keys.fillRuntime(dataModel);
filler.fillMinified(dataModel); dataModelService.fillMinified(dataModel);
} }
/** /**
......
...@@ -45,7 +45,7 @@ import org.b3log.solo.SoloServletListener; ...@@ -45,7 +45,7 @@ import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.processor.console.ConsoleRenderer; import org.b3log.solo.processor.console.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.repository.OptionRepository; import org.b3log.solo.repository.OptionRepository;
import org.b3log.solo.service.*; import org.b3log.solo.service.*;
import org.b3log.solo.util.Mails; import org.b3log.solo.util.Mails;
...@@ -100,10 +100,10 @@ public class LoginProcessor { ...@@ -100,10 +100,10 @@ public class LoginProcessor {
private LangPropsService langPropsService; private LangPropsService langPropsService;
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Preference query service. * Preference query service.
...@@ -467,7 +467,7 @@ public class LoginProcessor { ...@@ -467,7 +467,7 @@ public class LoginProcessor {
} }
Keys.fillRuntime(dataModel); Keys.fillRuntime(dataModel);
filler.fillMinified(dataModel); dataModelService.fillMinified(dataModel);
} }
/** /**
......
...@@ -31,7 +31,7 @@ import org.b3log.latke.util.Stopwatchs; ...@@ -31,7 +31,7 @@ import org.b3log.latke.util.Stopwatchs;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Page; import org.b3log.solo.model.Page;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.CommentQueryService; import org.b3log.solo.service.CommentQueryService;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.StatisticMgmtService; import org.b3log.solo.service.StatisticMgmtService;
...@@ -67,10 +67,10 @@ public class PageProcessor { ...@@ -67,10 +67,10 @@ public class PageProcessor {
private LangPropsService langPropsService; private LangPropsService langPropsService;
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Preference query service. * Preference query service.
...@@ -142,7 +142,7 @@ public class PageProcessor { ...@@ -142,7 +142,7 @@ public class PageProcessor {
Stopwatchs.end(); Stopwatchs.end();
} }
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
......
...@@ -36,7 +36,7 @@ import org.b3log.solo.model.Article; ...@@ -36,7 +36,7 @@ import org.b3log.solo.model.Article;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.processor.console.ConsoleRenderer; import org.b3log.solo.processor.console.ConsoleRenderer;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.ArticleQueryService; import org.b3log.solo.service.ArticleQueryService;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.UserQueryService; import org.b3log.solo.service.UserQueryService;
...@@ -91,10 +91,10 @@ public class SearchProcessor { ...@@ -91,10 +91,10 @@ public class SearchProcessor {
private LangPropsService langPropsService; private LangPropsService langPropsService;
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Shows opensearch.xml. * Shows opensearch.xml.
...@@ -155,8 +155,8 @@ public class SearchProcessor { ...@@ -155,8 +155,8 @@ public class SearchProcessor {
try { try {
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
filler.fillCommon(request, context.getResponse(), dataModel, preference); dataModelService.fillCommon(request, context.getResponse(), dataModel, preference);
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
dataModel.put(Article.ARTICLES, articles); dataModel.put(Article.ARTICLES, articles);
final JSONObject pagination = result.optJSONObject(Pagination.PAGINATION); final JSONObject pagination = result.optJSONObject(Pagination.PAGINATION);
......
...@@ -36,7 +36,7 @@ import org.b3log.solo.model.Article; ...@@ -36,7 +36,7 @@ import org.b3log.solo.model.Article;
import org.b3log.solo.model.Common; import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Tag; import org.b3log.solo.model.Tag;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.*; import org.b3log.solo.service.*;
import org.b3log.solo.util.Skins; import org.b3log.solo.util.Skins;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -64,10 +64,10 @@ public class TagProcessor { ...@@ -64,10 +64,10 @@ public class TagProcessor {
private static final Logger LOGGER = Logger.getLogger(TagProcessor.class); private static final Logger LOGGER = Logger.getLogger(TagProcessor.class);
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Language service. * Language service.
...@@ -159,7 +159,7 @@ public class TagProcessor { ...@@ -159,7 +159,7 @@ public class TagProcessor {
return; return;
} }
filler.setArticlesExProperties(request, articles, preference); dataModelService.setArticlesExProperties(request, articles, preference);
final int tagArticleCount = tag.getInt(Tag.TAG_PUBLISHED_REFERENCE_COUNT); final int tagArticleCount = tag.getInt(Tag.TAG_PUBLISHED_REFERENCE_COUNT);
final int pageCount = (int) Math.ceil((double) tagArticleCount / (double) pageSize); final int pageCount = (int) Math.ceil((double) tagArticleCount / (double) pageSize);
...@@ -171,7 +171,7 @@ public class TagProcessor { ...@@ -171,7 +171,7 @@ public class TagProcessor {
dataModel.put(Common.PATH, "/tags/" + URLEncoder.encode(tagTitle, "UTF-8")); dataModel.put(Common.PATH, "/tags/" + URLEncoder.encode(tagTitle, "UTF-8"));
dataModel.put(Keys.OBJECT_ID, tagId); dataModel.put(Keys.OBJECT_ID, tagId);
dataModel.put(Tag.TAG, tag); dataModel.put(Tag.TAG, tag);
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
......
...@@ -31,7 +31,7 @@ import org.b3log.latke.servlet.annotation.RequestProcessor; ...@@ -31,7 +31,7 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
import org.b3log.latke.servlet.renderer.AbstractFreeMarkerRenderer; import org.b3log.latke.servlet.renderer.AbstractFreeMarkerRenderer;
import org.b3log.latke.util.Locales; import org.b3log.latke.util.Locales;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
import org.b3log.solo.service.StatisticMgmtService; import org.b3log.solo.service.StatisticMgmtService;
import org.b3log.solo.util.Skins; import org.b3log.solo.util.Skins;
...@@ -61,10 +61,10 @@ public class UserTemplateProcessor { ...@@ -61,10 +61,10 @@ public class UserTemplateProcessor {
private static final Logger LOGGER = Logger.getLogger(ArticleProcessor.class); private static final Logger LOGGER = Logger.getLogger(ArticleProcessor.class);
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Preference query service. * Preference query service.
...@@ -117,8 +117,8 @@ public class UserTemplateProcessor { ...@@ -117,8 +117,8 @@ public class UserTemplateProcessor {
final Map<String, String> langs = langPropsService.getAll(Locales.getLocale(request)); final Map<String, String> langs = langPropsService.getAll(Locales.getLocale(request));
dataModel.putAll(langs); dataModel.putAll(langs);
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
filler.fillCommon(request, response, dataModel, preference); dataModelService.fillCommon(request, response, dataModel, preference);
filler.fillUserTemplate(request, template, dataModel, preference); dataModelService.fillUserTemplate(request, template, dataModel, preference);
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
statisticMgmtService.incBlogViewCount(request, response); statisticMgmtService.incBlogViewCount(request, response);
} catch (final Exception e) { } catch (final Exception e) {
......
...@@ -49,7 +49,7 @@ import org.b3log.solo.model.Common; ...@@ -49,7 +49,7 @@ import org.b3log.solo.model.Common;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.b3log.solo.model.Skin; import org.b3log.solo.model.Skin;
import org.b3log.solo.model.UserExt; import org.b3log.solo.model.UserExt;
import org.b3log.solo.processor.util.Filler; import org.b3log.solo.service.DataModelService;
import org.b3log.solo.service.ExportService; import org.b3log.solo.service.ExportService;
import org.b3log.solo.service.OptionQueryService; import org.b3log.solo.service.OptionQueryService;
import org.b3log.solo.service.PreferenceQueryService; import org.b3log.solo.service.PreferenceQueryService;
...@@ -116,10 +116,10 @@ public class AdminConsole { ...@@ -116,10 +116,10 @@ public class AdminConsole {
private ExportService exportService; private ExportService exportService;
/** /**
* Filler. * DataModelService.
*/ */
@Inject @Inject
private Filler filler; private DataModelService dataModelService;
/** /**
* Event manager. * Event manager.
...@@ -176,7 +176,7 @@ public class AdminConsole { ...@@ -176,7 +176,7 @@ public class AdminConsole {
dataModel.put(Option.ID_C_EDITOR_TYPE, preference.getString(Option.ID_C_EDITOR_TYPE)); dataModel.put(Option.ID_C_EDITOR_TYPE, preference.getString(Option.ID_C_EDITOR_TYPE));
dataModel.put(Skin.SKIN_DIR_NAME, preference.getString(Skin.SKIN_DIR_NAME)); dataModel.put(Skin.SKIN_DIR_NAME, preference.getString(Skin.SKIN_DIR_NAME));
Keys.fillRuntime(dataModel); Keys.fillRuntime(dataModel);
filler.fillMinified(dataModel); dataModelService.fillMinified(dataModel);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, "Admin index render failed", e); LOGGER.log(Level.ERROR, "Admin index render failed", e);
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package org.b3log.solo.processor.util; package org.b3log.solo.service;
import freemarker.template.Template; import freemarker.template.Template;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -39,8 +39,9 @@ import org.b3log.latke.service.annotation.Service; ...@@ -39,8 +39,9 @@ import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.util.*; import org.b3log.latke.util.*;
import org.b3log.solo.SoloServletListener; import org.b3log.solo.SoloServletListener;
import org.b3log.solo.model.*; import org.b3log.solo.model.*;
import org.b3log.solo.processor.util.FillTagArticles;
import org.b3log.solo.processor.util.TopBars;
import org.b3log.solo.repository.*; import org.b3log.solo.repository.*;
import org.b3log.solo.service.*;
import org.b3log.solo.util.*; import org.b3log.solo.util.*;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -54,7 +55,7 @@ import java.util.*; ...@@ -54,7 +55,7 @@ import java.util.*;
import static org.b3log.solo.model.Article.ARTICLE_CONTENT; import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
/** /**
* Filler utilities. * DataModelService utilities.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
...@@ -62,12 +63,12 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT; ...@@ -62,12 +63,12 @@ import static org.b3log.solo.model.Article.ARTICLE_CONTENT;
* @since 0.3.1 * @since 0.3.1
*/ */
@Service @Service
public class Filler { public class DataModelService {
/** /**
* Logger. * Logger.
*/ */
private static final Logger LOGGER = Logger.getLogger(Filler.class); private static final Logger LOGGER = Logger.getLogger(DataModelService.class);
/** /**
* {@code true} for published. * {@code true} for published.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment