@Override public void addNoteToPersonnel(Short personnelId, String comment) { MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); UserContext userContext = toUserContext(user); try { PersonnelBO personnel = this.personnelDao.findPersonnelById(personnelId); PersonnelBO loggedInUser = this.personnelDao.findPersonnelById(userContext.getId()); if (personnel != null) { checkPermissionForAddingNotesToPersonnel( userContext, personnel.getOffice().getOfficeId(), personnel.getPersonnelId()); } this.transactionHelper.startTransaction(); PersonnelNotesEntity personnelNote = new PersonnelNotesEntity(comment, loggedInUser, personnel); personnel.addNotes(userContext.getId(), personnelNote); this.personnelDao.save(personnel); this.transactionHelper.commitTransaction(); } catch (Exception e) { this.transactionHelper.rollbackTransaction(); throw new MifosRuntimeException(e); } finally { this.transactionHelper.closeSession(); } }