Example #1
0
 /**
  * Function to allow access to PreventionsExt table data based on prevention id
  *
  * @param id
  * @param keyval
  * @return String containing result, or empty string if not available
  */
 public static String getImmuExtValue(String id, String keyval) {
   try {
     List<PreventionExt> preventionExts =
         preventionExtDao.findByPreventionIdAndKey(Integer.valueOf(id), keyval);
     for (PreventionExt preventionExt : preventionExts) {
       return preventionExt.getVal();
     }
   } catch (Exception e) {
     log.error(e.getMessage(), e);
   }
   return "";
 }
Example #2
0
  public void addPreventionWithExts(Prevention prevention, HashMap<String, String> exts) {
    if (prevention == null) return;

    preventionDao.persist(prevention);
    if (exts != null) {
      for (String keyval : exts.keySet()) {
        if (StringUtils.filled(keyval) && StringUtils.filled(exts.get(keyval))) {
          PreventionExt preventionExt = new PreventionExt();
          preventionExt.setPreventionId(prevention.getId());
          preventionExt.setKeyval(keyval);
          preventionExt.setVal(exts.get(keyval));
          preventionExtDao.persist(preventionExt);
        }
      }
    }
  }