use of model.Page in project manifoldcf by apache.
the class ConfluenceRepositoryConnector method processSeedAttachments.
/**
* <p>
* Process seed attachments for the given page
* </p>
*
* @param page
* @param activities
*/
private void processSeedAttachments(final Page page, final ISeedingActivity activities) throws ManifoldCFException, ServiceInterruption {
long lastStart = 0;
final long defaultSize = 50;
if (Logging.connectors != null && Logging.connectors.isDebugEnabled()) {
Logging.connectors.debug(new MessageFormat("Processing page {} attachments starting from {} and size {}", Locale.ROOT).format(new Object[] { page.getId(), lastStart, defaultSize }));
}
try {
Boolean isLast = true;
do {
final ConfluenceResponse<Attachment> response = confluenceClient.getPageAttachments(page.getId(), (int) lastStart, (int) defaultSize);
int count = 0;
for (final Page resultPage : response.getResults()) {
activities.addSeedDocument(ConfluenceUtil.generateRepositoryDocumentIdentifier(resultPage.getId(), page.getId()));
count++;
}
if (Logging.connectors != null && Logging.connectors.isDebugEnabled()) {
Logging.connectors.debug(new MessageFormat("Fetched and added {} seed document attachments for page {}", Locale.ROOT).format(new Object[] { new Integer(count), page.getId() }));
}
lastStart += count;
isLast = response.isLast();
if (Logging.connectors != null && Logging.connectors.isDebugEnabled()) {
Logging.connectors.debug(new MessageFormat("New start {0} and size {1}", Locale.ROOT).format(new Object[] { lastStart, defaultSize }));
}
} while (!isLast);
} catch (final Exception e) {
handleConfluenceDownException(e, "seeding");
}
}
use of 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);
}
use of 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;
}
use of 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;
}
use of 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);
}
Aggregations