Search in sources :

Example 6 with Page

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

the class GoodsListServlet method doGet.

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

Example 7 with Page

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

the class GoodsService method selectPageByTypeID.

public Page selectPageByTypeID(int typeID, int pageNumber) {
    Page p = new Page();
    p.setPageNumber(pageNumber);
    int totalCount = 0;
    try {
        totalCount = gDao.getCountOfGoodsByTypeID(typeID);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    p.SetPageSizeAndTotalCount(8, totalCount);
    List list = null;
    try {
        list = gDao.selectGoodsByTypeID(typeID, pageNumber, 8);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    p.setList(list);
    return p;
}
Also used : SQLException(java.sql.SQLException) Page(model.Page) List(java.util.List)

Example 8 with Page

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

the class UserService method getUserPage.

public Page getUserPage(int pageNumber) {
    Page p = new Page();
    p.setPageNumber(pageNumber);
    int pageSize = 7;
    int totalCount = 0;
    try {
        totalCount = uDao.selectUserCount();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    p.SetPageSizeAndTotalCount(pageSize, totalCount);
    List list = null;
    try {
        list = uDao.selectUserList(pageNumber, pageSize);
    } 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 9 with Page

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

the class AdminGoodsListServlet method doGet.

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // 推荐类型
    int type = 0;
    if (request.getParameter("type") != null) {
        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, pageNumber);
        }
    }
    request.setAttribute("p", p);
    request.setAttribute("type", type);
    request.getRequestDispatcher("/admin/goods_list.jsp").forward(request, response);
}
Also used : Page(model.Page) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 10 with Page

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

the class ConfluenceRepositoryConnector method processPageAsAttachment.

/**
 * <p>
 * Process the specific attachment
 * </p>
 *
 * @param activeSecurity     Security enabled/disabled
 * @param documentIdentifier The original documentIdentifier
 * @param parentRestrictions The list of parent restrictions
 * @param pageId             The pageId being an attachment
 * @param version            The version of the page
 * @param activities
 * @param doLog
 * @throws IOException
 * @throws ServiceInterruption
 */
private ProcessResult processPageAsAttachment(final boolean activeSecurity, final String documentIdentifier, final List<String> parentRestrictions, final String pageId, final String version, final IProcessActivity activities, final boolean doLog) throws ManifoldCFException, ServiceInterruption, IOException {
    final String[] ids = ConfluenceUtil.getAttachmentAndPageId(pageId);
    Attachment attachment = new Attachment();
    try {
        attachment = confluenceClient.getAttachment(ids[0]);
    } catch (final Exception e) {
        handlePageException(e, "attachment processing");
    }
    final Map<String, String> extraProperties = Maps.newHashMap();
    extraProperties.put("attachedBy", ids[1]);
    return processPageInternal(activeSecurity, parentRestrictions, attachment, documentIdentifier, version, activities, doLog, extraProperties);
}
Also used : Attachment(org.apache.manifoldcf.crawler.connectors.confluence.v6.model.Attachment) InterruptedIOException(java.io.InterruptedIOException) ParseException(org.json.simple.parser.ParseException) ManifoldCFException(org.apache.manifoldcf.core.interfaces.ManifoldCFException) 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