/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception Exception if business logic throws an exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need MessageResources messages = getResources(request); // save errors ActionMessages errors = new ActionMessages(); // START check for login (security) if (!SecurityService.getInstance().checkForLogin(request.getSession(false))) { return (mapping.findForward("welcome")); } // END check for login (security) // START get id of current quote from either request, attribute, or cookie // id of quote from request String quoteId = null; quoteId = request.getParameter("quoteViewId"); // check attribute in request if (quoteId == null) { quoteId = (String) request.getAttribute("quoteViewId"); } // id of quote from cookie if (quoteId == null) { quoteId = StandardCode.getInstance().getCookie("quoteViewId", request.getCookies()); } Integer id = Integer.valueOf(quoteId); // END get id of current quote from either request, attribute, or cookie // get quote to and then its sources Quote1 q = QuoteService.getInstance().getSingleQuote(id); // this quotes sources Set sources = q.getSourceDocs(); DynaValidatorForm qvgatd1 = (DynaValidatorForm) form; qvgatd1.set("sources", (SourceDoc[]) sources.toArray(new SourceDoc[0])); // place quote into attribute for dispaly request.setAttribute("quote", q); // Forward control to the specified success URI return (mapping.findForward("Success")); }
/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception Exception if business logic throws an exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need MessageResources messages = getResources(request); // save errors ActionMessages errors = new ActionMessages(); // START check for login (security) if (!SecurityService.getInstance().checkForLogin(request.getSession(false))) { return (mapping.findForward("welcome")); } // END check for login (security) // PRIVS check that hrAdmin user is viewing this page if (!StandardCode.getInstance() .checkPrivStringArray( (String[]) request.getSession(false).getAttribute("userPrivs"), "hrAdmin")) { return (mapping.findForward("accessDenied")); } // END PRIVS check that hrAdmin user is viewing this page // get the employee to edit from the request String hrAdminUserId = request.getParameter("hrAdminUserId"); User u = UserService.getInstance().getSingleUser(Integer.valueOf(hrAdminUserId)); // get new performance review values DynaValidatorForm ha = (DynaValidatorForm) form; String dueDate = (String) ha.get("dueDate"); String actualDate = (String) ha.get("actualDate"); String signedDate = (String) ha.get("signedDate"); PerformanceReview performanceReviewNew = (PerformanceReview) ha.get("performanceReviewNew"); if (dueDate.length() > 0) // if entered performanceReviewNew.setDueDate(DateService.getInstance().convertDate(dueDate).getTime()); if (actualDate.length() > 0) // if entered performanceReviewNew.setActualDate(DateService.getInstance().convertDate(actualDate).getTime()); if (signedDate.length() > 0) // if entered performanceReviewNew.setSignedDate(DateService.getInstance().convertDate(signedDate).getTime()); // add new performanceReview to the db UserService.getInstance().addPerformanceReview(performanceReviewNew, u); // Forward control to the specified success URI return (mapping.findForward("Success")); }
/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception Exception if business logic throws an exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need MessageResources messages = getResources(request); // save errors ActionMessages errors = new ActionMessages(); // START check for login (security) if (!SecurityService.getInstance().checkForLogin(request.getSession(false))) { return (mapping.findForward("welcome")); } // END check for login (security) // values for adding the related contact DynaValidatorForm qae2 = (DynaValidatorForm) form; // from wizard add clientContact String contactId = (String) request.getAttribute("clientContactViewId"); if (contactId == null) { contactId = (String) (qae2.get("contact")); } // need the project and contact to build the link between contact and project String projectId = StandardCode.getInstance().getCookie("projectAddId", request.getCookies()); Project p = ProjectService.getInstance().getSingleProject(Integer.valueOf(projectId)); ClientContact cc = ClientService.getInstance().getSingleClientContact(Integer.valueOf(contactId)); // insert into db, building link between contact and project ProjectService.getInstance().linkProjectClientContact(p, cc); // Forward control to the specified success URI return (mapping.findForward("Success")); }
/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception Exception if business logic throws an exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need MessageResources messages = getResources(request); // save errors ActionMessages errors = new ActionMessages(); // START check for login (security) if (!SecurityService.getInstance().checkForLogin(request.getSession(false))) { return (mapping.findForward("welcome")); } // END check for login (security) // START get id of current project from either request, attribute, or cookie // id of project from request String projectId = null; projectId = request.getParameter("projectViewId"); // check attribute in request if (projectId == null) { projectId = (String) request.getAttribute("projectViewId"); } // id of project from cookie if (projectId == null) { projectId = StandardCode.getInstance().getCookie("projectViewId", request.getCookies()); } // default project to last if not in request or cookie if (projectId == null) { List results = ProjectService.getInstance().getProjectList(); ListIterator iterScroll = null; for (iterScroll = results.listIterator(); iterScroll.hasNext(); iterScroll.next()) {} iterScroll.previous(); Project p = (Project) iterScroll.next(); projectId = String.valueOf(p.getProjectId()); } Integer id = Integer.valueOf(projectId); // END get id of current project from either request, attribute, or cookie // get project to edit Project p = ProjectService.getInstance().getSingleProject(id); // get this project's sources Set sources = p.getSourceDocs(); // for each source add each sources' Tasks List totalLinTasks = new ArrayList(); // for each source for (Iterator sourceIter = sources.iterator(); sourceIter.hasNext(); ) { SourceDoc sd = (SourceDoc) sourceIter.next(); // for each target of this source for (Iterator linTargetIter = sd.getTargetDocs().iterator(); linTargetIter.hasNext(); ) { TargetDoc td = (TargetDoc) linTargetIter.next(); // for each lin Task of this target for (Iterator linTaskIter = td.getLinTasks().iterator(); linTaskIter.hasNext(); ) { LinTask lt = (LinTask) linTaskIter.next(); if (lt.getPersonName() != null && lt.getDueDateDate() != null && (lt.getTaskName().equalsIgnoreCase("Translation") || lt.getTaskName().equalsIgnoreCase("Editing") || lt.getTaskName().trim().equalsIgnoreCase("Proofreading") || lt.getTaskName().equalsIgnoreCase("Proofreading / Linguistic QA"))) { totalLinTasks.add(lt); } System.out.println( sd.getLanguage() + "--------" + td.getLanguage() + "---------" + lt.getTaskName()); } } } // Sort by task (orderNum), then source (language), then target (language) Collections.sort(totalLinTasks, CompareTaskLin.getInstance()); Collections.sort(totalLinTasks, CompareTaskLanguages.getInstance()); // array for display in jsp LinTask[] linTasksArray = (LinTask[]) totalLinTasks.toArray(new LinTask[0]); for (int i = 0; i < totalLinTasks.size(); i++) { request.setAttribute(projectId, log); } // place all Tasks for this project into the form for display DynaValidatorForm qvg = (DynaValidatorForm) form; // HERE down is standard and does not need to change when adding task blocks // place this project into request for further display in jsp page request.setAttribute("project", p); // add this project id to cookies; this will remember the last project response.addCookie(StandardCode.getInstance().setCookie("projectViewId", projectId)); // add tab location to cookies; this will remember which tab we are at response.addCookie(StandardCode.getInstance().setCookie("projectViewTab", "Team")); // an update of totals may be required // Forward control to the specified success URI return (mapping.findForward("Success")); }
/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception Exception if business logic throws an exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need MessageResources messages = getResources(request); // save errors ActionMessages errors = new ActionMessages(); // START check for login (security) if (!SecurityService.getInstance().checkForLogin(request.getSession(false))) { return (mapping.findForward("welcome")); } // END check for login (security) // PRIVS check that hrAdmin user is viewing this page if (!StandardCode.getInstance() .checkPrivStringArray( (String[]) request.getSession(false).getAttribute("userPrivs"), "hrAdmin")) { return (mapping.findForward("accessDenied")); } // END PRIVS check that hrAdmin user is viewing this page // get user to edit from form hidden field String hrAdminUserId = request.getParameter("hrAdminUserId"); User u = UserService.getInstance().getSingleUser(Integer.valueOf(hrAdminUserId)); User currentUser = UserService.getInstance() .getSingleUser((String) request.getSession(false).getAttribute("username")); // values for update from form; change what is stored in db to these values DynaValidatorForm uvg = (DynaValidatorForm) form; String username = (String) uvg.get("username"); String password = (String) uvg.get("password"); // update the user's values if (username.length() > 0) { // if present u.setUsername(username); } if (password.length() > 0) { // if present, hash password for safe db store MessageDigest md = null; try { md = MessageDigest.getInstance("SHA"); // step 2 } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } try { md.update(password.getBytes("UTF-8")); // step 3 } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } byte raw[] = md.digest(); // step 4 String hash = (new BASE64Encoder()).encode(raw); // step 5 u.setPassword(hash); } // set updated values to db UserService.getInstance().updateUser(u); String firstName = u.getFirstName(); String msg = "<font size='2'><span style='font-family: Verdana,Arial,Helvetica,sans-serif;'>Dear <span style='color: rgb(255, 0, 0);'>" + firstName + "</span>,<br><br style='font-family: Verdana,Arial,Helvetica,sans-serif;'></span><span style='font-family: Verdana,Arial,Helvetica,sans-serif;'>We have created an account for you on ExcelNet, Excel Translations' proprietary intra/extranet system. <br><br> Below you will find the information you need to enter our system, please keep this only to yourself in a secure place. </span><br style='font-family: Verdana,Arial,Helvetica,sans-serif;'><span style='font-family: Verdana,Arial,Helvetica,sans-serif;'><br>User Name: " + username + "</span><br style='font-family: Verdana,Arial,Helvetica,sans-serif;'><span style='font-family: Verdana,Arial,Helvetica,sans-serif;'>Password : " + password + "</span><br style='font-family: Verdana,Arial,Helvetica,sans-serif;'><br style='font-family: Verdana,Arial,Helvetica,sans-serif;'><span style='font-family: Verdana,Arial,Helvetica,sans-serif;'>You can log in into your Account on by clicking </span><a style='font-family: Verdana,Arial,Helvetica,sans-serif;' href='http://excelnet.xltrans.com'>here</a><span style='font-family: Verdana,Arial,Helvetica,sans-serif;'>.<br><br><br>Best Regards,</span><br style='font-family: Verdana,Arial,Helvetica,sans-serif;'><br style='font-family: Verdana,Arial,Helvetica,sans-serif;'><span style='font-family: Verdana,Arial,Helvetica,sans-serif; Best regards,<br style='font-family: Verdana,Arial,Helvetica,sans-serif;'></font><font style='font-family: Verdana,Arial,Helvetica,sans-serif;' size='2'><span class='Apple-style-span' style='border-collapse: separate; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;'><span class='Apple-style-span' style='color: rgb(59, 105, 119); font-size: 11px; text-align: left;'><br> ExcelNet Administrator<br>Excel Translations, Inc.<br><br><img src=http://excelnet.xltrans.com/logo/images/-1168566039logoExcel.gif></span></span></font><br> "; String emailMsgTxt = msg; String emailSubjectTxt = "New User Account"; String adminEmail; String userEmailId = "*****@*****.**"; if (!u.getWorkEmail1().equalsIgnoreCase("")) { userEmailId = u.getWorkEmail1(); } else if (!u.getWorkEmail2().equalsIgnoreCase("")) { userEmailId = u.getWorkEmail2(); } else { userEmailId = "*****@*****.**"; } if (currentUser.getWorkEmail1() == null || currentUser.getWorkEmail1().equalsIgnoreCase("")) { adminEmail = "*****@*****.**"; } else adminEmail = currentUser.getWorkEmail1(); try { String[] emailList = {userEmailId, adminEmail}; SendEmail smtpMailSender = new SendEmail(); smtpMailSender.postMail(emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress); } catch (Exception e) { // String[] emailList = {"niteshwar.kumarpatialideas.com"}; // SendEmail smtpMailSender = new SendEmail(); // smtpMailSender.postMail( emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress); } // Forward control to the specified success URI return (mapping.findForward("Success")); }