/* * (non-Javadoc) * * @see * org.openiam.idm.srvc.user.service.UserDataService#getNote(java.lang.String * ) */ @Transactional(readOnly = true) public UserNote getNote(java.lang.String noteId) { if (noteId == null) { throw new NullPointerException("attrId is null"); } UserNoteEntity userNoteEntity = userNoteDao.findById(noteId); return userNoteDozerConverter.convertToDTO(userNoteEntity, true); }
/* * (non-Javadoc) * * @see * org.openiam.idm.srvc.user.service.UserDataService#addNote(org.openiam * .idm.srvc.user.dto.UserNote) */ @Transactional public UserNote addNote(UserNote note) { if (note == null) throw new NullPointerException("Note cannot be null"); if (note.getUserId() == null) { throw new NullPointerException("User is not associated with this note."); } UserEntity usr = userDao.findById(note.getUserId()); UserNoteEntity userNoteEntity = userNoteDozerConverter.convertToEntity(note, true); if (userNoteEntity.getUser() == null) { userNoteEntity.setUser(usr); } userNoteDao.persist(userNoteEntity); return userNoteDozerConverter.convertToDTO(userNoteEntity, true); }