コード例 #1
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
 /*
  * (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);
 }
コード例 #2
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#removeNote(org.openiam
   * .idm.srvc.user.dto.UserNote)
   */
  @Transactional
  public void removeNote(UserNote note) {
    if (note == null) {
      throw new NullPointerException("note is null");
    }
    if (note.getUserNoteId() == null) {
      throw new NullPointerException("noteId is null");
    }

    userNoteDao.delete(userNoteDozerConverter.convertToEntity(note, true));
  }
コード例 #3
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (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);
  }
コード例 #4
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getAllNotes(java.lang
   * .String)
   */
  @Transactional(readOnly = true)
  public List<UserNote> getAllNotes(String userId) {

    if (userId == null) {
      throw new NullPointerException("userId is null");
    }
    List<UserNoteEntity> noteEntityList = userNoteDao.findUserNotes(userId);
    if (noteEntityList == null || noteEntityList.isEmpty()) {
      return null;
    }

    return userNoteDozerConverter.convertToDTOList(noteEntityList, false);
  }
コード例 #5
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#updateNote(org.openiam
   * .idm.srvc.user.dto.UserNote)
   */
  @Transactional
  public void updateNote(UserNote note) {
    if (note == null) throw new NullPointerException("Note cannot be null");
    if (StringUtils.isEmpty(note.getUserNoteId())) {
      throw new NullPointerException("noteId is null");
    }
    if (StringUtils.isEmpty(note.getUserId())) {
      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.merge(userNoteEntity);
  }