/* method initializes Issue fields */ private Issue initIssue(HttpServletRequest req, String issueID) throws LogicException { FeatureLogic fl = new FeatureLogic(); IssueLogic il = new IssueLogic(); Project project = new Project(); Build build = new Build(); HttpSession session = req.getSession(false); Member modifiedBy = (Member) session.getAttribute("member"); project.setId(Integer.parseInt(req.getParameter(PARAM_PROJECT))); build.setId(Integer.parseInt(req.getParameter(PARAM_BUILD))); Issue issue = il.issueToView(Integer.parseInt(issueID)); issue.setModifiedBy(modifiedBy); issue.setSummary(req.getParameter(PARAM_SUMMARY)); issue.setDescription(req.getParameter(PARAM_DESC)); issue.setStatus(fl.findFeature(STATUS, Integer.parseInt(req.getParameter(PARAM_STATUS)))); issue.setType(fl.findFeature(TYPE, Integer.parseInt(req.getParameter(PARAM_TYPE)))); issue.setPriority(fl.findFeature(PRIORITY, Integer.parseInt(req.getParameter(PARAM_PRIORITY)))); issue.setProject(project); issue.setBuild(build); if (req.getParameter(PARAM_ASSIGNEE) != null) { Member member = new Member(); member.setId(Integer.parseInt(req.getParameter(PARAM_ASSIGNEE))); issue.setAssignee(member); } return issue; }
/* * method sets the lists of Types, Statuses, Builds, etc. as the * corresponding attributes to request */ private void setFieldsToRequest(HttpServletRequest request) throws LogicException { IssueLogic il = new IssueLogic(); FeatureLogic fl = new FeatureLogic(); List<Feature> statuses = new ArrayList<>(); String issueID = request.getParameter(PARAM_ISSUE_ID); il.setFieldsToRequest(request); Issue issue = il.issueToView(Integer.parseInt(issueID)); if (issue.getStatus().getId() != 1) { statuses.add(fl.findFeature(STATUS, 3)); statuses.add(fl.findFeature(STATUS, 2)); } else { statuses.add(fl.findFeature(STATUS, 1)); statuses.add(fl.findFeature(STATUS, 2)); } request.setAttribute("issueID", issueID); request.setAttribute("statuses", statuses); setOtherIssueFields(request, issue); }
/* method sets various Issue fields to request */ private void setOtherIssueFields(HttpServletRequest req, Issue issue) { req.setAttribute("createdDate", issue.getCreatedDate()); req.setAttribute("createdBy", issue.getCreatedBy()); req.setAttribute("modifiedDate", issue.getModifiedDate()); req.setAttribute("modifiedBy", issue.getModifiedBy()); req.setAttribute("summary", issue.getSummary()); req.setAttribute("desc", issue.getDescription()); }