public Map<String, String> getProviderPropertiesAsMap(String providerNo) { Map<String, String> map = new HashMap<String, String>(); Query query = entityManager.createQuery("select p from UserProperty p where p.providerNo = ?"); query.setParameter(1, providerNo); @SuppressWarnings("unchecked") List<UserProperty> list = query.getResultList(); for (UserProperty p : list) { map.put(p.getName(), p.getValue()); } return map; }
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"); }