コード例 #1
0
 public Componentsources findExistOrCreateNewComponentSources(String code) {
   Componentsources result = null;
   if (StringUtils.isNotBlank(code)) {
     result = checkExistComponentSource(code);
     if (null == result) {
       result = new Componentsources(0, Auth.getCurrentUser(), code, Auth.getCurrentDate());
       save(result);
     }
   }
   return result;
 }
コード例 #2
0
 public Chemicals findExistOrCreateNewChemical(String code) {
   Chemicals result = null;
   if (StringUtils.isNotBlank(code)) {
     List<Chemicals> sourcesList = findAll(Chemicals.class);
     for (Chemicals chemical : sourcesList) {
       if (code.equals(chemical.getCode())) {
         return chemical;
       }
     }
     result = new Chemicals(0, Auth.getCurrentUser(), code, Auth.getCurrentDate());
     save(result);
   }
   return result;
 }