Package com.multysite.model

Examples of com.multysite.model.NewsModel


      } catch (Exception e) {
        cached = false;
      }
      if (cached) {
        if (result.size() >= 11) {
          NewsModel model = new NewsModel();
          model.setLimit(10);
          model.setPage(1);
          model.prepareList();
          if (model.getListResult().size() > 0) {
            result = model.getListResult();
          }
          cache.put(prefix, result);
        }
      }
    }
    if (!cached) {
      NewsModel model = new NewsModel();
      model.setLimit(10);
      model.setPage(1);
      model.prepareList();
      if (model.getListResult().size() > 0) {
        result = model.getListResult();
        cache.put(prefix, result);
      } else {
        result = new ArrayList<News>();
      }
View Full Code Here


      ApplicationTemplate template = (ApplicationTemplate) req
          .getAttribute("template");
      ApplicationConfig config = (ApplicationConfig) req
          .getAttribute("config");
      if (template != null && config != null) {
        NewsModel model = new NewsModel();
        model.setLimit(500);
        model.prepareList();       
        req.setAttribute("model", model);
        req.setAttribute("url", req.getRequestURL().toString());
        req.getRequestDispatcher("/site-map.jsp").forward(req, resp);
      } else {
        NamespaceManager.set(Setting.getGeneralNamespace());
View Full Code Here

            page = Integer.parseInt((String) req
                .getParameter("page"));
          } catch (Exception e) {
            page = 1;
          }
          NewsModel model = new NewsModel();
          model.setPage(page);
          model.prepareList();
          CategoryModel cateModel = new CategoryModel();
          cateModel.prepareAll();
          TagModel tagModel = new TagModel();
          tagModel.prepareList();

          CompiledScript compiledscript = CompileScriptEngine
              .getCompileScript(config.getApplicationId(),
                  "home", template.getHome());
          if (compiledscript != null) {
            Bindings bind = compiledscript.getEngine().getBindings(
                ScriptContext.ENGINE_SCOPE);
            bind.put("title_for_layout", config.getTitle());
            bind.put("description_for_layout",
                config.getDescription());
            bind.put("keyword_for_layout", config.getKeyword());
            bind.put("css_for_layout", template.getCss());
            bind.put("js_for_layout", template.getJs());

            bind.put("recent_view",
                RecentViewHelper.getRecentView());
            bind.put("list_tag", tagModel.getListResult());
            bind.put("list_category", cateModel.getListResult());

            bind.put("current_page", model.getPage());
            bind.put("total_page", model.getTotalPage());
            bind.put("articles", model.getListResult());
            try {
              resp.getWriter().print(
                  (String) compiledscript.eval());
            } catch (Exception e) {
              e.printStackTrace();
View Full Code Here

        try {
          page = Integer.parseInt((String) req.getParameter("page"));
        } catch (Exception e) {
          page = 1;
        }
        NewsModel model = new NewsModel();
        model.setPage(page);
        model.setLimit(10);
        model.prepareList();
        req.setAttribute("model", model);
        req.getRequestDispatcher("/admin/pages/news-list.jsp").forward(
            req, resp);
      } else {
        resp.getWriter().println("Invalid Url");
View Full Code Here

      ApplicationTemplate template = (ApplicationTemplate) req
          .getAttribute("template");
      ApplicationConfig config = (ApplicationConfig) req
          .getAttribute("config");
      if (template != null && config != null) {
        NewsModel model = new NewsModel();
        model.setLimit(500);
        model.prepareList();
        req.setAttribute("config", config);
        req.setAttribute("model", model);
        req.setAttribute("url", req.getRequestURL().toString());
        req.getRequestDispatcher("/rss.jsp").forward(req, resp);
      } else {
View Full Code Here

        .println("Remove " + count + " document from Index success !");
  }

  public static void reindex() {
    int count = 0;
    NewsModel model = new NewsModel();
    model.setPage(1);
    while (true) {
      model.setLimit(20);
      model.prepareList();
      List<News> list = model.getListResult();
      for (News obj : list) {
        index(obj);
        count++;
      }
      if (list.size() < 20) {
        break;
      }
      model.setPage(model.getPage() + 1);
    }
    System.out.println("Index " + count
        + " document from Tube table success !");
  }
View Full Code Here

                  .getParameter("page"));
            } catch (Exception e) {
              page = 1;
            }
            List<News> listNews = new ArrayList<News>();
            NewsModel model = new NewsModel();
            model.setPage(page);
            model.prepareListByCategory(categoryAlias);
            listNews = model.getListResult();
            CategoryModel cateModel = new CategoryModel();
            cateModel.prepareAll();
            TagModel tagModel = new TagModel();
            tagModel.prepareList();
            bind.put("recent_view",
                RecentViewHelper.getRecentView());
            bind.put("list_tag", tagModel.getListResult());
            bind.put("list_category", cateModel.getListResult());

            bind.put("category", obj);
            bind.put("current_page", model.getPage());
            bind.put("total_page", model.getTotalPage());
            bind.put("articles", listNews);
            try {
              resp.getWriter().print(
                  (String) compiledscript.eval());
            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.multysite.model.NewsModel

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.