public void deleteFile(String filename) { EmployeeDetail detail = person.getEmployeeDetails(); Set<String> files = new HashSet<>(); files.addAll(detail.getFiles()); files.remove(filename); EmployeeDetail newDetail = getEmployeeDetail(detail, files); EmployeeDetailFacade.getEmployeeDetailService().merge(newDetail); Person newPerson = getPerson(person, newDetail); PersonFacade.getPersonService().merge(newPerson); }
private Set<String> updateEmpDetails(String fileId) { EmployeeDetail detail = person.getEmployeeDetails(); Set<String> files = new HashSet<>(); if (detail.getFiles() != null) { files = detail.getFiles(); } files.add(fileId); EmployeeDetail newDetail = getEmployeeDetail(detail, files); EmployeeDetailFacade.getEmployeeDetailService().merge(newDetail); Person newPerson = getPerson(person, newDetail); PersonFacade.getPersonService().merge(newPerson); return newDetail.getFiles(); }