Search in sources :

Example 16 with Page

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Page in project BookShop by Eins51.

the class GoodsService method getSearchGoodsPage.

public Page getSearchGoodsPage(String keyword, int pageNumber) {
    Page p = new Page();
    p.setPageNumber(pageNumber);
    int totalCount = 0;
    try {
        // totalCount = gDao.getGoodsCount(typeId);
        totalCount = gDao.getSearchCount(keyword);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    p.SetPageSizeAndTotalCount(8, totalCount);
    List list = null;
    try {
        // list = gDao.selectGoods(keyword, pageNo, 8);
        list = gDao.selectSearchGoods(keyword, pageNumber, 8);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    p.setList(list);
    return p;
}
Also used : SQLException(java.sql.SQLException) Page(model.Page) List(java.util.List)

Example 17 with Page

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Page in project BookShop by Eins51.

the class GoodsService method getGoodsRecommendPage.

public Page getGoodsRecommendPage(int type, int pageNumber) {
    Page p = new Page();
    p.setPageNumber(pageNumber);
    int totalCount = 0;
    try {
        totalCount = gDao.getRecommendCountOfGoodsByTypeID(type);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    p.SetPageSizeAndTotalCount(8, totalCount);
    List list = null;
    try {
        list = gDao.selectGoodsbyRecommend(type, pageNumber, 8);
        for (Goods g : (List<Goods>) list) {
            g.setScroll(gDao.isScroll(g));
            g.setHot(gDao.isHot(g));
            g.setNew(gDao.isNew(g));
        }
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    p.setList(list);
    return p;
}
Also used : SQLException(java.sql.SQLException) Page(model.Page) List(java.util.List) Goods(model.Goods)

Example 18 with Page

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Page in project BookShop by Eins51.

the class AdminUserListServlet method doGet.

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    int pageNumber = 1;
    if (request.getParameter("pageNumber") != null) {
        try {
            pageNumber = Integer.parseInt(request.getParameter("pageNumber"));
        } catch (Exception e) {
        }
    }
    if (pageNumber <= 0)
        pageNumber = 1;
    Page p = uService.getUserPage(pageNumber);
    if (p.getTotalPage() == 0) {
        p.setTotalPage(1);
        p.setPageNumber(1);
    } else {
        if (pageNumber >= p.getTotalPage() + 1) {
            p = uService.getUserPage(pageNumber);
        }
    }
    request.setAttribute("p", p);
    request.getRequestDispatcher("/admin/user_list.jsp").forward(request, response);
}
Also used : Page(model.Page) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 19 with Page

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Page in project BookShop by Eins51.

the class GoodRecommendListServlet method doGet.

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    int type = Integer.parseInt(request.getParameter("type"));
    int pageNumber = 1;
    if (request.getParameter("pageNumber") != null) {
        try {
            pageNumber = Integer.parseInt(request.getParameter("pageNumber"));
        } catch (Exception e) {
        }
    }
    if (pageNumber <= 0)
        pageNumber = 1;
    Page p = gService.getGoodsRecommendPage(type, pageNumber);
    if (p.getTotalPage() == 0) {
        p.setTotalPage(1);
        p.setPageNumber(1);
    } else {
        if (pageNumber >= p.getTotalPage() + 1) {
            p = gService.getGoodsRecommendPage(type, p.getTotalPage());
        }
    }
    request.setAttribute("p", p);
    request.setAttribute("t", type);
    request.getRequestDispatcher("goodsrecommend_list.jsp").forward(request, response);
}
Also used : Page(model.Page) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 20 with Page

use of org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Page in project BookShop by Eins51.

the class AdminOrderListServlet method doGet.

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    int status = 0;
    if (request.getParameter("status") != null) {
        status = Integer.parseInt(request.getParameter("status"));
    }
    request.setAttribute("status", status);
    int pageNumber = 1;
    if (request.getParameter("pageNumber") != null) {
        try {
            pageNumber = Integer.parseInt(request.getParameter("pageNumber"));
        } catch (Exception e) {
        }
    }
    if (pageNumber <= 0)
        pageNumber = 1;
    Page p = oService.getOrderPage(status, pageNumber);
    if (p.getTotalPage() == 0) {
        p.setTotalPage(1);
        p.setPageNumber(1);
    } else {
        if (pageNumber >= p.getTotalPage() + 1) {
            p = oService.getOrderPage(status, pageNumber);
        }
    }
    request.setAttribute("p", p);
    request.getRequestDispatcher("/admin/order_list.jsp").forward(request, response);
}
Also used : Page(model.Page) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)14 Page (model.Page)9 ManifoldCFException (org.apache.manifoldcf.core.interfaces.ManifoldCFException)9 List (java.util.List)5 ServletException (javax.servlet.ServletException)5 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)5 ConfluenceException (org.apache.manifoldcf.crawler.connectors.confluence.v6.exception.ConfluenceException)5 JSONObject (org.json.simple.JSONObject)5 InterruptedIOException (java.io.InterruptedIOException)4 SQLException (java.sql.SQLException)4 HttpGet (org.apache.http.client.methods.HttpGet)4 Page (org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Page)4 ParseException (org.json.simple.parser.ParseException)4 MessageFormat (java.text.MessageFormat)3 ArrayList (java.util.ArrayList)2 HttpEntity (org.apache.http.HttpEntity)2 Attachment (org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment)2 MutablePage (org.apache.manifoldcf.crawler.connectors.confluence.v6.model.MutablePage)2 StringReader (java.io.StringReader)1 DateFormat (java.text.DateFormat)1