public void changeRenderingStates() { ApplicationContext context = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()); SaveAppointments saveAppointmentsObjectInAvaliableAppointments = (SaveAppointments) context.getBean("saveAppointments"); TypedQuery<Object[]> doctorAndTimeQuery = em.createQuery( "SELECT u.doktoradi,FUNCTION('DATE',u.tarih),u.uygunrandevuid FROM Uygunrandevular AS u WHERE u.doktorid=:doctorid ORDER BY u.tarih ASC", Object[].class); doctorAndTimeQuery.setParameter( "doctorid", saveAppointmentsObjectInAvaliableAppointments.selectedAppointment.getDoktorid()); doctorAndTimeList = new ArrayList<>(); doctorAndTimeList = doctorAndTimeQuery.getResultList(); TypedQuery<Randevusaatleri> query = em.createQuery( "SELECT c FROM Randevusaatleri c WHERE c.doktorid=:doctorid", Randevusaatleri.class); System.out.println( "Seçilen Randevunun ID'si" + saveAppointmentsObjectInAvaliableAppointments.selectedAppointment .getUygunrandevuid()); query.setParameter( "doctorid", saveAppointmentsObjectInAvaliableAppointments.selectedAppointment.getDoktorid()); appointmentClockResults = new ArrayList<>(); appointmentClockResults = query.getResultList(); setRenderingTakingAppointmentInfo(false); setRenderingClocks(true); }
public ProductForm() { FacesContext facesContext = FacesContext.getCurrentInstance(); ApplicationContext applicationContext = FacesContextUtils.getWebApplicationContext(facesContext); CategoryController controller = applicationContext.getBean(CategoryController.class); categories = controller.searchCategory(new CategorySearchOptions()); product = new Product(); }
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { if (value != null && value.trim().length() > 0) { ProdutoService service = FacesContextUtils.getWebApplicationContext(context).getBean(ProdutoService.class); return service.buscarPorId(Integer.parseInt(value)); } else { return null; } }
public EmployeeServiceImpl() { super(); ApplicationContext appContext = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()); this.oEmployeeController = appContext.getBean("emplController", IEmployeeController.class); this.oOpridController = appContext.getBean("opridController", IOpridController.class); this.oDepartmentController = appContext.getBean("deptController", IDepartmentController.class); this.oBuExController = appContext.getBean("buExController", IBusinessUnitExController.class); this.oValue = new Employee(); this.oValuePwd = new Oprid(); }
public void fillList() { availableAppointments = new ArrayList<>(); ApplicationContext context = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()); GetHospitals getHospitalsObject = (GetHospitals) context.getBean("getHospitals"); SaveAppointments saveAppointmentsObjectInAvaliableAppointments = (SaveAppointments) context.getBean("saveAppointments"); GetClinics getClinicsObject = (GetClinics) context.getBean("getClinics"); for (Hastaneler h : getHospitalsObject.getHospitalResults()) { if (h.getHastaneadi().equals(saveAppointmentsObjectInAvaliableAppointments.getHospital())) { hospitalid = h.getId(); break; } } int clinicId = 0; for (Klinikler k : getClinicsObject.clinicResults) { if (k.getKlinikadi().equals(saveAppointmentsObjectInAvaliableAppointments.clinic)) { clinicId = k.getId(); break; } } TypedQuery<Uygunrandevular> query = em.createQuery( "SELECT u FROM Uygunrandevular AS u WHERE u.hastaneid=:hospitalid AND u.klinikid=:clinicid AND u.klinikyeri=:clinicplace " + "AND u.tarih = (select min(uu.tarih) from Uygunrandevular uu where uu.doktorid = u.doktorid)", Uygunrandevular.class); query.setParameter("hospitalid", hospitalid); query.setParameter("clinicid", clinicId); query.setParameter("clinicplace", saveAppointmentsObjectInAvaliableAppointments.clinicPlace); availableAppointments = query.getResultList(); setRenderingDataTable(true); }
public Object getSpringBean(String beanId) { Object appBean = null; Object webBean = null; Object facesBean = null; try { ApplicationContext appCtx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()); appBean = appCtx.getBean(beanId); return appBean; } catch (Exception e) { log.error(e.getLocalizedMessage()); // e.printStackTrace(); } try { WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()); webBean = ctx.getBean(beanId); log.info("webBean--> " + webBean); return webBean; } catch (Exception e) { log.error(e.getLocalizedMessage()); // e.printStackTrace(); } try { facesBean = FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(beanId); log.info(" facesBean --> " + facesBean); return facesBean; } catch (Exception e) { log.error(e.getLocalizedMessage()); } return null; }