/** * Update foreign key of attachment Info * * @param mapping ActionMapping * @param form ActionForm * @param request HttpServletRequest * @param response HttpServletResponse */ public void updateForeignKey( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { String attacheId = request.getParameter("attachId"); String foreignKey = request.getParameter("foreignKey"); // AttachedInfoBo aibo = new AttachedInfoBo(); AttachedInfoForm aif = attachedInfoBo.find(attacheId); aif.setForeignId(new Long(foreignKey)); HttpSession session = request.getSession(); aif.setUpdateBy((Long) session.getAttribute("userId")); aif.setUpdateDate( new Timestamp( ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate().getTime())); String strXml = "false"; if (attachedInfoBo.modify(aif) == 1) { strXml = "true"; } } catch (Exception e) { e.printStackTrace(); } }
/** * Delete files of attachment Info * * @param mapping ActionMapping * @param form ActionForm * @param request HttpServletRequest * @param response HttpServletResponse */ public void fileDel( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { String attacheId = request.getParameter("attacheId"); // AttachedInfoBo aibo = new AttachedInfoBo(); String strXml = "false"; if (attachedInfoBo.fileDel(attacheId, "virtualName")) { strXml = "true"; } /* PrintWriter writer = response.getWriter(); response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); writer.println("<xml>"); writer.println("<ifUse>"+strXml+"</ifUse>"); writer.println("</xml>"); writer.flush(); writer.close(); */ } catch (Exception e) { e.printStackTrace(); } }
/** * Delete attachment Info maintenance record page * * @param request HttpServletRequest * @param form ActionForm Data form * @return String Return deletion page,forward = "attachedInfoAlert" */ public String attachedInfoDelete(HttpServletRequest request, ActionForm form) { String forward = "attachedInfoAlert"; int tag = -1; try { String chkId = request.getParameter("id"); String[] idList = null; if (chkId != null && !chkId.equals("")) { idList = chkId.split(","); if (idList.length > 0) { // AttachedInfoBo ubo = new AttachedInfoBo(); if (attachedInfoBo.delete(idList) == 1) { tag = 1; } } } request.setAttribute("tag", tag + ""); request.setAttribute("state", "delete"); } catch (Exception e) { e.printStackTrace(); } return forward; }
/** * View attachment Info list * * @param request HttpServletRequest * @param form ActionForm Data form * @return String Return attachment Info,forward = "attachedInfoList" */ public String attachedInfoList(HttpServletRequest request, ActionForm form) { String forward = "attachedInfoList"; try { AttachedInfoForm uf = (AttachedInfoForm) form; // AttachedInfoBo ubo = new AttachedInfoBo(); request.setAttribute("attachedInfoList", attachedInfoBo.list(uf)); } catch (Exception e) { e.printStackTrace(); } return forward; }
/** * Modify attachemnt Info record * * @param request HttpServletRequest * @param form ActionForm Data form * @return Return modification page,forward = "attachedInfoAlert" */ public String attachedInfoModify(HttpServletRequest request, ActionForm form) { String forward = "attachedInfoAlert"; int tag = -1; try { // AttachedInfoBo ubo = new AttachedInfoBo(); AttachedInfoForm attachedInfoForm = (AttachedInfoForm) form; attachedInfoForm.setUpdateBy(new Long(0)); attachedInfoForm.setUpdateDate( new Timestamp( ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate().getTime())); tag = attachedInfoBo.modify(attachedInfoForm); request.setAttribute("attachedInfoForm", attachedInfoForm); request.setAttribute("state", "modify"); request.setAttribute("tag", tag + ""); } catch (Exception e) { e.printStackTrace(); } return forward; }
/** * Add attachment Info record * * @param request HttpServletRequest * @param form ActionForm Data form * @return String Return attachment Info list,forward = "attachedInfoAlert" */ public String attachedInfoAdd(HttpServletRequest request, ActionForm form) { String forward = "attachedInfoAlert"; int tag = -1; try { AttachedInfoForm uf = (AttachedInfoForm) form; // AttachedInfoBo ubo = new AttachedInfoBo(); uf.setCreateBy(new Long(0)); uf.setCreateDate( new Timestamp( ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate().getTime())); tag = attachedInfoBo.add(uf); request.setAttribute("tag", tag + ""); request.setAttribute("state", "add"); } catch (Exception e) { e.printStackTrace(); } return forward; }
/** * Modify attachment Info * * @param request HttpServletRequest * @param form ActionForm Data form * @return String Return addition page,forward = "AttachedInfoEdit" */ public String modifyInit(HttpServletRequest request, ActionForm form) { String forward = "addInit"; try { String chkId = (String) request.getParameter("id"); chkId = chkId.trim(); DepartmentForm departmentForm = new DepartmentForm(); DepartmentQuery departmentQuery = new DepartmentQuery(departmentForm); request.setAttribute( "allDepartments", departmentQuery.doListQuery(departmentForm.getFromPage(), departmentForm.getToPage())); if (chkId != null && !chkId.equals("")) { // AttachedInfoBo bo = new AttachedInfoBo(); request.setAttribute("attachedInfoForm", attachedInfoBo.find(chkId)); } } catch (Exception e) { e.printStackTrace(); } request.setAttribute("state", "modify"); return forward; }
/** * Query attachment Info details * * @param request HttpServletRequest * @param form ActionForm Data form * @return String Return attachemnt Info details,forward = "AttachedInfoEdit" */ public String attachedInfoDetail(HttpServletRequest request, ActionForm form) { String forward = "addInit"; try { String chkId = (String) request.getParameter("id"); chkId = chkId.trim(); AttachedInfoForm attachedInfoForm = null; if (chkId != null && !chkId.equals("")) { // AttachedInfoBo ubo = new AttachedInfoBo(); attachedInfoForm = attachedInfoBo.find(chkId); request.setAttribute("attachedInfoForm", attachedInfoForm); } request.setAttribute("attachedInfoForm", attachedInfoForm); request.setAttribute("state", "detail"); } catch (Exception e) { e.printStackTrace(); } return forward; }