Esempio n. 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addUser(org.openiam
   * .idm.srvc.user.dto.User, boolean)
   */
  @Transactional
  public User addUserWithDependent(User user, boolean dependency) {
    if (user == null) throw new NullPointerException("user object is null");

    if (user.getCreateDate() == null) {
      user.setCreateDate(new Date(System.currentTimeMillis()));
    }
    if (user.getLastUpdate() == null) {
      user.setLastUpdate(new Date(System.currentTimeMillis()));
    }

    // if there are dependants, then make user that the parentId has been
    // set

    validateEmailAddress(user, user.getEmailAddresses());

    log.debug("User Object before addUser: "******"ADD");

    return userDozerConverter.convertToDTO(entity, true);
  }
Esempio n. 2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#addUser(org.openiam
   * .idm.srvc.user.dto.User)
   */
  @Transactional
  public User addUser(User user) {
    if (user == null) throw new NullPointerException("user object is null");

    if (user.getCreateDate() == null) {
      user.setCreateDate(new Date(System.currentTimeMillis()));
    }
    if (user.getLastUpdate() == null) {
      user.setLastUpdate(new Date(System.currentTimeMillis()));
    }

    validateEmailAddress(user, user.getEmailAddresses());
    UserEntity userEntity = userDozerConverter.convertToEntity(user, true);
    userDao.add(userEntity);

    return userDozerConverter.convertToDTO(userEntity, true);
  }
Esempio n. 3
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getUserAsMap(java.lang
   * .String)
   */
  @Transactional(readOnly = true)
  public Map<String, UserAttribute> getUserAsMap(String userId) {
    User usr = getUser(userId);
    if (usr == null) {
      return null;
    }

    Map<String, UserAttribute> attrMap = getAllAttributes(userId);
    if (attrMap == null) {
      attrMap = new HashMap<String, UserAttribute>();
    }
    // assign the predefined properties

    attrMap.put("USER_ID", new UserAttribute(null, userId, null, "USER_ID", userId));
    attrMap.put(
        "FIRST_NAME", new UserAttribute(null, userId, null, "FIRST_NAME", usr.getFirstName()));
    attrMap.put("LAST_NAME", new UserAttribute(null, userId, null, "LAST_NAME", usr.getLastName()));
    attrMap.put(
        "MIDDLE_INIT",
        new UserAttribute(null, userId, null, "MIDDLE_INIT", String.valueOf(usr.getMiddleInit())));
    attrMap.put("TITLE", new UserAttribute(null, userId, null, "TITLE", usr.getTitle()));
    attrMap.put("DEPT", new UserAttribute(null, userId, null, "DEPT", usr.getDeptCd()));
    attrMap.put(
        "STATUS", new UserAttribute(null, userId, null, "STATUS", usr.getStatus().toString()));
    if (usr.getBirthdate() != null) {
      attrMap.put(
          "BIRTHDATE",
          new UserAttribute(null, userId, null, "BIRTHDATE", usr.getBirthdate().toString()));
    } else {
      attrMap.put("BIRTHDATE", new UserAttribute(null, userId, null, "BIRTHDATE", null));
    }
    attrMap.put("SEX", new UserAttribute(null, userId, null, "SEX", String.valueOf(usr.getSex())));
    if (usr.getCreateDate() != null) {
      attrMap.put(
          "CREATE_DATE",
          new UserAttribute(null, userId, null, "CREATE_DATE", usr.getCreateDate().toString()));
    } else {
      attrMap.put("CREATE_DATE", new UserAttribute(null, userId, null, "CREATE_DATE", null));
    }
    attrMap.put(
        "CREATED_BY", new UserAttribute(null, userId, null, "CREATED_BY", usr.getCreatedBy()));
    if (usr.getLastUpdate() != null) {
      attrMap.put(
          "LAST_UPDATE",
          new UserAttribute(null, userId, null, "LAST_UPDATE", usr.getLastUpdate().toString()));
    } else {
      attrMap.put("LAST_UPDATE", new UserAttribute(null, userId, null, "LAST_UPDATE", null));
    }
    attrMap.put(
        "LAST_UPDATEDBY",
        new UserAttribute(null, userId, null, "LAST_UPDATEDBY", usr.getLastUpdatedBy()));
    attrMap.put("PREFIX", new UserAttribute(null, userId, null, "PREFIX", usr.getPrefix()));
    attrMap.put("SUFFIX", new UserAttribute(null, userId, null, "SUFFIX", usr.getSuffix()));
    attrMap.put(
        "USER_TYPE_IND",
        new UserAttribute(null, userId, null, "USER_TYPE_IND", usr.getUserTypeInd()));
    attrMap.put(
        "EMPLOYEE_ID", new UserAttribute(null, userId, null, "EMPLOYEE_ID", usr.getEmployeeId()));
    attrMap.put(
        "EMPLOYEE_TYPE",
        new UserAttribute(null, userId, null, "EMPLOYEE_TYPE", usr.getEmployeeType()));
    attrMap.put(
        "LOCATION_ID", new UserAttribute(null, userId, null, "LOCATION_ID", usr.getLocationCd()));
    attrMap.put(
        "ORGANIZATION_ID",
        new UserAttribute(null, userId, null, "ORGANIZATION_ID", usr.getCompanyId()));
    attrMap.put(
        "COMPANY_OWNER_ID",
        new UserAttribute(null, userId, null, "COMPANY_OWNER_ID", usr.getCompanyOwnerId()));

    attrMap.put(
        "MANAGER_ID", new UserAttribute(null, userId, null, "MANAGER_ID", usr.getManagerId()));
    attrMap.put("JOB_CODE", new UserAttribute(null, userId, null, "JOB_CODE", usr.getJobCode()));

    return attrMap;
  }