public ActionForward delArticle( FormBean form, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.debug(">>> delArticle: begin"); delImageUpload((UploadImageBean) form, request.getSession()); logger.debug(">>> delArticle: eng"); return ActionForward.getAction( this, request, "index?page=CRUDArticle&t=t¶m=" + KTMCrypt.encrypt("method=list&module=article&pageNumber=" + form.getPageNumber()), true); }
public ActionForward editArticle( FormBean form, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); ArticleBean bean = (ArticleBean) form; ArticleTypeDao articleTypeDao = KTMEMDaoFactory.getInstance().getArticleTypeDao(); Collection<KTMEntity> articleTypes = articleTypeDao.findAll(); bean.getArticleTypeCollection().clear(); for (KTMEntity entity : articleTypes) { if (entity instanceof ArticleType) { ArticleType type = (ArticleType) entity; ArticleTypeBean typeBean = new ArticleTypeBean(); typeBean.loadToForm(type); bean.getArticleTypeCollection().add(typeBean); } } ArticleDao articleDao = KTMEMDaoFactory.getInstance().getArticleDao(); Article article = (Article) articleDao.get(Integer.parseInt(bean.getUniqueId())); if (article != null) { bean.loadToForm(article); session.setAttribute(ArticleBean.UNIQUD_ID, bean.getIdentifier()); session.setAttribute(bean.getIdentifier(), bean); try { bean.setDateModified(DateUtils.formatDate(new Date())); } catch (ParseException e) { e.printStackTrace(); } return ActionForward.getUri(this, request, "EditArticles.jsp"); } if (bean.getServlet() != null && bean.getServlet() instanceof CRUDArticleServlet) { ((CRUDArticleServlet) bean.getServlet()).resetAllCRUDCollection(session); } return ActionForward.getAction( this, request, "index?page=CRUDArticle&t=t¶m=" + KTMCrypt.encrypt("method=list&module=article&pageNumber=" + bean.getPageNumber()), true); }
public ActionForward saveArticle( FormBean form, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ArticleBean bean = (ArticleBean) form; try { doSaveImageUpload(bean, request); } catch (CreateException e) { e.printStackTrace(); } catch (DeleteException e) { e.printStackTrace(); } if (bean.getServlet() != null && bean.getServlet() instanceof CRUDArticleServlet) { ((CRUDArticleServlet) bean.getServlet()).resetAllCRUDCollection(request.getSession()); } return ActionForward.getAction( this, request, "index?page=CRUDArticle&t=t¶m=" + KTMCrypt.encrypt("method=list&module=article&pageNumber=" + bean.getPageNumber()), true); }