List of usage examples for javax.servlet RequestDispatcher forward
public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException;
From source file:com.krawler.spring.iphone.iphoneController.java
private String sendMail(HttpServletRequest request, HttpServletResponse response) throws JSONException { String result = null;/* w w w . ja v a2 s . c o m*/ try { DiskFileUpload fu = new DiskFileUpload(); java.util.List fileItems = null; String imageName = ""; fileItems = fu.parseRequest(request); java.util.HashMap arrParam = new java.util.HashMap(); java.util.Iterator k = null; for (k = fileItems.iterator(); k.hasNext();) { FileItem fi1 = (FileItem) k.next(); arrParam.put(fi1.getFieldName(), fi1.getString()); } String to = request.getParameter("mailto"); String from = request.getParameter("from"); String accountid = StringUtil.serverHTMLStripper( arrParam.get("from").toString().replaceAll("[^\\w|\\s|'|\\-|\\[|\\]|\\(|\\)]", "").trim()); String subject = StringUtil.serverHTMLStripper( arrParam.get("subject").toString().replaceAll("[^\\w|\\s|'|\\-|\\[|\\]|\\(|\\)]", "").trim()); String body = arrParam.get("body").toString();//StringUtil.serverHTMLStripper(arrParam.get("body").toString().replaceAll("[^\\w|\\s|'|\\-|\\[|\\]|\\(|\\)]", "").trim()); String addressFrom1 = URLEncoder.encode(accountid, "ISO-8859-1"); String fromAccount = URLEncoder.encode(accountid, "ISO-8859-1"); String sendDescription = URLEncoder.encode(body, "ISO-8859-1"); String sendSubject = URLEncoder.encode(subject, "ISO-8859-1"); String sendTo = URLEncoder.encode(to, "ISO-8859-1"); String subject1 = URLEncoder.encode(subject, "ISO-8859-1"); String Url = "action=EmailUIAjax&addressFrom1=" + addressFrom1 + "&addressTo1=" + sendTo + "&composeType=" + "&emailUIAction=sendEmail&fromAccount=" + fromAccount + "&krawler_body_only=true" + "&module=Emails&saveToKrawler=1&sendCharset=ISO-8859-1&sendDescription=" + sendDescription + "" + "&sendSubject=" + sendSubject + "&sendTo=" + sendTo + "&setEditor=1&subject1=" + subject1 + "&to_pdf=true"; RequestDispatcher dispatcher = request .getRequestDispatcher("/Common/MailIntegration/mailIntegrate.do?" + Url); dispatcher.forward(request, response); } catch (Exception ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":\"false\",\"error\":\"Error occured while sending mail(" + ex.toString() + ")\",\"data\":[]}"; } return result; }
From source file:edu.cornell.mannlib.vitro.webapp.controller.edit.DatapropEditController.java
public void doPost(HttpServletRequest request, HttpServletResponse response) { if (!isAuthorizedToDisplayPage(request, response, SimplePermission.EDIT_ONTOLOGY.ACTION)) { return;/* w ww . j a v a 2 s . co m*/ } VitroRequest vreq = new VitroRequest(request); final int NUM_COLS = 18; String datapropURI = request.getParameter("uri"); DataPropertyDao dpDao = vreq.getUnfilteredWebappDaoFactory().getDataPropertyDao(); DataPropertyDao dpDaoLangNeut = vreq.getLanguageNeutralWebappDaoFactory().getDataPropertyDao(); VClassDao vcDao = vreq.getLanguageNeutralWebappDaoFactory().getVClassDao(); VClassDao vcDaoWLang = vreq.getUnfilteredWebappDaoFactory().getVClassDao(); DataProperty dp = dpDao.getDataPropertyByURI(datapropURI); DataProperty pLangNeut = dpDaoLangNeut.getDataPropertyByURI(request.getParameter("uri")); PropertyGroupDao pgDao = vreq.getUnfilteredWebappDaoFactory().getPropertyGroupDao(); ArrayList results = new ArrayList(); results.add("data property"); // column 1 results.add("public display label"); // column 2 results.add("property group"); // column 3 results.add("ontology"); // column 4 results.add("RDF local name"); // column 5 results.add("domain class"); // column 6 results.add("range datatype"); // column 7 results.add("functional"); // column 8 results.add("public description"); // column 9 results.add("example"); // column 10 results.add("editor description"); // column 11 results.add("display level"); // column 12 results.add("update level"); // column 13 results.add("display tier"); // column 14 results.add("display limit"); // column 15 results.add("custom entry form"); // column 16 results.add("URI"); // column 17 results.add("publish level"); // column 18 RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP); results.add(dp.getPickListName()); // column 1 results.add(dp.getPublicName() == null ? "(no public label)" : dp.getPublicName()); // column 2 if (dp.getGroupURI() != null) { PropertyGroup pGroup = pgDao.getGroupByURI(dp.getGroupURI()); if (pGroup != null) { results.add(pGroup.getName()); // column 3 } else { results.add(dp.getGroupURI()); } } else { results.add("(unspecified)"); } String ontologyName = null; if (dp.getNamespace() != null) { Ontology ont = vreq.getUnfilteredWebappDaoFactory().getOntologyDao() .getOntologyByURI(dp.getNamespace()); if ((ont != null) && (ont.getName() != null)) { ontologyName = ont.getName(); } } results.add(ontologyName == null ? "(not identified)" : ontologyName); // column 4 results.add(dp.getLocalName()); // column 5 // we support parents now, but not the simple getParent() style method //String parentPropertyStr = "<i>(datatype properties are not yet modeled in a property hierarchy)</i>"; // TODO - need multiple inheritance //results.add(parentPropertyStr); String domainStr = ""; if (pLangNeut.getDomainVClassURI() != null) { VClass domainClass = vcDao.getVClassByURI(pLangNeut.getDomainVClassURI()); VClass domainWLang = vcDaoWLang.getVClassByURI(pLangNeut.getDomainVClassURI()); if (domainClass != null && domainClass.getURI() != null && domainClass.getPickListName() != null) { try { if (domainClass.isAnonymous()) { domainStr = domainClass.getPickListName(); } else { domainStr = "<a href=\"vclassEdit?uri=" + URLEncoder.encode(domainClass.getURI(), "UTF-8") + "\">" + domainWLang.getPickListName() + "</a>"; } } catch (UnsupportedEncodingException e) { log.error(e, e); } } } results.add(domainStr); // column 6 String rangeStr = (dp.getRangeDatatypeURI() == null) ? "<i>untyped</i> (rdfs:Literal)" : dp.getRangeDatatypeURI(); results.add(rangeStr); // column 7 results.add(dp.getFunctional() ? "true" : "false"); // column 8 String publicDescriptionStr = (dp.getPublicDescription() == null) ? "" : dp.getPublicDescription(); // column 9 results.add(publicDescriptionStr); String exampleStr = (dp.getExample() == null) ? "" : dp.getExample(); // column 10 results.add(exampleStr); String descriptionStr = (dp.getDescription() == null) ? "" : dp.getDescription(); // column 11 results.add(descriptionStr); results.add(dp.getHiddenFromDisplayBelowRoleLevel() == null ? "(unspecified)" : dp.getHiddenFromDisplayBelowRoleLevel().getDisplayLabel()); // column 12 results.add(dp.getProhibitedFromUpdateBelowRoleLevel() == null ? "(unspecified)" : dp.getProhibitedFromUpdateBelowRoleLevel().getUpdateLabel()); // column 13 results.add(String.valueOf(dp.getDisplayTier())); // column 14 results.add(String.valueOf(dp.getDisplayLimit())); // column 15 results.add(dp.getCustomEntryForm() == null ? "(unspecified)" : dp.getCustomEntryForm()); // column 16 results.add(dp.getURI() == null ? "" : dp.getURI()); // column 17 results.add(dp.getHiddenFromPublishBelowRoleLevel() == null ? "(unspecified)" : dp.getHiddenFromPublishBelowRoleLevel().getDisplayLabel()); // column 18 request.setAttribute("results", results); request.setAttribute("columncount", NUM_COLS); request.setAttribute("suppressquery", "true"); boolean FORCE_NEW = true; EditProcessObject epo = super.createEpo(request, FORCE_NEW); FormObject foo = new FormObject(); HashMap OptionMap = new HashMap(); // add the options foo.setOptionLists(OptionMap); epo.setFormObject(foo); DataPropertyDao assertionsDpDao = vreq.getUnfilteredAssertionsWebappDaoFactory().getDataPropertyDao(); List<DataProperty> superProps = getDataPropertiesForURIList( assertionsDpDao.getSuperPropertyURIs(dp.getURI(), false), assertionsDpDao); sortForPickList(superProps, vreq); request.setAttribute("superproperties", superProps); List<DataProperty> subProps = getDataPropertiesForURIList(assertionsDpDao.getSubPropertyURIs(dp.getURI()), assertionsDpDao); sortForPickList(subProps, vreq); request.setAttribute("subproperties", subProps); List<DataProperty> eqProps = getDataPropertiesForURIList( assertionsDpDao.getEquivalentPropertyURIs(dp.getURI()), assertionsDpDao); sortForPickList(eqProps, vreq); request.setAttribute("equivalentProperties", eqProps); ApplicationBean appBean = vreq.getAppBean(); request.setAttribute("epoKey", epo.getKey()); request.setAttribute("datatypeProperty", dp); request.setAttribute("bodyJsp", "/templates/edit/specific/dataprops_edit.jsp"); request.setAttribute("title", "Data Property Control Panel"); request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + appBean.getThemeDir() + "css/edit.css\"/>"); try { rd.forward(request, response); } catch (Exception e) { log.error("DatapropEditController could not forward to view."); log.error(e.getMessage()); log.error(e.getStackTrace()); } }
From source file:com.krawler.spring.iphone.iphoneController.java
public ModelAndView deskeraCRMMOB_V1(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { JSONObject jobj = new JSONObject(); ModelAndView model;//from www. ja v a 2 s. c o m String result = ""; try { int action = Integer.parseInt(request.getParameter("act")); int mode = Integer.parseInt(request.getParameter("mode")); if (action != 0) { try { if (StringUtil.isNullOrEmpty(sessionHandlerImpl.getUserid(request))) { setUserSession(request, response); } } catch (SessionExpiredException ex) { logger.warn( "Exception in iphoneController:deskeraCRMMOB_V1() - Session has not set. Need to create new session."); // logger.warn(ex.getMessage(), ex); setUserSession(request, response); } } switch (action) { case 0: // generate application id jobj = generateAppID(request, response); result = jobj.toString(); break; case 1: // dashboard request switch (mode) { case 0: // get Modules Updates model = getCrmDashboardController().getAllUpdatesForWidget(request, response); result = model.getModel().get("model").toString(); break; case 1: // get Reports result = getModuleReports(request); break; case 2:// view modules result = getModules(request); break; case 3:// view modules result = getModules(request); break; case 4:// get Messages String url = "/Common/MailIntegration/mailIntegrate.do?action=EmailUIAjax"; RequestDispatcher dispatcher = request.getRequestDispatcher(url); dispatcher.forward(request, response); break; case 5:// get owner List //jobj = crmDbcon.getOwner(request); //result = jobj.toString(); model = crmUserControllerObj.getOwner(request, response); jobj = new JSONObject(model.getModel().get("model").toString()); result = jobj.toString(); break; case 6:// get 1.Lead Status 2. Account Type 3. Indusrty //String comboname = request.getParameter("comboname"); model = crmManagerControllerObj.getComboData(request, response); jobj = new JSONObject(model.getModel().get("model").toString()); result = jobj.toString(); break; case 7:// get Account Name jobj = getAllAccounts(request, response); result = jobj.toString(); break; case 8:// 1.get owner List 2.lead source 3.Stage 4.Account Name jobj = getAllComboValueForProduct(request, response); result = jobj.toString(); break; case 9:// 1.get owner List 2.get category jobj = getAllComboValueForOpportunity(request, response); result = jobj.toString(); break; case 10://sign out sessionHandlerImplObj.destroyUserSession(request, response); result = "{\"success\":\"true\"}"; break; case 11://get user profile data result = getUserDetails(request); break; case 12:// get Campaign Data jobj = getCampaign(request, response); result = jobj.toString(); break; case 13:// get Lead Data jobj = getLead(request, response); result = jobj.toString(); break; case 14:// get Contact Data jobj = getContact(request, response); result = jobj.toString(); break; case 16:// get Account Data jobj = getAccount(request, response); result = jobj.toString(); break; case 18:// get Case Data jobj = getCase(request, response); result = jobj.toString(); break; case 19:// get product Data jobj = getProduct(request, response); result = jobj.toString(); break; case 20:// get Opportunity Data jobj = getopportunity(request, response); result = jobj.toString(); break; } break; //<editor-fold defaultstate="collapsed" desc="Report Case Section. Click on the + sign on the left to edit the code."> case 2: // Get Reports switch (mode) { case 0://revenue by opp source & result = getSalesbyLeadsource(request, response); break; case 1: // revenue by stage result = oppByStageReport(request, response); break; case 2:// Leads by Source result = getLeadbySource(request, response); break; case 3://Key Accounts result = getKeyAccounts(request); break; case 4://Cases by Status result = getCaseByStatus(request); break; case 5:// Converted leads result = getConvertedLeads(request, response); break; case 6://Sales by Source result = getSalesbysource(request, response); break; case 7:// Leads by Industry result = getLeadsByIndustry(request, response); break; case 8:// Closed Opportunities result = getOpportunityForReports(request, response, 1); break; case 9:// Opportunities By Type result = getOpportunityForReports(request, response, 2); break; case 10:// Opportunity Product Report result = getOpportunityForReports(request, response, 3); break; case 11:// Stuck Opportunities result = getOpportunityForReports(request, response, 4); break; case 12://Monthly Account result = getAccountPerMonth(request); break; case 13://Account Owners result = getAccountOwners(request); break; case 14:// Opporunity Source result = getOpporunitySource(request); break; case 15://HighPriorityActivities result = getHighPriorityActivities(request); break; case 16://Contacts with High Priority Cases result = getContactCases(request); break; case 17://ProductCases result = getProductCases(request); break; case 18://Account with High Priority Cases result = getAccountCases(request); break; case 19://Monthly Cases result = getMonthlyCases(request); break; case 20://Industry-Account Type Report result = getIndustryAccountType(request); break; case 21://Campaigns by Type result = getCampaignType(request); break; case 22://Completed Campaigns by Type result = getCompletedCampaign(request); break; case 23: //Qualified Leads result = getQualifiedLeads(request); break; case 24: //Accounts with Contacts result = getAccountWithContacts(request); break; case 25://Campaigns with Good Response result = getCampaignResponse(request); break; case 26: //Contacted Leads result = getContactedLeads(request); break; case 27: //Contacts by Lead Source result = getLeadContacts(request); break; case 28: //Accounts with Opportunities result = getAccountOpp(request); break; case 30://Newly Added Cases result = getNewlyAddedCase(request); break; case 31://Pending Cases result = getPendingCases(request); break; case 32://Escalated Cases result = getEscalatedCases(request); break; case 33: //Accounts with Cases result = getAccCases(request); break; case 34: //open Leads result = getOpenLeads(request); break; case 35: //open Leads result = getContactWithCase(request); break; case 36: //Converted Leads to Account result = getConvertedLeadsAccount(request); break; case 37: //Converted Leads to Opportunity result = getConvertedLeadsOpp(request); break; case 38: //Converted Leads to Contacts result = getConvertedLeadsContact(request); break; case 39://Targets by Owner result = getTargetOwner(request); break; case 40://Opp Pipelined result = getOpenOppPipelined(request); break; case 41://Lead pipeline result = getLeadPipelined(request); break; } break; case 3://update recordsde switch (mode) { case 0: //update user result = updateUser(request); break; case 1: result = sendMail(request, response); break; case 13:// insert Lead Data jobj = insertLead(request); result = jobj.toString(); break; case 14:// insert Contact Data jobj = insertContact(request); result = jobj.toString(); break; case 16:// insert Account Data jobj = insertAccount(request); result = jobj.toString(); break; case 18:// insert Case Data jobj = insertCase(request); result = jobj.toString(); break; case 19:// insert product Data jobj = insertProduct(request); result = jobj.toString(); break; case 20:// insert Opportunity Data jobj = insertOpportunity(request); result = jobj.toString(); break; } break; //<editor-fold defaultstate="collapsed" desc="chart Section. Click on the + sign on the left to edit the code."> case 4:// get Chart Data switch (mode) { case 1: //Leads by Source result = getChart(request, "Lead Source", "LeadsbySource"); break; case 2: //Leads By Industry result = getChart(request, "Industry", "LeadsbyIndustry"); break; case 3:// cases by status result = getChart(request, "Case Status", "CasesbyStatus"); break; case 8: result = getChart(request, "Lead Source", "SourcesOfOpportunity"); break; case 9: result = getHighPriorityActivityChart(request, "Related To"); break; case 10: result = getChart(request, "Title", "ContactHighPriority"); break; case 11: result = getProductHighPriorityChart(request);// no chart break; case 12: result = getAccountHighPriorityChart(request);// no chart break; case 14: result = getChart(request, "Industry", "IndustryAccountTypes"); break; case 15: result = getChart(request, "Opportunity Type", "OpportunityByType"); break; case 16: result = opportunityByProduct(request); break; case 17: result = accountsByOwner(request); break; case 18: result = getChart(request, "Opportunity Stage", "StuckOpportunities"); break; case 20: result = closedOppPieChart(request); break; case 21: result = getChart(request, "Lead Source", "ConvertedLeads"); break; case 25: result = getChart(request, "Lead Source", "OpportunitybySource"); break; case 26: result = getChart(request, "Opportunity Stage", "OpportunitybyStage"); break; case 28: result = getKeyAccountsPie(request); break; case 29: result = getChart(request, "Lead Source", "SalesbySource"); break; case 35: result = getMonthlyChartPie(request, "MonthlyAccounts"); break; case 42: result = getMonthlyChartPie(request, "MonthlyCases"); break; case 44: result = getChart(request, "Campaign Type", "CampaignType"); break; case 46: result = getChart(request, "Campaign Type", "CompletedCampaign"); break; case 48: result = getChart(request, "Lead Source", "QualifiedLeads"); break; case 50: result = getAccountContactPie(request); break; case 52: result = getChart(request, "Campaign Type", "CampaignResponse"); break; case 54: result = getChart(request, "Lead Source", "ContactedLeads"); break; case 56:// Contacts by Lead Source result = getChart(request, "Lead Source", "LeadSourceContacts"); break; case 58: result = getAccountOpportunityPie(request); break; case 62: result = getChart(request, "Priority", "NewlyAddedCases"); break; case 64: result = getChart(request, "Priority", "PendingCases"); break; case 66: result = getChart(request, "Priority", "EscalatedCases"); break; case 68: result = getAccountCasesPie(request); break; case 70: result = getOpenLeadsPie(request); break; case 72: result = getContactCasePie(request); break; case 74: result = getChart(request, "Lead Source", "ConvertedLeadAccount"); break; case 76: result = getChart(request, "Lead Source", "ConvertedLeadOpp"); break; case 78: result = getChart(request, "Lead Source", "ConvertedLeadContact"); break; case 80: result = getTargetOwnerPie(request); break; case 84: result = getChart(request, "Opportunity Stage", "OpportunityPipeline"); break; case 86: result = getChart(request, "Lead Status", "LeadPipeline"); break; } break; } } catch (JSONException ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":\"false\",\"error\":\"Error occured while retreiving data(" + ex.toString() + ")\",\"data\":[]}"; } catch (ServiceException ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":\"false\",\"error\":\"Error occured while retreiving data(" + ex.toString() + ")\",\"data\":[]}"; } catch (SessionExpiredException ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":\"false\",\"error\":\"Error occured while retreiving data(" + ex.toString() + ")\",\"data\":[]}"; } return new ModelAndView("jsonView-ex", "model", result); }
From source file:edu.cornell.mannlib.vitro.webapp.controller.edit.RefactorOperationController.java
private String doFixDataTypes(HttpServletRequest request, HttpServletResponse response) { try {/* w w w . j a v a2s . co m*/ super.doGet(request, response); } catch (Exception e) { log.error(this.getClass().getName() + " caught exception calling doGet()"); } VitroRequest vreq = new VitroRequest(request); RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP); request.setAttribute("bodyJsp", Controllers.CHECK_DATATYPE_PROPERTIES); request.setAttribute("title", "Check Datatype Properties"); request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + vreq.getAppBean().getThemeDir() + "css/edit.css\"/>"); OntModel ontModel = ModelAccess.on(getServletContext()).getOntModel(FULL_ASSERTIONS); ontModel.enterCriticalSection(Lock.WRITE); ArrayList<String> results = new ArrayList<String>(); try { ExtendedIterator dataProperties = ontModel.listDatatypeProperties(); int hasRange = 0; int consistent = 0; int inconsistent = 0; int total = 0; int fixed = 0; while (dataProperties.hasNext()) // Iterate through all datatype properties { total++; DatatypeProperty p = (DatatypeProperty) dataProperties.next(); OntResource range = p.getRange(); if (range != null) hasRange++; NodeIterator n = ontModel.listObjectsOfProperty(p); //if(!n.hasNext()) results.add(p.getLocalName()+" is not in any statements"); while (n.hasNext()) // Iterate through all objects of all datatype properties { RDFNode node = n.nextNode(); if (node.isLiteral()) { if (range != null) // If a literal has a predicate with a defined range, check and fix the literal's datatype { Literal l = (Literal) node; StmtIterator usingPandL = ontModel.listStatements(null, p, l); int size = 0; results.add("Statements using property " + p.getLocalName() + " and literal " + l.getLexicalForm() + ":"); while (usingPandL.hasNext()) { Statement st = usingPandL.nextStatement(); results.add(" " + st.getSubject().getLocalName() + " " + p.getLocalName() + " " + l.getLexicalForm()); size++; } usingPandL.close(); boolean valid = range.getURI().equals(l.getDatatypeURI()); if (valid) consistent += size; else { results.add(p.getLocalName() + " has object " + l.getLexicalForm() + " of type " + l.getDatatypeURI() + " which is inconsistent"); String typeName = ""; if (range.getURI().contains(XSDDatatype.XSD)) typeName = range.getURI().substring(XSDDatatype.XSD.length() + 1); else results.add("ERROR: " + p.getLocalName() + " has a range which does not contain the XSD namespace"); Literal newLiteral = null; try { newLiteral = ontModel.createTypedLiteral(l.getLexicalForm(), new XSDDatatype(typeName)); } catch (NullPointerException e) { results.add( "ERROR: Can't create XSDDatatype for literal " + l.getLexicalForm()); } StmtIterator badStatements = ontModel.listStatements(null, p, l); StmtIterator toRemove = ontModel.listStatements(null, p, l); ArrayList<Statement> queue = new ArrayList<Statement>(); while (badStatements.hasNext()) { Statement badState = badStatements.nextStatement(); Statement goodState = ontModel.createStatement(badState.getSubject(), p, newLiteral); queue.add(goodState); results.add(" Replacing: " + badState.toString()); results.add(" With: " + goodState.toString()); fixed++; } for (int i = 0; i < queue.size(); i++) { ontModel.add(queue.get(i)); } ontModel.remove(toRemove); badStatements.close(); toRemove.close(); } if (valid) results.add("Literal " + l.getLexicalForm() + " is in the range of property " + p.getLocalName()); results.add("--------------"); } } else results.add("ERROR: " + node.toString() + " is not a literal"); } n.close(); } dataProperties.close(); results.add(hasRange + " of " + total + " datatype properties have defined ranges."); results.add("Of the statements that contain datatype properties with defined ranges, " + consistent + " are consistent and " + fixed + " are inconsistent."); results.add(fixed + " statements have been fixed."); //for(int i=0; i<results.size(); i++) System.out.println(results.get(i)); } finally { ontModel.leaveCriticalSection(); } request.setAttribute("results", results); try { rd.forward(request, response); } catch (Exception e) { log.error(this.getClass().getName() + " could not forward to view."); log.error(e.getMessage()); log.error(e.getStackTrace()); } return ""; }
From source file:cms.service.app.ServiceController.java
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HashMap<String, String> userdata; AccessToken access = null;/*ww w . j a v a2s . co m*/ AccessToken regaccess = null; RequestDispatcher rd; String strNextPage = null; boolean isvalidtoken = false; boolean subscription = false; String reguser = "registration"; String regpassword = "reg$56*123"; String baseurl = request.getRequestURL().toString().split("/service")[0]; String remotehost = request.getRemoteHost(); String remoteaddress = request.getRemoteAddr(); String username = request.getParameter("username"); String password = request.getParameter("password"); String useraction = request.getParameter("useraction"); String adminuser = request.getParameter("adminuser"); String usertoken = request.getParameter("usertoken"); String servicekey = request.getParameter("servicekey"); String amount = request.getParameter("amount"); String objid = request.getParameter("refobjid"); String description = request.getParameter("description"); String leadactions = "campaign whitepapers contactus training"; String sendreference = request.getParameter("sendreference"); ; Date date = new Date(); //set remote address request.setCharacterEncoding("UTF-8"); /*if(custom!=null&&!custom.equals("")){ custom="dan@softlean.com#-1624640437#127.0.0.1"; item_name="xyx"; item_number="899"; } subscription=(custom!=null&&!custom.equals(""))?true:false; logger.info(date.toString()+":-subscription="+subscription+" custom="+custom); if(subscription){ custret=custom.split("-"); if(custret.length==6) username=custret[3]; usertoken=custret[4]; tu.updatePayment(custret); } */ //first verify remote client whether the request is from same client if (!tu.isEmptyValue(servicekey)) { try { String val = new String(Base64Util.decode(servicekey.getBytes())); logger.info("servicekey=" + val); if (!tu.isEmptyValue(val)) { String[] items = val.split(CONST.IPSEPERATOR); if (items.length >= 2) { username = items[0]; password = items[1]; } if (items.length == 3) { useraction = items[2]; if (useraction.equalsIgnoreCase("campaign") && tu.isEmptyValue(sendreference)) { sendreference = "2"; } } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } //logger.info("\n"+date.toString()+":-username="+username+ " password="+password+" useraction="+useraction); if (CONST.GENERATE_LOG) { logger.info("\n" + date.toString() + ":-URI=" + request.getRequestURI()); logger.info("\n" + date.toString() + ":-Request Remote address=" + remoteaddress + " Remote Host=" + remotehost); } //Identify the current page as login page if (!tu.isEmptyValue(username) && !tu.isEmptyValue(password)) { //Do not check license for hosting solution access = m_service.verifyLogin(username, password, remoteaddress); } else { regaccess = m_service.verifyLogin(reguser, regpassword, remoteaddress); } if (access != null && tu.isEmptyValue(useraction)) { logger.info("\n" + date.toString() + " Loged in User:=" + username + " " + ":-Assigned Token=" + access.getToken() + ":-Assigned Modules=" + access.getModules()); //access token is appended with Client IP in the indexpage strNextPage = "/src/index.jsp?username=" + username + "&firstname=" + access.getFirstname() + "&usertoken=" + access.getToken() + CONST.IPSEPERATOR + remoteaddress + CONST.IPSEPERATOR + username + "&baseurl=" + baseurl + "&modules=" + access.getModules(); } else if (access != null && !tu.isEmptyValue(useraction) && leadactions.toLowerCase().contains(useraction.toLowerCase())) { strNextPage = "/src/campaign/" + useraction + ".jsp?username=" + username + "&firstname=" + access.getFirstname() + "&usertoken=" + access.getToken() + CONST.IPSEPERATOR + remoteaddress + CONST.IPSEPERATOR + username + "&baseurl=" + baseurl + "&campaignid=" + objid + "&sendreference=" + sendreference; //logger.info("\n"+date.toString()+"strNextPage:="+strNextPage); //}else if(access!=null && !tu.isEmptyValue(useraction) && useraction.equalsIgnoreCase("whitepapers")){ //strNextPage="/src/campaign/white_paper.jsp?username="+username+"&firstname="+access.getFirstname()+"&usertoken="+access.getToken()+CONST.IPSEPERATOR+remoteaddress+CONST.IPSEPERATOR+username+"&baseurl=" // +baseurl+"&campaignid="+objid; //logger.info("\n"+date.toString()+"strNextPage:="+strNextPage); } else if (subscription) { userdata = m_service.verifyUserToken(usertoken); isvalidtoken = usertoken != null && !usertoken.equals("") && userdata != null; if (isvalidtoken) { strNextPage = "/src/index.jsp?username=" + username + "&usertoken=" + usertoken + "&baseurl=" + baseurl; } } else if (!tu.isEmptyValue(useraction) && useraction.equalsIgnoreCase("missingpassword")) { strNextPage = "/src/password.jsp?token=" + regaccess.getToken() + CONST.IPSEPERATOR + remoteaddress + CONST.IPSEPERATOR + reguser + "&baseurl=" + baseurl; } else if (!tu.isEmptyValue(useraction) && useraction.equalsIgnoreCase("demoregistration")) { strNextPage = "/src/demologin.jsp?token=" + regaccess.getToken() + CONST.IPSEPERATOR + remoteaddress + CONST.IPSEPERATOR + reguser + "&baseurl=" + baseurl; } else if (!tu.isEmptyValue(adminuser) && adminuser.equals("sa")) { strNextPage = "/src/admin.jsp?token=" + regaccess.getToken() + CONST.IPSEPERATOR + remoteaddress + CONST.IPSEPERATOR + reguser + "&baseurl=" + baseurl; } else if (!tu.isEmptyValue(amount) && !tu.isEmptyValue(objid)) { userdata = m_service.verifyUserToken(usertoken); if (userdata != null && !userdata.isEmpty()) { strNextPage = "/src/java_sim/payment.jsp?email=" + username + "&objid=" + objid + "&amount=" + amount + "&description=" + description; } } else if (regaccess != null) { strNextPage = "/src/login.jsp?token=" + regaccess.getToken() + CONST.IPSEPERATOR + remoteaddress + CONST.IPSEPERATOR + reguser + "&baseurl=" + baseurl; } else { strNextPage = "/src/error.jsp?token=null" + CONST.IPSEPERATOR + remoteaddress + CONST.IPSEPERATOR + reguser + "&baseurl=" + baseurl; } if (CONST.GENERATE_LOG) { logger.info("\n" + date.toString() + ":-Mapped Filename : " + strNextPage); } if (!strNextPage.equals("")) { rd = m_autoContext.getRequestDispatcher(strNextPage); // Forward the request to the target page try { if (rd != null) { rd.forward(request, response); } } catch (Exception e) { logger.info("ControllerServlet.doPost(): error in rd.forward"); e.printStackTrace(); } } else { // This should be logged. logger.info("Next Page is null"); super.doPost(request, response); } }
From source file:com.founder.fix.fixflow.FlowCenter.java
/** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response)//w w w . j a v a2 s. c o m */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userId = StringUtil.getString(request.getSession().getAttribute(FlowCenterService.LOGIN_USER_ID)); if (StringUtil.isEmpty(userId)) { String context = request.getContextPath(); response.sendRedirect(context + "/"); return; } CurrentThread.init(); ServletOutputStream out = null; String action = StringUtil.getString(request.getParameter("action")); if (StringUtil.isEmpty(action)) { action = StringUtil.getString(request.getAttribute("action")); } if (StringUtil.isEmpty(action)) { action = "getMyTask"; } RequestDispatcher rd = null; try { Map<String, Object> filter = new HashMap<String, Object>(); if (ServletFileUpload.isMultipartContent(request)) { ServletFileUpload Uploader = new ServletFileUpload(new DiskFileItemFactory()); // Uploader.setSizeMax("); // Uploader.setHeaderEncoding("utf-8"); List<FileItem> fileItems = Uploader.parseRequest(request); for (FileItem item : fileItems) { filter.put(item.getFieldName(), item); if (item.getFieldName().equals("action")) action = item.getString(); } } else { Enumeration enu = request.getParameterNames(); while (enu.hasMoreElements()) { Object tmp = enu.nextElement(); Object obj = request.getParameter(StringUtil.getString(tmp)); // if (request.getAttribute("ISGET") != null) obj = new String(obj.toString().getBytes("ISO8859-1"), "utf-8"); filter.put(StringUtil.getString(tmp), obj); } } Enumeration attenums = request.getAttributeNames(); while (attenums.hasMoreElements()) { String paramName = (String) attenums.nextElement(); Object paramValue = request.getAttribute(paramName); // ?map filter.put(paramName, paramValue); } filter.put("userId", userId); request.setAttribute("nowAction", action); if (action.equals("getMyProcess")) { rd = request.getRequestDispatcher("/fixflow/center/startTask.jsp"); List<Map<String, String>> result = getFlowCenter().queryStartProcess(userId); Map<String, List<Map<String, String>>> newResult = new HashMap<String, List<Map<String, String>>>(); for (Map<String, String> tmp : result) { String category = tmp.get("category"); if (StringUtil.isEmpty(category)) category = ""; List<Map<String, String>> tlist = newResult.get(category); if (tlist == null) { tlist = new ArrayList<Map<String, String>>(); } tlist.add(tmp); newResult.put(category, tlist); } request.setAttribute("result", newResult); //??sqlserverbug???? request.setAttribute("userId", userId); // userId add Rex try { List<Map<String, String>> lastestProcess = getFlowCenter().queryLastestProcess(userId); request.setAttribute("lastest", lastestProcess); } catch (Exception ex) { ex.printStackTrace(); } } else if (action.equals("getMyTask")) { rd = request.getRequestDispatcher("/fixflow/center/todoTask.jsp"); filter.put("path", request.getSession().getServletContext().getRealPath("/")); Map<String, Object> pageResult = getFlowCenter().queryMyTaskNotEnd(filter); filter.putAll(pageResult); request.setAttribute("result", filter); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if (action.equals("getProcessImage")) { response.getOutputStream(); } else if (action.equals("getAllProcess")) { rd = request.getRequestDispatcher("/fixflow/center/queryprocess.jsp"); Map<String, Object> pageResult = getFlowCenter().queryTaskInitiator(filter); filter.putAll(pageResult); request.setAttribute("result", filter); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if (action.equals("getPlaceOnFile")) { rd = request.getRequestDispatcher("/fixflow/center/placeOnFile.jsp"); Map<String, Object> pageResult = getFlowCenter().queryPlaceOnFile(filter); filter.putAll(pageResult); request.setAttribute("result", filter); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if (action.equals("getTaskDetailInfo")) { rd = request.getRequestDispatcher("/fixflow/center/flowGraphic.jsp"); Map<String, Object> pageResult = getFlowCenter().getTaskDetailInfo(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if (action.equals("getTaskDetailInfoSVG")) { rd = request.getRequestDispatcher("/fixflow/center/flowGraphic.jsp"); Map<String, Object> pageResult = getFlowCenter().getTaskDetailInfoSVG(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if (action.equals("getFlowGraph")) { InputStream is = getFlowCenter().getFlowGraph(filter); out = response.getOutputStream(); response.setContentType("application/octet-stream;charset=UTF-8"); byte[] buff = new byte[2048]; int size = 0; while (is != null && (size = is.read(buff)) != -1) { out.write(buff, 0, size); } } else if (action.equals("getUserInfo")) { rd = request.getRequestDispatcher("/fixflow/common/userInfo.jsp"); filter.put("path", request.getSession().getServletContext().getRealPath("/")); Map<String, Object> pageResult = getFlowCenter().getUserInfo(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if (action.equals("getUserIcon")) { rd = request.getRequestDispatcher("/fixflow/common/userOperation.jsp"); filter.put("path", request.getSession().getServletContext().getRealPath("/")); Map<String, Object> pageResult = getFlowCenter().getUserInfo(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if (action.equals("updateUserIcon")) { rd = request.getRequestDispatcher("/FlowCenter?action=getUserInfo"); filter.put("path", request.getSession().getServletContext().getRealPath("/")); getFlowCenter().saveUserIcon(filter); } else if (action.equals("selectUserList")) { // String isMulti = request.getParameter("isMulti"); rd = request.getRequestDispatcher("/fixflow/common/selectUserList.jsp?isMulti=" + isMulti); Map<String, Object> pageResult = getFlowCenter().getAllUsers(filter); filter.putAll(pageResult); request.setAttribute("result", filter); request.setAttribute("isMulti", isMulti); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if (action.equals("selectNodeList")) { // rd = request.getRequestDispatcher("/fixflow/common/selectNodeList.jsp"); Map<String, Object> pageResult = getFlowCenter().getRollbackNode(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if (action.equals("selectStepList")) { // rd = request.getRequestDispatcher("/fixflow/common/selectStepList.jsp"); Map<String, Object> pageResult = getFlowCenter().getRollbackTask(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if (action.equals("viewDelegation")) { // rd = request.getRequestDispatcher("/fixflow/common/setDelegation.jsp"); Map<String, Object> pageResult = new HashMap<String, Object>(); pageResult = this.getFlowIdentityService().getUserDelegationInfo(userId); filter.putAll(pageResult); request.setAttribute("result", filter); } else if (action.equals("saveDelegation")) { // String agentInfoJson = StringUtil.getString(request.getParameter("insertAndUpdate")); if (StringUtil.isNotEmpty(agentInfoJson)) { Map<String, Object> delegationInfo = JSONUtil.parseJSON2Map(agentInfoJson); this.getFlowIdentityService().saveUserDelegationInfo(delegationInfo); } response.setContentType("text/html;charset=UTF-8"); response.getWriter().write("<script>alert('??');window.close();</script>"); } } catch (Exception e) { e.printStackTrace(); request.setAttribute("errorMsg", e.getMessage()); try { CurrentThread.rollBack(); } catch (SQLException e1) { e1.printStackTrace(); request.setAttribute("errorMsg", e.getMessage()); } } finally { if (out != null) { out.flush(); out.close(); } try { CurrentThread.clear(); } catch (SQLException e) { request.setAttribute("errorMsg", e.getMessage()); e.printStackTrace(); } } if (rd != null) { rd.forward(request, response); } }
From source file:controllerClasses.StudyController.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods.//from ww w. j a v a 2 s . c om * * @param request * servlet request * @param response * servlet response * @throws ServletException * if a servlet-specific error occurs * @throws IOException * if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("In StudyController"); HttpSession session = null; //String action = request.getParameter("action"); String userPath = request.getServletPath().substring(1, request.getServletPath().length()); RequestDispatcher dispatcher = null; String reDirect = null; String studyCode = null; String choice = null; StudyDB studyDB = null; List<Study> studies = null; User user = null; try { HttpSession session2 = request.getSession(); String email = (String) session2.getAttribute("email"); session = request.getSession(false); if (session != null && session.getAttribute("theUser") != null) { user = (User) session.getAttribute("theUser"); studyDB = new StudyDB(); if (userPath.equals("participate")) { studyCode = request.getParameter("studyCode"); String email1 = (String) session2.getAttribute("email"); System.out.println("user email in study controller from session" + email1); if (studyCode != null && !studyCode.isEmpty()) { System.out.println("studyCode in first block: " + studyCode); Study study = studyDB.getStudy(studyCode); request.setAttribute("study", study); reDirect = "question"; } else { List result = StudyDB.retrieveStudies1(email); Study study = new Study(); String s = study.getName(); System.out.println("Controller study object" + s); request.setAttribute("study", study); request.setAttribute("result", result); reDirect = "participate"; } } else if (userPath.equals("answer")) { studyCode = request.getParameter("studyCode"); choice = request.getParameter("choice"); System.out.println("studyCode: " + studyCode); System.out.println("choice: " + choice); List result = StudyDB.answer(email, choice, studyCode); int i = UserDB.updateParticipations(email); user.setParticipation(i); int j = UserDB.updateCoins(email); user.setCoins(j); int k = UserDB.updateParticipants(email, studyCode); user.setParticipants(k); int participants = UserDB.getAttribute(email); int coins = UserDB.coins(email); int participation = UserDB.participation(email); user.setParticipants(participants); user.setCoins(coins); user.setParticipation(participation); request.setAttribute("user", user); /** List result = studyDB.getStudies(); List<Study> sInStart = new ArrayList<Study>(); for(Study study: studies){ if(study.getStatus().equalsIgnoreCase("start")){ sInStart.add(study); } } System.out.println(sInStart.size());**/ session.setAttribute("theUser", user); request.setAttribute("openStudies", result); request.setAttribute("result", result); reDirect = "participate"; } else if (userPath.equals("myStudies")) { List result = studyDB.retrieveStudies(email); Study study = new Study(); request.setAttribute("study", study); request.setAttribute("result", result); session.setAttribute("result", result); session.setAttribute("myStudies", studies); reDirect = "studies"; } else if (userPath.equals("edit")) { studyCode = request.getParameter("studyCode"); String email3 = (String) session2.getAttribute("email"); Study study = new Study(); study = StudyDB.getStudy(studyCode); /** if(session.getAttribute("myStudies")!=null){ studies = (List<Study>) session.getAttribute("myStudies"); }else{ studies = studyDB.getStudies(user.getEmail()); } for(Study study: studies){ if(study.getCode() == Integer.parseInt(studyCode)){ request.setAttribute("study", studyDB.getStudy(Integer.parseInt(studyCode))); break; } }**/ request.setAttribute("study", study); reDirect = "editstudy"; /*Pending*/ } else if (userPath.equals("update")) { studyCode = request.getParameter("studyCode"); Study study = new Study(); study.setCode(Integer.parseInt(request.getParameter("studyCode"))); study.setName(request.getParameter("studyName")); study.setQuestion(request.getParameter("questionText")); study.setRequestedParticipants(Integer.parseInt(request.getParameter("participants"))); study.setDescription(request.getParameter("description")); Part part = request.getPart("imageFile"); String fileName = part.getSubmittedFileName(); String file1 = "images/" + fileName; study.setImageURL(file1); System.out.println("IMAGE NAME" + file1); System.out.println("IMAGE NAME FROM STUDY OBJECT" + study.getImageURL()); List result = StudyDB.updateStudy(study, email); /** if(session.getAttribute("myStudies")!=null){ studies = (List<Study>) session.getAttribute("myStudies"); }else{ studies = studyDB.getStudies(user.getEmail()); } for(Study study: studies){ if(study.getCode() == Integer.parseInt(studyCode)){ studies.remove(study); study.setCode(Integer.parseInt(request.getParameter("studyCode"))); study.setName(request.getParameter("studyName")); study.setQuestion(request.getParameter("questionText")); study.setRequestedParticipants(Integer.parseInt(request.getParameter("participants"))); study.setDescription(request.getParameter("description")); studies.add(study); break; } }**/ request.setAttribute("result", result); request.setAttribute("study", study); session.setAttribute("myStudies", studies); reDirect = "studies"; } else if (userPath.equals("add")) { Study study = new Study(); study.setCode((int) Math.random()); study.setName(request.getParameter("studyName")); study.setQuestion(request.getParameter("questionText")); study.setRequestedParticipants(Integer.parseInt(request.getParameter("participants"))); study.setDescription(request.getParameter("description")); Part part = request.getPart("imageFile"); String fileName = part.getSubmittedFileName(); String file1 = "images/" + fileName; study.setImageURL(file1); /** studies = (List<Study>) session.getAttribute("myStudies"); studies.add(study);**/ List result1 = StudyDB.addStudy(study, email); List result = StudyDB.retrieveStudies(email); Study study1 = new Study(); request.setAttribute("result", result); session.setAttribute("myStudies", studies); reDirect = "studies"; } else if (userPath.equals("start")) { studyCode = request.getParameter("studyCode"); List result = StudyDB.startStudy(studyCode, email); Study study = new Study(); session.setAttribute("result", result); study.setStatus("started"); session.setAttribute("choice", "started"); /** if(session.getAttribute("myStudies")!=null){ studies = (List<Study>) session.getAttribute("myStudies"); } for(Study study: studies){ if(study.getCode() == Integer.parseInt(studyCode)){ studies.remove(study); study.setStatus("start"); studies.add(study); System.out.println("studyCode: " + studyCode); System.out.println("New Status: " + study.getStatus()); break; } }**/ session.setAttribute("myStudies", studies); reDirect = "studies"; } else if (userPath.equals("stop")) { studyCode = request.getParameter("studyCode"); System.out.println("study code from DB" + studyCode); List result = StudyDB.stopStudy(studyCode, email); Study study = new Study(); study.setStatus("stopped"); session.setAttribute("result", result); System.out.println("studyCode: " + studyCode); /** if(session.getAttribute("myStudies")!=null){ studies = (List<Study>) session.getAttribute("myStudies"); } for(Study study1: studies){ if(study1.getCode() == Integer.parseInt(studyCode)){ studies.remove(study); study1.setStatus(null); studies.add(study); System.out.println("studyCode: " + studyCode); System.out.println("New Status: " + study.getStatus()); break; } }**/ session.setAttribute("myStudies", studies); reDirect = "studies"; } dispatcher = getServletContext().getRequestDispatcher("/" + reDirect + ".jsp"); dispatcher.forward(request, response); } else { dispatcher = getServletContext().getRequestDispatcher("/" + "login" + ".jsp"); dispatcher.forward(request, response); } } catch (Exception e) { e.printStackTrace(); dispatcher = getServletContext().getRequestDispatcher("/main.jsp"); dispatcher.forward(request, response); } }
From source file:com.founder.fix.fixflow.FlowManager.java
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CurrentThread.init();// ww w. j a v a 2s . co m String userId = StringUtil.getString(request.getSession().getAttribute(FlowCenterService.LOGIN_USER_ID)); if (StringUtil.isEmpty(userId)) { String context = request.getContextPath(); response.sendRedirect(context + "/"); return; } ServletOutputStream out = null; String action = StringUtil.getString(request.getParameter("action")); if (StringUtil.isEmpty(action)) { action = StringUtil.getString(request.getAttribute("action")); } RequestDispatcher rd = null; try { Map<String, Object> filter = new HashMap<String, Object>(); if (ServletFileUpload.isMultipartContent(request)) { ServletFileUpload Uploader = new ServletFileUpload(new DiskFileItemFactory()); // Uploader.setSizeMax("); // Uploader.setHeaderEncoding("utf-8"); List<FileItem> fileItems = Uploader.parseRequest(request); for (FileItem item : fileItems) { filter.put(item.getFieldName(), item); if (item.getFieldName().equals("action")) action = item.getString(); if (item.getFieldName().equals("deploymentId")) { filter.put("deploymentId", item.getString()); } } } else { Enumeration enu = request.getParameterNames(); while (enu.hasMoreElements()) { Object tmp = enu.nextElement(); Object obj = request.getParameter(StringUtil.getString(tmp)); // if (request.getAttribute("ISGET") != null) obj = new String(obj.toString().getBytes("ISO8859-1"), "utf-8"); filter.put(StringUtil.getString(tmp), obj); } } Enumeration attenums = request.getAttributeNames(); while (attenums.hasMoreElements()) { String paramName = (String) attenums.nextElement(); Object paramValue = request.getAttribute(paramName); // ?map filter.put(paramName, paramValue); } filter.put("userId", userId); request.setAttribute("nowAction", action); if ("processDefinitionList".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/processDefinitionList.jsp"); Map<String, Object> result = getProcessDefinitionService().getProcessDefitionList(filter); filter.putAll(result); request.setAttribute("result", filter); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if (action.equals("processManageList")) { rd = request.getRequestDispatcher("/fixflow/manager/processInstanceList.jsp"); Map<String, Object> result = getFlowManager().getProcessInstances(filter); filter.putAll(result); request.setAttribute("result", filter); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if (action.equals("suspendProcessInstance")) { rd = request.getRequestDispatcher("/FlowManager?action=processManageList"); getFlowManager().suspendProcessInstance(filter); } else if (action.equals("continueProcessInstance")) { rd = request.getRequestDispatcher("/FlowManager?action=processManageList"); getFlowManager().continueProcessInstance(filter); } else if (action.equals("terminatProcessInstance")) { rd = request.getRequestDispatcher("/FlowManager?action=processManageList"); getFlowManager().terminatProcessInstance(filter); } else if (action.equals("deleteProcessInstance")) { rd = request.getRequestDispatcher("/FlowManager?action=processManageList"); getFlowManager().deleteProcessInstance(filter); } else if (action.equals("toProcessVariable")) { rd = request.getRequestDispatcher("/fixflow/manager/processVariableList.jsp"); Map<String, Object> result = getFlowManager().getProcessVariables(filter); filter.putAll(result); request.setAttribute("result", filter); } else if (action.equals("saveProcessVariables")) { String tmp = (String) filter.get("insertAndUpdate"); if (StringUtil.isNotEmpty(tmp)) { Map<String, Object> tMap = JSONUtil.parseJSON2Map(tmp); filter.put("insertAndUpdate", tMap); } getFlowManager().saveProcessVariables(filter); rd = request.getRequestDispatcher("/FlowManager?action=toProcessVariable"); } else if (action.equals("processTokenList")) { Map<String, Object> result = getFlowManager().getProcessTokens(filter); filter.putAll(result); request.setAttribute("result", filter); rd = request.getRequestDispatcher("/fixflow/manager/processTokenList.jsp"); } else if (action.equals("taskInstanceList")) { rd = request.getRequestDispatcher("/fixflow/manager/taskInstanceList.jsp"); filter.put("path", request.getSession().getServletContext().getRealPath("/")); Map<String, Object> pageResult = getTaskManager().getTaskList(filter); filter.putAll(pageResult); request.setAttribute("result", filter); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if (action.equals("doTaskSuspend")) { rd = request.getRequestDispatcher("/FlowManager?action=taskInstanceList"); getTaskManager().suspendTask(filter); } else if (action.equals("doTaskResume")) { rd = request.getRequestDispatcher("/FlowManager?action=taskInstanceList"); getTaskManager().resumeTask(filter); } else if (action.equals("doTaskTransfer")) { rd = request.getRequestDispatcher("/FlowManager?action=taskInstanceList"); getTaskManager().transferTask(filter); } else if (action.equals("doTaskRollBackNode")) { rd = request.getRequestDispatcher("/FlowManager?action=taskInstanceList"); getTaskManager().rollBackNode(filter); } else if (action.equals("doTaskRollBackTask")) { rd = request.getRequestDispatcher("/FlowManager?action=taskInstanceList"); getTaskManager().rollBackStep(filter); } else if (action.equals("flowLibrary")) { rd = request.getRequestDispatcher("/fixflow-explorer/flowLibrary.jsp"); } //???deploymentId if ("deploy".equals(action)) { rd = request.getRequestDispatcher("/FlowManager?action=processDefinitionList"); response.setContentType("text/html;charset=utf-8"); getProcessDefinitionService().deployByZip(filter); } else if ("deleteDeploy".equals(action)) { rd = request.getRequestDispatcher("/FlowManager?action=processDefinitionList"); getProcessDefinitionService().deleteDeploy(filter); } else if ("download".equals(action)) { String processDefinitionId = StringUtil.getString(filter.get("processDefinitionId")); response.reset(); request.setCharacterEncoding("gbk"); response.setContentType("applcation/octet-stream"); response.setHeader("Content-disposition", "attachment; filename=" + processDefinitionId + ".zip"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0,private, max-age=0"); response.setHeader("Content-Type", "application/octet-stream"); response.setHeader("Content-Type", "application/force-download"); response.setHeader("Pragma", "public"); response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); ZipOutputStream outZip = new ZipOutputStream(response.getOutputStream()); List<Map<String, Object>> fileList = getProcessDefinitionService().getResources(filter); for (Map<String, Object> file : fileList) { ZipEntry entry = new ZipEntry(file.get("FILENAME").toString()); entry.setSize(((byte[]) file.get("BYTES")).length); outZip.putNextEntry(entry); outZip.write((byte[]) file.get("BYTES")); outZip.closeEntry(); } outZip.close(); outZip.flush(); outZip.close(); } else if ("getUserList".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/userList.jsp"); request.setAttribute("nowAction", "UserGroup"); Map<String, Object> result = getUserGroupService().getAllUsers(filter); filter.putAll(result); request.setAttribute("result", filter); List<Map<String, Object>> groupList = getUserGroupService().getAllGroupDefinition(filter); request.setAttribute("groupList", groupList); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if ("getGroupList".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/groupList.jsp"); request.setAttribute("nowAction", "UserGroup"); Map<String, Object> result = getUserGroupService().getAllGroup(filter); filter.putAll(result); request.setAttribute("result", filter); List<Map<String, Object>> groupList = getUserGroupService().getAllGroupDefinition(filter); request.setAttribute("groupList", groupList); request.setAttribute("pageInfo", filter.get("pageInfo")); } else if ("getUserInfo".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/userInfo.jsp"); Map<String, Object> pageResult = getUserGroupService().getUserInfo(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if ("getGroupInfo".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/groupInfo.jsp"); Map<String, Object> pageResult = getUserGroupService().getGroupInfo(filter); filter.putAll(pageResult); request.setAttribute("result", filter); } else if ("getJobList".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/jobList.jsp"); request.setAttribute("nowAction", "jobManager"); Map<String, Object> result = getJobService().getJobList(filter); filter.putAll(result); request.setAttribute("result", filter); } else if ("viewJobInfo".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/jobInfo.jsp"); request.setAttribute("nowAction", "jobManager"); Map<String, Object> result = getJobService().getJobTrigger(filter); filter.putAll(result); request.setAttribute("result", filter); } else if ("suspendJob".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/jobList.jsp"); request.setAttribute("nowAction", "jobManager"); getJobService().suspendJob(filter); Map<String, Object> result = getJobService().getJobList(filter); filter.putAll(result); request.setAttribute("result", filter); } else if ("continueJob".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/jobList.jsp"); getJobService().continueJob(filter); request.setAttribute("nowAction", "jobManager"); Map<String, Object> result = getJobService().getJobList(filter); filter.putAll(result); request.setAttribute("result", filter); } else if ("suspendTrigger".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/jobInfo.jsp"); getJobService().suspendTrigger(filter); request.setAttribute("nowAction", "jobManager"); Map<String, Object> result = getJobService().getJobTrigger(filter); filter.putAll(result); request.setAttribute("result", filter); } else if ("continueTrigger".equals(action)) { rd = request.getRequestDispatcher("/fixflow/manager/jobInfo.jsp"); getJobService().continueTrigger(filter); request.setAttribute("nowAction", "jobManager"); Map<String, Object> result = getJobService().getJobTrigger(filter); filter.putAll(result); request.setAttribute("result", filter); } else if ("setHis".equals(action)) { rd = request.getRequestDispatcher("/FlowManager?action=processManageList"); getFlowManager().setHistory(filter); } else if ("updateCache".equals(action)) { ProcessEngineManagement.getDefaultProcessEngine().cleanCache(true, true); response.getWriter().write("update success!"); } } catch (Exception e) { e.printStackTrace(); request.setAttribute("errorMsg", e.getMessage()); try { CurrentThread.rollBack(); } catch (SQLException e1) { e1.printStackTrace(); request.setAttribute("errorMsg", e.getMessage()); } } finally { if (out != null) { out.flush(); out.close(); } try { CurrentThread.clear(); } catch (SQLException e) { e.printStackTrace(); request.setAttribute("errorMsg", e.getMessage()); } } if (rd != null) rd.forward(request, response); }
From source file:servlets.LeasingControllerServlet.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try {/* ww w .j a v a 2s . c o m*/ RequestDispatcher dispatcher; ServletContext servletContext = getServletContext(); String page = request.getPathInfo().substring(1); String mallName = (String) request.getSession().getAttribute("mallName"); int numOfLevel; String staffPosition; String staffUserName; String levelCode; ArrayList<String> unitListToAddTenant; String leasingRequestType; Long leasingRequestId; ArrayList<LeasingSystemRequestEntity> requestList; boolean alreadyInitialized; TenantEntity tenant; ArrayList<TenantEntity> allTenantList; switch (page) { //START-FUNCTION FOR LEASING MANAGER case "ViewAllRequests": System.err.println("IT GOES HERE"); page = "LeasingManagerViewAllRequests"; break; case "ViewLeasingRequestDetail": leasingRequestId = Long.parseLong(request.getParameter("leasingRequestId")); leasingRequestType = determineLeasingRequestType(leasingRequestId, request); if (leasingRequestType.equals("FloorplanModify")) { request.getSession().setAttribute("levelCode", "LV1"); page = "LeasingManagerReviewFloorPlanPrototype"; } if (leasingRequestType.equals("CategoryModify")) { request.getSession().setAttribute("levelCode", "LV1"); page = "LeasingManagerReviewCategoryPrototype"; } if (leasingRequestType.equals("PublicOpenBid")) { request.getSession().setAttribute("levelCode", "LV1"); LeasingSystemRequestEntity leasingRequestInstance = doGetLeasingRequestById(leasingRequestId); request.getSession().setAttribute("leasingRequestInstance", leasingRequestInstance); page = "LeasingManagerReviewOpenPublicBidPrototype"; } if (leasingRequestType.equals("LongTermApplicationApproval")) { LongTermApplicationEntity longTermApplication = doGetLongTermApplication(request); request.setAttribute("longTermApplication", longTermApplication); page = "LeasingManagerReviewLongTermApplicationApproval"; } if (leasingRequestType.equals("ContractRenewRequest")) { LeasingSystemRequestEntity leasingRequestInstance = doGetLeasingRequestById(leasingRequestId); request.setAttribute("leasingRequestInstance", leasingRequestInstance); TenantEntity tempRenewTenant = tenantManagerSessionLocal .getTenantById(leasingRequestInstance.getApplicationId()); request.setAttribute("renewTenant", tempRenewTenant); page = "LeasingManagerReviewContractRenewRequest"; } break; case "ChangeFloorplanLevelReviewFloorPlanPrototype": levelCode = request.getParameter("levelCode"); request.getSession().setAttribute("levelCode", levelCode); page = "LeasingManagerReviewFloorPlanPrototype"; break; case "ChangeFloorplanLevelReviewCategoryPrototype": levelCode = request.getParameter("levelCode"); request.getSession().setAttribute("levelCode", levelCode); page = "LeasingManagerReviewCategoryPrototype"; break; case "ChangeFloorplanLevelReviewPublicOpenBidPrototype": levelCode = request.getParameter("levelCode"); request.getSession().setAttribute("levelCode", levelCode); page = "LeasingManagerReviewOpenPublicBidPrototype"; break; case "BackToViewAllLeasingRequests": page = "LeasingManagerViewAllRequests"; break; case "AcceptLeasingRequest": leasingRequestId = Long.parseLong(request.getParameter("leasingRequestId")); leasingRequestType = determineLeasingRequestType(leasingRequestId, request); if (leasingRequestType.equals("FloorplanModify")) { doAcceptUpdateFloorPlanAndUpdateRequest(request); page = "LeasingManagerViewAllRequests"; } if (leasingRequestType.equals("CategoryModify")) { doAcceptUpdateCategoryAndUpdateRequest(request); page = "LeasingManagerViewAllRequests"; } if (leasingRequestType.equals("PublicOpenBid")) { doAcceptUpdateOpenBidAndUpdateRequest(request); page = "LeasingManagerViewAllRequests"; } if (leasingRequestType.equals("LongTermApplicationApproval")) { doAcceptUpdateLongTermApplicationAndUpdateRequest(request); page = "LeasingManagerViewAllRequests"; } if (leasingRequestType.equals("ContractRenewRequest")) { doAcceptContractRenewRequest(request); page = "LeasingManagerViewAllRequests"; } break; case "RejectLeasingRequest": leasingRequestId = Long.parseLong(request.getParameter("leasingRequestId")); leasingRequestType = determineLeasingRequestType(leasingRequestId, request); if (leasingRequestType.equals("FloorplanModify")) { doRejectUpdateFloorPlanAndUpdateRequest(request); page = "LeasingManagerViewAllRequests"; } if (leasingRequestType.equals("CategoryModify") || leasingRequestType.equals("LongTermApplicationApproval") || leasingRequestType.equals("ContractRenewRequest")) { doRejectUpdateRequest(request); page = "LeasingManagerViewAllRequests"; } if (leasingRequestType.equals("PublicOpenBid")) { doRejectUpdateOpenBidAndUpdateRequest(request); page = "LeasingManagerViewAllRequests"; } break; case "ViewTenantMixLM": request.getSession().setAttribute("levelCode", "LV1"); request.getSession().removeAttribute("unitListToAddTenant"); request.getSession().removeAttribute("errorMessage"); page = "LeasingManagerViewTenantMix"; break; case "ChangeLevelTenantMixLM": levelCode = request.getParameter("levelCode"); request.getSession().setAttribute("levelCode", levelCode); request.getSession().removeAttribute("errorMessage"); page = "LeasingManagerViewTenantMix"; break; case "ViewCurrentTenantLM": allTenantList = doGetAllTenants(request); request.getSession().setAttribute("allTenantList", allTenantList); page = "LeasingManagerViewCurrentTenants"; break; case "ViewTenantDetailLM": tenant = doGetTenantById(request); request.setAttribute("detailedTenant", tenant); page = "LeasingOfficerViewTenantDetail"; break; //END-FUNCTION FOR LEASING MANAGER //START-FUNCTION FOR LEASING OFFICER case "LeasingOfficerMain": request.getSession().removeAttribute("unitListToAddTenant"); request.getSession().removeAttribute("errorMessage"); request.getSession().setAttribute("levelCode", "LV1"); alreadyInitialized = doCheckInitialization(request); if (!alreadyInitialized) { request.setAttribute("errorMessage", "Floorplan has not been initialized and therefore cannot be accessed"); page = "leasingSystemError"; } else { page = "LeasingOfficerZoneDeclare"; } break; case "DeclareZone": request.getSession().setAttribute("levelCode", "LV1"); page = "LeasingOfficerZoneDeclare"; break; case "SaveStoreZonePrototypeCategory": String saveZoneStatus = doSaveStoreZonePrototypeCategory(request); request.setAttribute("saveZoneStatus", saveZoneStatus); page = "LeasingOfficerZoneDeclare"; break; case "SavePushCartOrKioskPrototypeCategory": String savePushCartOrKioskStatus = doSavePushCartOrKioskPrototypeCategory(request); page = "LeasingOfficerZoneDeclare"; break; case "ChangeFloorplanLevelZoneDeclare": levelCode = request.getParameter("levelCode"); request.getSession().setAttribute("levelCode", levelCode); page = "LeasingOfficerZoneDeclare"; break; case "AddUnitToListToAddTenant": String chooseUnitStatus = doAddUnitsToListToAddTenant(request); request.setAttribute("chooseUnitStatus", chooseUnitStatus); page = "LeasingOfficerChooseUnitForPublicBidding"; break; case "ChooseUnitForPublicBidding": request.getSession().setAttribute("levelCode", "LV1"); request.getSession().removeAttribute("unitListToAddTenant"); request.getSession().removeAttribute("errorMessage"); page = "LeasingOfficerChooseUnitForPublicBidding"; break; case "ChangeFloorplanLevelChooseUnitPublicBidding": levelCode = request.getParameter("levelCode"); request.getSession().setAttribute("levelCode", levelCode); request.getSession().removeAttribute("errorMessage"); page = "LeasingOfficerChooseUnitForPublicBidding"; break; //this code will reuse unitListToAddTenant for convenience //this list is generated in AddUnitToListToAddTenant case "RequestOpenUnitForPublicBidding": doSetOpenPublicBiddingPrototype(request); page = "LeasingOfficerComposePublicOpenBidRequest"; break; case "SendPublicOpenBidRequest": doSendPublicOpenBidRequest(request); request.setAttribute("sendRequestStatus", "Your request has successfully been sent"); request.getSession().setAttribute("levelCode", "LV1"); page = "LeasingOfficerZoneDeclare"; break; case "ViewAllTenants": allTenantList = doGetAllTenants(request); request.getSession().setAttribute("allTenantList", allTenantList); page = "LeasingOfficerViewAllTenants"; break; case "ViewTenantDetail": tenant = doGetTenantById(request); request.setAttribute("detailedTenant", tenant); page = "LeasingOfficerViewTenantDetail"; break; case "ComposeCategoryRequest": page = "LeasingOfficerComposeCategoryRequest"; break; case "SendCategoryRequest": doSendCategoryRequest(request); request.setAttribute("sendRequestStatus", "Your request has successfully been sent"); page = "LeasingOfficerZoneDeclare"; break; case "ViewAllPublicLongTermApplication": page = "LeasingOfficerViewAllPublicLongTerm"; break; case "PrepareContractForLongTermApplicant": Long applicantId = Long.parseLong(request.getParameter("applicantId")); request.getSession().setAttribute("applicantId", applicantId); page = "LeasingOfficerPrepareLongTermContract"; break; case "ComposeLongTermApplicationRequest": doProposeLongTermApplication(request); page = "LeasingOfficerComposeLongTermApplicationRequest"; break; case "SendLongTermApplicationApprovalRequest": doSendLongTermApplicationApprovalRequest(request); request.setAttribute("sendRequestStatus", "Your request has successfully been sent"); page = "LeasingOfficerZoneDeclare"; break; case "CheckLeasingOfficerRequestStatus": requestList = doGetRequestsByUserName(request); request.setAttribute("requestList", requestList); page = "LeasingOfficerCheckRequest"; break; case "DeleteLeasingOfficerRequest": doDeleteLeasingRequestById(request); request.setAttribute("deleteRequestStatus", "Your request has successfully been deleted"); requestList = doGetRequestsByUserName(request); request.setAttribute("requestList", requestList); page = "LeasingOfficerCheckRequest"; break; /////case of delete and (function)list request is on space planner side case "ViewExpiringTenant": page = "LeasingOfficerViewExpiringTenant"; break; case "SendContractRenewalEmail": int success = doSendContractRenewalEmail(request); if (success == 0) { request.setAttribute("ContractRenewEmailStatus", "Contract renewal email has been sent"); } else { request.setAttribute("ContractRenewEmailStatus", "Error while sending email"); } page = "LeasingOfficerViewExpiringTenant"; break; case "RenewContract": TenantEntity renewTenant = tenantManagerSessionLocal .getTenantById(Long.parseLong(request.getParameter("tenantId"))); request.getSession().setAttribute("renewTenant", renewTenant); page = "LeasingOfficerRenewContract"; break; case "ProposeContractRenew": String renewProposeStatus = doProposeRenew(request); request.setAttribute("renewProposeStatus", renewProposeStatus); page = "LeasingOfficerViewExpiringTenant"; break; case "ViewEventApplication": page = "LeasingOfficerViewAllEventApplication"; break; case "AcceptEventApplication": EventEntity event = doGetEventById(request); request.setAttribute("event", event); page = "LeasingOfficerPrepareEventContract"; break; case "PersistEventApplicationAcceptance": String acceptEventStatus = doAcceptEventApplication(request); request.setAttribute("acceptEventStatus", acceptEventStatus); page = "LeasingOfficerViewAllEventApplication"; break; case "ViewAllEvent": page = "LeasingOfficerViewAllEvent"; break; case "DeleteEvent": String deleteEventStatus = doDeleteEventWithId(request); request.setAttribute("deleteEventStatus", deleteEventStatus); page = "LeasingOfficerViewAllEvent"; break; case "ViewPendingTenant": //pendingList in ESSENTIAL ZONE page = "LeasingOfficerViewPendingTenant"; break; case "OfficializePendingTenant": String officializeStatus = doOfficializePendingTenant(request); request.setAttribute("officializeStatus", officializeStatus); page = "LeasingOfficerViewPendingTenant"; break; case "DeleteExpireTenant": String deleteTenantStatus = doDeleteExpireTenant(request); request.setAttribute("deleteTenantStatus", deleteTenantStatus); page = "LeasingOfficerViewExpiringTenant"; break; case "ViewTenantRequest": getRentReqList(request); page = "LeasingOfficerViewAllRentRequest"; break; case "AcceptRentRequest": changeRentReqStatus(request, "Accepted"); getRentReqList(request); page = "LeasingOfficerViewAllRentRequest"; break; case "RejectRentRequest": changeRentReqStatus(request, "Rejected"); getRentReqList(request); page = "LeasingOfficerViewAllRentRequest"; break; //END-FUNCTION FOR LEASING OFFICER //START-FUNCTION FOR SPACE PLAN OFFICER case "SpacePlanMain": alreadyInitialized = doCheckInitialization(request); if (!alreadyInitialized) { page = "SpacePlanDeclare"; } else { page = "SpacePlanLocate"; request.getSession().setAttribute("levelCode", "LV1"); } request.getSession().setAttribute("actionToTake", "UploadFloorplanBackground"); //if already initialized, then go straight to main menu break; case "InitializeSpacePlan": request.getSession().setAttribute("actionToTake", "DeclareNumOfLevel"); page = "SpacePlanDeclare"; break; case "DeclareNumOfLevel": if (request.getParameter("numOfLevel") != null) { String numOfLevelString = (String) request.getParameter("numOfLevel"); numOfLevel = Integer.valueOf(numOfLevelString.trim()); request.getSession().setAttribute("numOfLevel", numOfLevel); } request.getSession().setAttribute("actionToTake", "DeclareNumOfUnitPerLevel"); page = "SpacePlanDeclare"; break; case "DeclareNumOfUnitPerLevel": ArrayList<ArrayList<String>> levelNameNumUnitList = doGetLevelNameNumUnitList(request); request.getSession().setAttribute("levelNameNumUnitList", levelNameNumUnitList); for (int i = 0; i < levelNameNumUnitList.size(); i++) { ArrayList<String> test = levelNameNumUnitList.get(i); } request.getSession().setAttribute("actionToTake", "DeclareFloorplanBackground"); page = "SpacePlanDeclare"; break; case "DeclareFloorplanBackground": ArrayList<ArrayList<String>> levelNameNumUnitBackgroundList = doGetLevelNameNumUnitBackgroundList( request); request.getSession().setAttribute("levelNameNumUnitBackgroundList", levelNameNumUnitBackgroundList); request.getSession().setAttribute("actionToTake", "FinalConfirmation"); page = "SpacePlanDeclare"; break; case "DeclareAgain": request.getSession().setAttribute("actionToTake", "DeclareNumOfLevel"); page = "SpacePlanDeclare"; break; case "SaveUnitPosition": doAddLocalStorageInfo(request); page = "SpacePlanLocate"; break; case "FinalConfirmation": doCreateAllUnit(request); request.getSession().setAttribute("levelCode", "LV1"); page = "SpacePlanLocate"; break; //////////////////////////////////ACCESS ONLY FOR REPOSITION case "LocateSpacePlan": if (request.getSession().getAttribute("levelCode") == null) { request.getSession().setAttribute("levelCode", "LV1"); } page = "SpacePlanLocate"; break; case "ChangeFloorplanLevelSpacePlanning": levelCode = request.getParameter("levelCode"); request.getSession().setAttribute("levelCode", levelCode); page = "SpacePlanLocate"; break; case "AddPushCart": page = "SpacePlanPushCartDeclare"; break; case "AddKiosk": page = "SpacePlanKioskDeclare"; break; case "AddNumOfKioskPerLevel": doAddNumOfKioskPerLevel(request); page = "SpacePlanLocate"; break; case "AddEvent": page = "SpacePlanEventDeclare"; break; case "AddNumOfEventPerLevel": doAddNumOfEventPerLevel(request); page = "SpacePlanLocate"; break; case "AddStore": page = "SpacePlanStoreDeclare"; break; case "AddNumOfStorePerLevel": doAddNumOfStorePerLevel(request); page = "SpacePlanLocate"; break; case "AddNumOfPushCartPerLevel": doAddNumOfPushCartPerLevel(request); page = "SpacePlanLocate"; break; case "ComposeFloorplanRequest": page = "SpacePlanComposeRequest"; break; case "SendFloorplanRequest": doSendFloorplanRequest(request); request.setAttribute("sendRequestStatus", "Your request has successfully been sent"); page = "SpacePlanLocate"; break; case "ProposeDeleteSingleUnit": request.setAttribute("unitDeleteStatus", doSetUnitDelete(request)); page = "SpacePlanLocate"; break; case "CheckSpacePlanRequestStatus": requestList = doGetRequestsByUserName(request); request.setAttribute("requestList", requestList); page = "SpacePlanCheckRequest"; break; case "DeleteFloorPlanRequest": doDeleteLeasingRequestById(request); request.setAttribute("deleteRequestStatus", "Your request has successfully been deleted"); requestList = doGetRequestsByUserName(request); request.setAttribute("requestList", requestList); page = "SpacePlanCheckRequest"; break; } //END-FUNCTION FOR SPACE PLAN OFFICER /////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////START ESSENTIALS ZONE/////////////////////////////////////////////////////////// if (page.equals("LeasingOfficerViewAllEvent")) { ArrayList<EventEntity> allEventList = doGetAllEvent(request); request.setAttribute("allEventList", allEventList); } if (page.equals("LeasingOfficerViewAllEventApplication")) { ArrayList<EventEntity> eventApplicationList = doGetAllEventApplication(request); request.setAttribute("eventApplicationList", eventApplicationList); } if (page.equals("LeasingOfficerViewPendingTenant")) { ArrayList<TenantEntity> pendingTenantList = doGetAllPendingTenant(request); request.setAttribute("pendingTenantList", pendingTenantList); } if (page.equals("LeasingOfficerViewExpiringTenant")) { ArrayList<Object[]> expiringTenantList = doGetExpiringTenant(request); request.setAttribute("expiringTenantList", expiringTenantList); } if (page.equals("LeasingOfficerChooseUnitForTenant") || page.equals("LeasingOfficerChooseUnitForPublicBidding") || page.equals("LeasingManagerViewTenantMix")) { numOfLevel = doGetNumOfLevel((String) request.getSession().getAttribute("mallName")); request.getSession().setAttribute("numOfLevel", numOfLevel); Vector unitColorVector = doGetAllUnitColorForCurrentMall(request); request.getSession().setAttribute("unitColorVector", unitColorVector); } if (page.equals("LeasingOfficerZoneDeclare") || page.equals("LeasingManagerReviewCategoryPrototype") || page.equals("LeasingManagerReviewOpenPublicBidPrototype")) { numOfLevel = doGetNumOfLevel((String) request.getSession().getAttribute("mallName")); request.getSession().setAttribute("numOfLevel", numOfLevel); Vector unitColorVector = doGetAllPrototypeUnitColorForCurrentMall(request); request.setAttribute("unitColorVector", unitColorVector); } if (page.equals("SpacePlanLocate") || page.equals("LeasingOfficerZoneDeclare") || page.equals("LeasingOfficerChooseUnitForTenant") || page.equals("LeasingManagerReviewFloorPlanPrototype") || page.equals("LeasingManagerReviewCategoryPrototype") || page.equals("LeasingOfficerChooseUnitForPublicBidding") || page.equals("LeasingManagerReviewOpenPublicBidPrototype") || page.equals("LeasingManagerViewTenantMix")) { numOfLevel = doGetNumOfLevel((String) request.getSession().getAttribute("mallName")); request.getSession().setAttribute("numOfLevel", numOfLevel); LevelEntity levelInstance = doGetLevel(request); request.getSession().setAttribute("levelInstance", levelInstance); } if (page.equals("LeasingManagerViewAllRequests")) { numOfLevel = doGetNumOfLevel((String) request.getSession().getAttribute("mallName")); request.getSession().setAttribute("numOfLevel", numOfLevel); ArrayList<LeasingSystemRequestEntity> leasingRequestList = doGetListOfAllLeasingRequests(request); request.getSession().setAttribute("leasingRequestList", leasingRequestList); } if (page.equals("LeasingOfficerViewAllPublicLongTerm")) { numOfLevel = doGetNumOfLevel((String) request.getSession().getAttribute("mallName")); request.getSession().setAttribute("numOfLevel", numOfLevel); ArrayList<LongTermApplicationEntity> longTermApplicationList = doGetLongTermApplicationList( request); request.setAttribute("longTermApplicationList", longTermApplicationList); } dispatcher = servletContext.getNamedDispatcher(page); dispatcher.forward(request, response); /////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////END ESSENTIALS ZONE/////////////////////////////////////////////////////////// } catch (Exception ex) { ex.printStackTrace(); } }