コード例 #1
0
 public List<String> completeEmployeeName(String query) {
   ArrayList<String> filterList = new ArrayList<String>();
   if (baseList == null) {
     try {
       baseList = workInfoService.getAllList(condition.genQuery());
       listModel = new WorkInfoListModel(baseList);
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
   }
   for (WorkInfoDto dto : baseList) {
     if (dto.getName().toLowerCase().contains(query.toLowerCase())) filterList.add(dto.getName());
   }
   return filterList;
 }
コード例 #2
0
  public void nameValidate(FacesContext context, UIComponent component, Object value) {
    boolean find = false;
    String name = (String) value;

    for (WorkInfoDto dto : getAllList()) {
      if (dto.getName().equals(name)) {
        find = true;
      }
    }
    if (!find) {
      throw new ValidatorException(
          new FacesMessage(FacesMessage.SEVERITY_FATAL, "Employee Name doesn't exist.", null));
    }
  }