public void apply() throws IOException { try { if (addLoginUser) { if (!password.equals(passwordConfirm)) { sessionManager.addGlobalMessageFatal("Password is not equal to Confirm Password.", null); throw new ValidatorException( new FacesMessage( FacesMessage.SEVERITY_FATAL, "Password and Confirm Password are not equal.", null)); } } if (hasPhoto) { String photoName = editWorkInfo.getId() + FileUtil.getSuffix(tmpName); FileUtil.renameFile(sessionManager.getPhotoPath(), tmpName, photoName); editWorkInfo.setPhotoName(photoName); } editWorkInfo.setName(firstName + " " + lastName); workInfoService.add(editWorkInfo); if (addLoginUser) { editUser.setPassword(PasswordHash.makePasswordHash(password)); editUser.getEmployee().setId(editWorkInfo.getId()); userService.add(editUser); } clear(); } catch (IOException e) { logger.error("Employee Date update error.", e); sessionManager.addGlobalMessageFatal("Employee Data update error.", null); throw e; } }
public WorkInfoListModel getListModel() { if (baseList == null) { try { baseList = workInfoService.getAllList(condition.genQuery()); listModel = new WorkInfoListModel(baseList); } catch (IOException e) { throw new RuntimeException(e); } } return baseList == null ? new WorkInfoListModel(new ArrayList<WorkInfoDto>()) : listModel; }
public List<WorkInfoDto> getAllList() { if (allList == null) { try { allList = workInfoService.getAllList(new DynamicQuery()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return allList == null ? new ArrayList<WorkInfoDto>() : allList; }
public void delete() throws IOException { try { for (WorkInfoDto employee : selecteds) { workInfoService.delete(employee.getId()); } clear(); } catch (IOException e) { logger.error("Employee Date delete error.", e); sessionManager.addGlobalMessageFatal("Employee Data delete error.", null); throw e; } }
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; }
private void addEmployees(ArrayList<WorkInfoDto> list) throws IOException { for (WorkInfoDto e : list) { workInfoService.add(e); } }
public List<WorkInfoDto> getBaseList() throws IOException { if (baseList == null) baseList = workInfoService.getAllList(new DynamicQuery()); return baseList; }