コード例 #1
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;
  }
コード例 #2
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (non-Javadoc)
   *
   * @see
   * org.openiam.idm.srvc.user.service.UserDataService#getEmailAddressMap(
   * java.lang.String)
   */
  @Transactional(readOnly = true)
  public Map<String, EmailAddress> getEmailAddressMap(String userId) {
    if (userId == null) throw new NullPointerException("userId is null");

    Map<String, EmailAddressEntity> emailAddressEntityMap =
        emailAddressDao.findByParent(userId, ContactConstants.PARENT_TYPE_USER);
    Map<String, EmailAddress> emailAddressMap = new HashMap<String, EmailAddress>();
    for (Map.Entry<String, EmailAddressEntity> addressEntityEntry :
        emailAddressEntityMap.entrySet()) {
      emailAddressMap.put(
          addressEntityEntry.getKey(),
          emailAddressDozerConverter.convertToDTO(addressEntityEntry.getValue(), true));
    }
    return emailAddressMap;
  }
コード例 #3
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
 /*
  * (non-Javadoc)
  *
  * @see
  * org.openiam.idm.srvc.user.service.UserDataService#getPhoneMap(java.lang
  * .String)
  */
 @Transactional(readOnly = true)
 public Map<String, Phone> getPhoneMap(String userId) {
   if (userId == null) throw new NullPointerException("userId is null");
   Map<String, Phone> phoneMap = null;
   Map<String, PhoneEntity> phoneEntityMap =
       phoneDao.findByParent(userId, ContactConstants.PARENT_TYPE_USER);
   if (phoneEntityMap != null) {
     phoneMap = new HashMap<String, Phone>();
     for (Map.Entry<String, PhoneEntity> phoneEntityEntry : phoneEntityMap.entrySet()) {
       phoneMap.put(
           phoneEntityEntry.getKey(),
           phoneDozerConverter.convertToDTO(phoneEntityEntry.getValue(), true));
     }
   }
   return phoneMap;
 }
コード例 #4
0
ファイル: UserMgr.java プロジェクト: ntlartey/openiam-idm-ce
  /*
   * (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;
  }