Exemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addAttribute(org.openiam
   * .idm.srvc.user.dto.UserAttribute)
   */
  @Transactional
  public UserAttribute addAttribute(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.");
    }

    UserAttributeEntity attributeEntity =
        userAttributeDozerConverter.convertToEntity(attribute, true);
    userAttributeDao.add(attributeEntity);

    // this.userMsgProducer.sendMessage(attribute.getUserId(),"ADD");

    return userAttributeDozerConverter.convertToDTO(attributeEntity, true);
  }