コード例 #1
0
 public void saveProp(String provider, String userPropertyName, String value) {
   UserProperty prop = getProp(provider, userPropertyName);
   if (prop == null) {
     prop = new UserProperty();
     prop.setProviderNo(provider);
     prop.setName(userPropertyName);
   }
   prop.setValue(value);
   saveProp(prop);
 }
コード例 #2
0
 // Should properties be updateable?
 public void saveProp(String name, String val) {
   if (val != null) {
     UserProperty prop = getProp(name);
     if (prop == null) {
       prop = new UserProperty();
       prop.setName(name);
     }
     prop.setValue(val);
     saveProp(prop);
   }
 }
コード例 #3
0
  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);
  }
コード例 #4
0
 public void saveProperties(String providerNo, Map<String, String> props) {
   for (String key : props.keySet()) {
     String value = props.get(key);
     if (value == null) value = new String();
     UserProperty prop = null;
     if ((prop = this.getProp(providerNo, key)) != null) {
       prop.setValue(value);
     } else {
       prop = new UserProperty();
       prop.setName(key);
       prop.setProviderNo(providerNo);
       prop.setValue(value);
     }
     saveProp(prop);
   }
 }
コード例 #5
0
  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;
  }