List of usage examples for org.springframework.web.context.support WebApplicationContextUtils getRequiredWebApplicationContext
public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc) throws IllegalStateException
From source file:org.osaf.cosmo.log.HttpLoggingFilter.java
public void init(FilterConfig config) throws ServletException { WebApplicationContext wac = WebApplicationContextUtils .getRequiredWebApplicationContext(config.getServletContext()); this.securityManager = (CosmoSecurityManager) wac.getBean(BEAN_SECURITY_MANAGER, CosmoSecurityManager.class); if (this.securityManager == null) { throw new ServletException( "Could not initialize HttpLoggingFilter: " + "Could not find security manager."); }//from w w w . ja v a 2 s . c om String format = (String) wac.getBean(BEAN_HTTP_LOGGING_FORMAT, String.class); if (format != null) { try { this.format = (String) format; } catch (ClassCastException e) { throw new ServletException( "Could not initialize HttpLoggingFilter: " + "httpLoggingFormat is not a string."); } } }
From source file:org.osaf.cosmo.ui.config.ConfigurationListener.java
/** * Gets the configurer from the/*w w w . j a v a 2s.com*/ * {@link org.springframework.web.context.WebApplicationContext} * and directs it to configure the servlet context. */ public void contextInitialized(ServletContextEvent sce) { ServletContext sc = sce.getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(sc); // load application configuration ServletContextConfigurer scc = (ServletContextConfigurer) wac.getBean(BEAN_SERVLET_CONTEXT_CONFIGURER, ServletContextConfigurer.class); scc.configure(sc); }
From source file:org.oscarehr.caseload.CaseloadContentAction.java
private JSONArray generateCaseloadDataForDemographics(HttpServletRequest request, HttpServletResponse response, String caseloadProv, List<Integer> demoSearchResult) { JSONArray entry;//from ww w. j a v a2s .c o m String buttons; JSONArray data = new JSONArray(); if (demoSearchResult == null || demoSearchResult.size() < 1) return data; CaseloadDao caseloadDao = (CaseloadDao) SpringUtils.getBean("caseloadDao"); HttpSession session = request.getSession(); WebApplicationContext webApplicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(session.getServletContext()); String roleName$ = (String) session.getAttribute("userrole") + "," + (String) session.getAttribute("user"); String curUser_no = (String) session.getAttribute("user"); String userfirstname = (String) session.getAttribute("userfirstname"); String userlastname = (String) session.getAttribute("userlastname"); GregorianCalendar cal = new GregorianCalendar(); int curYear = cal.get(Calendar.YEAR); int curMonth = (cal.get(Calendar.MONTH) + 1); int curDay = cal.get(Calendar.DAY_OF_MONTH); int year = Integer.parseInt(request.getParameter("year")); int month = Integer.parseInt(request.getParameter("month")); int day = Integer.parseInt(request.getParameter("day")); java.util.Date apptime = new java.util.Date(); OscarProperties oscarProperties = OscarProperties.getInstance(); boolean bShortcutForm = oscarProperties.getProperty("appt_formview", "").equalsIgnoreCase("on") ? true : false; String formName = bShortcutForm ? oscarProperties.getProperty("appt_formview_name") : ""; String formNameShort = formName.length() > 3 ? (formName.substring(0, 2) + ".") : formName; String formName2 = bShortcutForm ? oscarProperties.getProperty("appt_formview_name2", "") : ""; String formName2Short = formName2.length() > 3 ? (formName2.substring(0, 2) + ".") : formName2; boolean bShortcutForm2 = bShortcutForm && !formName2.equals(""); boolean bShortcutIntakeForm = oscarProperties.getProperty("appt_intake_form", "").equalsIgnoreCase("on") ? true : false; String monthDay = String.format("%02d", month) + "-" + String.format("%02d", day); String prov = oscarProperties.getProperty("billregion", "").trim().toUpperCase(); for (Integer result : demoSearchResult) { if (result == null) continue; String demographic_no = result.toString(); entry = new JSONArray(); // name String demographicQuery = "cl_demographic_query"; String[] demographicParam = new String[1]; demographicParam[0] = demographic_no; List<Map<String, Object>> demographicResult = caseloadDao.getCaseloadDemographicData(demographicQuery, demographicParam); String clLastName = demographicResult.get(0).get("last_name").toString(); String clFirstName = demographicResult.get(0).get("first_name").toString(); String clFullName = StringEscapeUtils.escapeJavaScript(clLastName + ", " + clFirstName).toUpperCase(); entry.add(clFullName); // add E button to string buttons = ""; if (hasPrivilege("_eChart", roleName$)) { String encType = ""; try { encType = URLEncoder.encode("face to face encounter with client", "UTF-8"); } catch (UnsupportedEncodingException e) { MiscUtils.getLogger().error("Couldn't encode string", e); } String eURL = "../oscarEncounter/IncomingEncounter.do?providerNo=" + curUser_no + "&appointmentNo=0&demographicNo=" + demographic_no + "&curProviderNo=" + caseloadProv + "&reason=&encType=" + encType + "&userName=" + URLEncoder.encode(userfirstname + " " + userlastname) + "&curDate=" + curYear + "-" + curMonth + "-" + curDay + "&appointmentDate=" + year + "-" + month + "-" + day + "&startTime=" + apptime.getHours() + ":" + apptime.getMinutes() + "&status=T" + "&apptProvider_no=" + caseloadProv + "&providerview=" + caseloadProv; buttons += "<a href='#' onClick=\"popupPage(710, 1024,'../oscarSurveillance/CheckSurveillance.do?demographicNo=" + demographic_no + "&proceed=" + URLEncoder.encode(eURL) + "');return false;\" title='Encounter'>E</a> "; } // add form links to string if (hasPrivilege("_billing", roleName$)) { buttons += bShortcutForm ? "| <a href=# onClick='popupPage2( \"../form/forwardshortcutname.jsp?formname=" + formName + "&demographic_no=" + demographic_no + "\")' title='form'>" + formNameShort + "</a> " : ""; buttons += bShortcutForm2 ? "| <a href=# onClick='popupPage2( \"../form/forwardshortcutname.jsp?formname=" + formName2 + "&demographic_no=" + demographic_no + "\")' title='form'>" + formName2Short + "</a> " : ""; buttons += (bShortcutIntakeForm) ? "| <a href='#' onClick='popupPage(700, 1024, \"formIntake.jsp?demographic_no=" + demographic_no + "\")'>In</a> " : ""; } // add B button to string if (hasPrivilege("_billing", roleName$)) { buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../billing.do?skipReload=true&billRegion=" + URLEncoder.encode(prov) + "&billForm=" + URLEncoder.encode(oscarProperties.getProperty("default_view")) + "&hotclick=&appointment_no=0&demographic_name=" + URLEncoder.encode(clLastName) + "%2C" + URLEncoder.encode(clFirstName) + "&demographic_no=" + demographic_no + "&providerview=1&user_no=" + curUser_no + "&apptProvider_no=none&appointment_date=" + year + "-" + month + "-" + day + "&start_time=0:00&bNewForm=1&status=t');return false;\" title='Billing'>B</a> "; buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../billing/CA/ON/billinghistory.jsp?demographic_no=" + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name=" + URLEncoder.encode(clFirstName) + "&orderby=appointment_date&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=10');return false;\" title='Billing'>BHx</a> "; } // add M button to string if (hasPrivilege("_masterLink", roleName$)) { buttons += "| <a href='#' onClick=\"popupPage(700,1000,'../demographic/demographiccontrol.jsp?demographic_no=" + demographic_no + "&displaymode=edit&dboperation=search_detail');return false;\" title='Master File'>M</a> "; } // add Rx button to string if (isModuleLoaded(request, "TORONTO_RFQ", true) && hasPrivilege("_appointment.doctorLink", roleName$)) { buttons += "| <a href='#' onClick=\"popupOscarRx(700,1027,'../oscarRx/choosePatient.do?providerNo=" + curUser_no + "&demographicNo=" + demographic_no + "');return false;\">Rx</a> "; } // add Tickler button to string buttons += "| <a href='#' onclick=\"popupPage('700', '1000', '../tickler/ticklerAdd.jsp?name=" + URLEncoder.encode(clLastName) + "%2C" + URLEncoder.encode(clFirstName) + "&chart_no=&bFirstDisp=false&demographic_no=" + demographic_no + "&messageID=null&doctor_no=" + curUser_no + "'); return false;\">T</a> "; // add Msg button to string buttons += "| <a href='#' onclick=\"popupPage('700', '1000', '../oscarMessenger/SendDemoMessage.do?demographic_no=" + demographic_no + "'); return false;\">Msg</a> "; entry.add(buttons); // age String clAge = demographicResult.get(0).get("age") != null ? demographicResult.get(0).get("age").toString() : ""; String clBDay = demographicResult.get(0).get("month_of_birth").toString() + "-" + demographicResult.get(0).get("date_of_birth").toString(); if (isBirthday(monthDay, clBDay)) { clAge += " <img src='../images/cake.gif' height='20' />"; } entry.add(clAge); // sex String clSex = demographicResult.get(0).get("sex").toString(); entry.add(clSex); // last appt String lapptQuery = "cl_last_appt"; List<Map<String, Object>> lapptResult = caseloadDao.getCaseloadDemographicData(lapptQuery, demographicParam); if ((!lapptResult.isEmpty()) && lapptResult.get(0).get("max(appointment_date)") != null && !lapptResult.get(0).get("max(appointment_date)").toString().equals("")) { String clLappt = lapptResult.get(0).get("max(appointment_date)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../demographic/demographiccontrol.jsp?demographic_no=" + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name=" + URLEncoder.encode(clFirstName) + "&orderby=appttime&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=25'); return false;\">" + clLappt + "</a>"); } else { entry.add(" "); } // next appt String napptQuery = "cl_next_appt"; List<Map<String, Object>> napptResult = caseloadDao.getCaseloadDemographicData(napptQuery, demographicParam); if (!napptResult.isEmpty() && napptResult.get(0).get("min(appointment_date)") != null && !napptResult.get(0).get("min(appointment_date)").toString().equals("")) { String clNappt = napptResult.get(0).get("min(appointment_date)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../demographic/demographiccontrol.jsp?demographic_no=" + demographic_no + "&last_name=" + URLEncoder.encode(clLastName) + "&first_name=" + URLEncoder.encode(clFirstName) + "&orderby=appttime&displaymode=appt_history&dboperation=appt_history&limit1=0&limit2=25'); return false;\">" + clNappt + "</a>"); } else { entry.add(" "); } // num appts in last year String numApptsQuery = "cl_num_appts"; List<Map<String, Object>> numApptsResult = caseloadDao.getCaseloadDemographicData(numApptsQuery, demographicParam); if (!numApptsResult.isEmpty() && numApptsResult.get(0).get("count(*)") != null && !numApptsResult.get(0).get("count(*)").toString().equals("") && !numApptsResult.get(0).get("count(*)").toString().equals("0")) { String clNumAppts = numApptsResult.get(0).get("count(*)").toString(); entry.add(clNumAppts); } else { entry.add(" "); } // new labs String[] userDemoParam = new String[2]; userDemoParam[0] = curUser_no; userDemoParam[1] = demographic_no; String newLabQuery = "cl_new_labs"; List<Map<String, Object>> newLabResult = caseloadDao.getCaseloadDemographicData(newLabQuery, userDemoParam); if (!newLabResult.isEmpty() && newLabResult.get(0).get("count(*)") != null && !newLabResult.get(0).get("count(*)").toString().equals("") && !newLabResult.get(0).get("count(*)").toString().equals("0")) { String clNewLab = newLabResult.get(0).get("count(*)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../dms/inboxManage.do?method=prepareForIndexPage&providerNo=" + curUser_no + "&selectedCategory=CATEGORY_PATIENT_SUB&selectedCategoryPatient=" + demographic_no + "&selectedCategoryType=CATEGORY_TYPE_HL7'); return false;\">" + clNewLab + "</a>"); } else { entry.add(" "); } // new docs String newDocQuery = "cl_new_docs"; List<Map<String, Object>> newDocResult = caseloadDao.getCaseloadDemographicData(newDocQuery, userDemoParam); if (!newDocResult.isEmpty() && newDocResult.get(0).get("count(*)") != null && !newDocResult.get(0).get("count(*)").toString().equals("") && !newDocResult.get(0).get("count(*)").toString().equals("0")) { String clNewDoc = newDocResult.get(0).get("count(*)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../dms/inboxManage.do?method=prepareForIndexPage&providerNo=" + curUser_no + "&selectedCategory=CATEGORY_PATIENT_SUB&selectedCategoryPatient=" + demographic_no + "&selectedCategoryType=CATEGORY_TYPE_DOC'); return false;\">" + clNewDoc + "</a>"); } else { entry.add(" "); } // new ticklers String newTicklerQuery = "cl_new_ticklers"; List<Map<String, Object>> newTicklerResult = caseloadDao.getCaseloadDemographicData(newTicklerQuery, demographicParam); if (!newTicklerResult.isEmpty() && newTicklerResult.get(0).get("count(*)") != null && !newTicklerResult.get(0).get("count(*)").toString().equals("") && !newTicklerResult.get(0).get("count(*)").toString().equals("0")) { String clNewTickler = newTicklerResult.get(0).get("count(*)").toString(); entry.add("<a href='#' onclick=\"popupPage('700', '1000', '../tickler/ticklerDemoMain.jsp?demoview=" + demographic_no + "'); return false;\">" + clNewTickler + "</a>"); } else { entry.add(" "); } // new messages String newMsgQuery = "cl_new_msgs"; List<Map<String, Object>> newMsgResult = caseloadDao.getCaseloadDemographicData(newMsgQuery, demographicParam); if (!newMsgResult.isEmpty() && newMsgResult.get(0).get("count(*)") != null && !newMsgResult.get(0).get("count(*)").toString().equals("") && !newMsgResult.get(0).get("count(*)").toString().equals("0")) { String clNewMsg = newMsgResult.get(0).get("count(*)").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarMessenger/DisplayDemographicMessages.do?orderby=date&boxType=3&demographic_no=" + demographic_no + "&providerNo=" + curUser_no + "&userName=" + URLEncoder.encode(userfirstname + " " + userlastname) + "'); return false;\">" + clNewMsg + "</a>"); } else { entry.add(" "); } // measurements String msmtQuery = "cl_measurement"; String[] msmtParam = new String[2]; msmtParam[1] = demographic_no; // BMI msmtParam[0] = "BMI"; List<Map<String, Object>> msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clBmi = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=BMI'); return false;\">" + clBmi + "</a>"); } else { entry.add(" "); } // BP msmtParam[0] = "BP"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clBp = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=BP'); return false;\">" + clBp + "</a>"); } else { entry.add(" "); } // WT msmtParam[0] = "WT"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clWt = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=WT'); return false;\">" + clWt + "</a>"); } else { entry.add(" "); } // SMK msmtParam[0] = "SMK"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clSmk = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=SMK'); return false;\">" + clSmk + "</a>"); } else { entry.add(" "); } // A1C msmtParam[0] = "A1C"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clA1c = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=A1C'); return false;\">" + clA1c + "</a>"); } else { entry.add(" "); } // ACR msmtParam[0] = "ACR"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clAcr = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=ACR'); return false;\">" + clAcr + "</a>"); } else { entry.add(" "); } // SCR msmtParam[0] = "SCR"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clScr = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=SCR'); return false;\">" + clScr + "</a>"); } else { entry.add(" "); } // LDL msmtParam[0] = "LDL"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clLdl = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=LDL'); return false;\">" + clLdl + "</a>"); } else { entry.add(" "); } // HDL msmtParam[0] = "HDL"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clHdl = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=HDL'); return false;\">" + clHdl + "</a>"); } else { entry.add(" "); } // TCHD msmtParam[0] = "TCHD"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clTchd = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=TCHD'); return false;\">" + clTchd + "</a>"); } else { entry.add(" "); } // EGFR msmtParam[0] = "EGFR"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clEgfr = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=EGFR'); return false;\">" + clEgfr + "</a>"); } else { entry.add(" "); } // EYEE msmtParam[0] = "EYEE"; msmtResult = caseloadDao.getCaseloadDemographicData(msmtQuery, msmtParam); if (!msmtResult.isEmpty() && msmtResult.get(0).get("dataField") != null && !msmtResult.get(0).get("dataField").toString().equals("")) { String clEyee = msmtResult.get(0).get("dataField").toString(); entry.add( "<a href='#' onclick=\"popupPage('700', '1000', '../oscarEncounter/oscarMeasurements/SetupDisplayHistory.do?demographicNo=" + demographic_no + "&type=EYEE'); return false;\">" + clEyee + "</a>"); } else { entry.add(" "); } data.add(entry); } return data; }
From source file:org.oscarehr.document.web.ManageDocumentAction.java
private void saveDocNote(final HttpServletRequest request, String docDesc, String demog, String documentId) { Date now = EDocUtil.getDmsDateTimeAsDate(); // String docDesc=d.getDocdesc(); CaseManagementNote cmn = new CaseManagementNote(); cmn.setUpdate_date(now);/* ww w .j a va2 s .c om*/ cmn.setObservation_date(now); cmn.setDemographic_no(demog); HttpSession se = request.getSession(); String user_no = (String) se.getAttribute("user"); String prog_no = new EctProgram(se).getProgram(user_no); WebApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(se.getServletContext()); CaseManagementManager cmm = (CaseManagementManager) ctx.getBean("caseManagementManager"); cmn.setProviderNo("-1");// set the provider no to be -1 so the editor appear as 'System'. Provider provider = EDocUtil.getProvider(user_no); String provFirstName = ""; String provLastName = ""; if (provider != null) { provFirstName = provider.getFirstName(); provLastName = provider.getLastName(); } String strNote = "Document" + " " + docDesc + " " + "created at " + now + " by " + provFirstName + " " + provLastName + "."; cmn.setNote(strNote); cmn.setSigned(true); cmn.setSigning_provider_no("-1"); cmn.setProgram_no(prog_no); SecRoleDao secRoleDao = (SecRoleDao) SpringUtils.getBean("secRoleDao"); SecRole doctorRole = secRoleDao.findByName("doctor"); cmn.setReporter_caisi_role(doctorRole.getId().toString()); cmn.setReporter_program_team("0"); cmn.setPassword("NULL"); cmn.setLocked(false); cmn.setHistory(strNote); cmn.setPosition(0); cmm.saveNoteSimple(cmn); // Add a noteLink to casemgmt_note_link CaseManagementNoteLink cmnl = new CaseManagementNoteLink(); cmnl.setTableName(CaseManagementNoteLink.DOCUMENT); cmnl.setTableId(Long.parseLong(documentId)); cmnl.setNoteId(Long.parseLong(EDocUtil.getLastNoteId())); EDocUtil.addCaseMgmtNoteLink(cmnl); }
From source file:org.oscarehr.document.web.SplitDocumentAction.java
public ActionForward split(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {/*ww w . ja v a 2 s.c o m*/ String docNum = request.getParameter("document"); String[] commands = request.getParameterValues("page[]"); String queueId = request.getParameter("queueID"); LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request); String providerNo = loggedInInfo.getLoggedInProviderNo(); Document doc = documentDao.getDocument(docNum); String docdownload = oscar.OscarProperties.getInstance().getProperty("DOCUMENT_DIR"); String newFilename = doc.getDocfilename(); FileInputStream input = null; PDDocument pdf = null; PDDocument newPdf = null; try { input = new FileInputStream(docdownload + doc.getDocfilename()); PDFParser parser = new PDFParser(input); parser.parse(); pdf = parser.getPDDocument(); newPdf = new PDDocument(); List pages = pdf.getDocumentCatalog().getAllPages(); if (commands != null) { for (String c : commands) { String[] command = c.split(","); int pageNum = Integer.parseInt(command[0]); int rotation = Integer.parseInt(command[1]); PDPage p = (PDPage) pages.get(pageNum - 1); p.setRotation(rotation); newPdf.addPage(p); } } //newPdf.save(docdownload + newFilename); if (newPdf.getNumberOfPages() > 0) { EDoc newDoc = new EDoc("", "", newFilename, "", providerNo, doc.getDoccreator(), "", 'A', DateFormatUtils.format(new Date(), "yyyy-MM-dd"), "", "", "demographic", "-1", 0); newDoc.setDocPublic("0"); newDoc.setContentType("application/pdf"); newDoc.setNumberOfPages(newPdf.getNumberOfPages()); String newDocNo = EDocUtil.addDocumentSQL(newDoc); newPdf.save(docdownload + newDoc.getFileName()); newPdf.close(); WebApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(request.getSession().getServletContext()); ProviderInboxRoutingDao providerInboxRoutingDao = (ProviderInboxRoutingDao) ctx .getBean("providerInboxRoutingDAO"); providerInboxRoutingDao.addToProviderInbox("0", Integer.parseInt(newDocNo), "DOC"); List<ProviderInboxItem> routeList = providerInboxRoutingDao .getProvidersWithRoutingForDocument("DOC", Integer.parseInt(docNum)); for (ProviderInboxItem i : routeList) { providerInboxRoutingDao.addToProviderInbox(i.getProviderNo(), Integer.parseInt(newDocNo), "DOC"); } providerInboxRoutingDao.addToProviderInbox(providerNo, Integer.parseInt(newDocNo), "DOC"); QueueDocumentLinkDao queueDocumentLinkDAO = (QueueDocumentLinkDao) ctx .getBean("queueDocumentLinkDAO"); Integer qid = queueId == null ? 1 : Integer.parseInt(queueId); Integer did = Integer.parseInt(newDocNo.trim()); queueDocumentLinkDAO.addActiveQueueDocumentLink(qid, did); ProviderLabRoutingDao providerLabRoutingDao = (ProviderLabRoutingDao) SpringUtils .getBean("providerLabRoutingDao"); List<ProviderLabRoutingModel> result = providerLabRoutingDao .getProviderLabRoutingDocuments(Integer.parseInt(docNum)); if (!result.isEmpty()) { new ProviderLabRouting().route(newDocNo, result.get(0).getProviderNo(), "DOC"); } PatientLabRoutingDao patientLabRoutingDao = (PatientLabRoutingDao) SpringUtils .getBean("patientLabRoutingDao"); List<PatientLabRouting> result2 = patientLabRoutingDao .findDocByDemographic(Integer.parseInt(docNum)); if (!result2.isEmpty()) { PatientLabRouting newPatientRoute = new PatientLabRouting(); newPatientRoute.setDemographicNo(result2.get(0).getDemographicNo()); newPatientRoute.setLabNo(Integer.parseInt(newDocNo)); newPatientRoute.setLabType("DOC"); patientLabRoutingDao.persist(newPatientRoute); } CtlDocumentDao ctlDocumentDao = SpringUtils.getBean(CtlDocumentDao.class); CtlDocument result3 = ctlDocumentDao.getCtrlDocument(Integer.parseInt(docNum)); if (result3 != null) { CtlDocumentPK ctlDocumentPK = new CtlDocumentPK(Integer.parseInt(newDocNo), "demographic"); CtlDocument newCtlDocument = new CtlDocument(); newCtlDocument.setId(ctlDocumentPK); newCtlDocument.getId().setModuleId(result3.getId().getModuleId()); newCtlDocument.setStatus(result3.getStatus()); documentDao.persist(newCtlDocument); } if (result.isEmpty() || result2.isEmpty()) { String json = "{newDocNum:" + newDocNo + "}"; JSONObject jsonObject = JSONObject.fromObject(json); response.setContentType("application/json"); PrintWriter printWriter = response.getWriter(); printWriter.print(jsonObject); printWriter.flush(); return null; } } } catch (Exception e) { MiscUtils.getLogger().error(e.getMessage(), e); return null; } finally { try { if (pdf != null) pdf.close(); if (input != null) input.close(); } catch (IOException e) { //do nothing } } return mapping.findForward("success"); }
From source file:org.patientview.radar.util.DemographicsDecryptData2SqlMapper.java
public void run(ServletContext servletContext) throws Exception { WebApplicationContext webApplicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); jdbcTemplate = new JdbcTemplate((DataSource) webApplicationContext.getBean("dataSource")); List<Patient> patientList = jdbcTemplate.query("SELECT * FROM patient", new EncryptedDemographicsRowMapper()); StringBuilder outputText = new StringBuilder(); for (Patient patient : patientList) { String updateStatement = "UPDATE patient SET "; if (patient.getNhsno() != null) { updateStatement += " nhsno = '" + patient.getNhsno() + "', "; }/*from ww w . j a v a2 s .c o m*/ if (patient.getHospitalnumber() != null) { updateStatement += " hospitalnumber = \"" + patient.getHospitalnumber() + "\", "; } if (patient.getSurname() != null) { updateStatement += " surname = \"" + patient.getSurname() + "\", "; } if (patient.getForename() != null) { updateStatement += " forename = \"" + patient.getForename() + "\", "; } if (patient.getSurnameAlias() != null) { updateStatement += " surnameAlias = \"" + patient.getSurnameAlias() + "\", "; } if (patient.getDob() != null) { // just guess what a sane date format is updateStatement += " dateofbirth = \"" + new SimpleDateFormat(DATE_FORMAT_2).format(patient.getDob()) + "\", "; } if (patient.getAddress1() != null) { updateStatement += " address1 = \"" + patient.getAddress1() + "\", "; } if (patient.getAddress2() != null) { updateStatement += " address2 = \"" + patient.getAddress2() + "\", "; } if (patient.getAddress3() != null) { updateStatement += " address3 = \"" + patient.getAddress3() + "\", "; } if (patient.getAddress4() != null) { updateStatement += " address4 = \"" + patient.getAddress4() + "\", "; } if (patient.getPostcode() != null) { updateStatement += " POSTCODE = \"" + patient.getPostcode() + "\", "; } if (patient.getPostcodeOld() != null) { updateStatement += " postcodeOld = \"" + patient.getPostcodeOld() + "\", "; } updateStatement += " radarNo = " + patient.getId(); updateStatement += " WHERE radarNo = " + patient.getId(); updateStatement += " ;"; outputText.append(updateStatement); } // output all sql stuff to file FileWriter fileWriter = new FileWriter(FILE); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); bufferedWriter.write(outputText.toString()); //Close the output stream bufferedWriter.close(); }
From source file:org.pentaho.platform.web.servlet.ServletToBeanProxy.java
protected ApplicationContext getContext(final ServletConfig config) { return WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); }
From source file:org.projectforge.business.teamcal.servlet.CalendarAboServlet.java
@Override public void init(final ServletConfig config) throws ServletException { super.init(config); springContext = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); final AutowireCapableBeanFactory beanFactory = springContext.getAutowireCapableBeanFactory(); beanFactory.autowireBean(this); }
From source file:org.projectforge.business.user.filter.UserFilter.java
@Override public void init(final FilterConfig filterConfig) throws ServletException { WebApplicationContext springContext = WebApplicationContextUtils .getRequiredWebApplicationContext(filterConfig.getServletContext()); final AutowireCapableBeanFactory beanFactory = springContext.getAutowireCapableBeanFactory(); beanFactory.autowireBean(this); CONTEXT_PATH = filterConfig.getServletContext().getContextPath(); WICKET_PAGES_PREFIX = CONTEXT_PATH + "/" + Const.WICKET_APPLICATION_PATH; // IGNORE_PREFIX_WICKET = WICKET_PAGES_PREFIX + "resources"; // IGNORE_PREFIX_DOC = contextPath + "/secure/doc"; // IGNORE_PREFIX_SITE_DOC = contextPath + "/secure/site"; IGNORE_PREFIX_LOGO = CONTEXT_PATH + "/" + LogoServlet.BASE_URL; IGNORE_PREFIX_SMS_REVEIVE_SERVLET = CONTEXT_PATH + "/" + SMSReceiverServlet.URL; }
From source file:org.sakaiproject.feedback.tool.FeedbackTool.java
public void init(ServletConfig config) throws ServletException { super.init(config); try {//from w w w . j a v a 2 s .c om ApplicationContext context = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); sakaiProxy = (SakaiProxy) context.getBean("org.sakaiproject.feedback.util.SakaiProxy"); securityService = (SecurityService) context.getBean("org.sakaiproject.authz.api.SecurityService"); siteService = (SiteService) context.getBean("org.sakaiproject.site.api.SiteService"); } catch (Throwable t) { throw new ServletException("Failed to initialise FeedbackTool servlet.", t); } }