public ActionForward saveGeneral( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { // Is there a password change? if (!getParameter(request, "new_password").isEmpty()) { try { changePassword(request); } catch (Exception e) { logger.error("Error", e); } } Iterator<Object> iter = request.getParameterMap().keySet().iterator(); while (iter.hasNext()) { String key = (String) iter.next(); if (!key.startsWith("pref.")) continue; String value = request.getParameter(key); // a couple special cases if (key.equals("pref." + UserProperty.ENCOUNTER_FORM_NAME) || key.equals("pref." + UserProperty.EFORM_NAME)) { String[] values = request.getParameterValues(key); StringBuilder sb = new StringBuilder(); for (int x = 0; x < values.length; x++) { if (x > 0) sb.append(","); sb.append(values[x]); } value = sb.toString(); } UserProperty up = userPropertyDao.getProp( LoggedInInfo.loggedInInfo.get().loggedInProvider.getProviderNo(), key); if (up != null) { up.setValue(value); userPropertyDao.saveProp(up); } else { up = new UserProperty(); up.setProviderNo(LoggedInInfo.loggedInInfo.get().loggedInProvider.getProviderNo()); up.setName(key); up.setValue(value); userPropertyDao.saveProp(up); } } return form(mapping, actionForm, request, response); }
public ActionForward update( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String value = request.getParameter("value"); Provider provider = LoggedInInfo.loggedInInfo.get().loggedInProvider; UserProperty prop = propertyDao.getProp(provider.getProviderNo(), "rxInteractionWarningLevel"); if (prop == null) { prop = new UserProperty(); prop.setName("rxInteractionWarningLevel"); prop.setProviderNo(provider.getProviderNo()); } prop.setValue(value); propertyDao.saveProp(prop); try { response.getWriter().println("ok"); } catch (IOException e) { logger.error("error", e); } return null; }
public ActionForward form( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { if (!inited) init(); Map<String, String> prefs = new HashMap<String, String>(); List<UserProperty> userProperties = userPropertyDao.getDemographicProperties( LoggedInInfo.loggedInInfo.get().loggedInProvider.getProviderNo()); prefs.putAll(defaults); prefs.putAll(siteDefaults); for (UserProperty up : userProperties) { prefs.put(up.getName(), up.getValue()); } request.setAttribute("prefs", prefs); return mapping.findForward("form"); }