コード例 #1
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#removePhone(org.openiam
  * .idm.srvc.continfo.dto.Phone)
  */
 @Transactional
 public void removePhone(Phone val) {
   if (val == null) throw new NullPointerException("val is null");
   if (val.getPhoneId() == null) throw new NullPointerException("PhoneId is null");
   UserEntity parent = userDao.findById(val.getParentId());
   phoneDao.remove(phoneDozerConverter.convertToEntity(val, true));
 }
コード例 #2
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getAllAttributes(java
   * .lang.String)
   */
  @Transactional(readOnly = true)
  public Map<String, UserAttribute> getAllAttributes(String userId) {
    Map<String, UserAttribute> attrMap = new HashMap<String, UserAttribute>();

    if (userId == null) {
      throw new NullPointerException("userId is null");
    }

    UserEntity usrEntity = userDao.findById(userId);

    if (usrEntity == null) return null;

    List<UserAttributeEntity> attrList = userAttributeDao.findUserAttributes(userId);

    if (attrList == null || attrList.size() == 0) return null;

    // migrate to a Map for the User object
    if (attrList != null && !attrList.isEmpty()) {
      int size = attrList.size();
      for (int i = 0; i < size; i++) {
        UserAttributeEntity attr = attrList.get(i);
        attrMap.put(attr.getName(), new UserAttribute(attr));
      }
    }

    return attrMap;
  }
コード例 #3
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getUser(java.lang.String
   * , boolean)
   */
  @Transactional(readOnly = true)
  public User getUserWithDependent(String id, boolean dependants) {

    UserEntity usr = userDao.findById(id);
    if (usr == null) {
      return null;
    }

    if (!dependants) {
      return userDozerConverter.convertToDTO(usr, true);
    }

    // assemble the various dependant objects
    org.hibernate.Hibernate.initialize(usr.getPhones());
    org.hibernate.Hibernate.initialize(usr.getEmailAddresses());
    org.hibernate.Hibernate.initialize(usr.getAddresses());
    org.hibernate.Hibernate.initialize(usr.getUserAttributes());
    User user = userDozerConverter.convertToDTO(usr, true);
    List<Login> principalList = loginDao.findUser(id);
    if (principalList != null) {
      user.setPrincipalList(principalList);
    }

    return user;
  }
コード例 #4
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#updateAttribute(org
   * .openiam.idm.srvc.user.dto.UserAttribute)
   */
  @Transactional
  public void updateAttribute(UserAttribute attribute) {
    if (attribute == null) throw new NullPointerException("Attribute can not be null");

    if (StringUtils.isEmpty(attribute.getUserId())) {
      throw new NullPointerException("User has not been associated with this attribute.");
    }
    UserEntity userEntity = userDao.findById(attribute.getUserId());
    userAttributeDao.update(userAttributeDozerConverter.convertToEntity(attribute, true));
    // this.userMsgProducer.sendMessage(attribute.getUserId(),"UPDATE");

  }
コード例 #5
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#removeAttribute(org
   * .openiam.idm.srvc.user.dto.UserAttribute)
   */
  @Transactional
  public void removeAttribute(UserAttribute attr) {
    if (attr == null) {
      throw new NullPointerException("attr is null");
    }
    if (StringUtils.isEmpty(attr.getId())) {
      throw new NullPointerException("attrId is null");
    }
    UserEntity userEntity = userDao.findById(attr.getUserId());
    userAttributeDao.remove(userAttributeDozerConverter.convertToEntity(attr, true));

    // this.userMsgProducer.sendMessage(attr.getUserId(),"DELETE");

  }
コード例 #6
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);
  }
コード例 #7
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);
  }
コード例 #8
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#getUser(java.lang.String
  * )
  */
 @Transactional(readOnly = true)
 public User getUser(String id) {
   UserEntity entity = userDao.findById(id);
   return userDozerConverter.convertToDTO(entity, true);
 }