/**
   * Create the ValueObject collection to hold the list of DomainObjects.
   *
   * @param map - maps DomainObjects to created ValueObjects
   * @param domainObjectList - List of ims.core.configuration.domain.objects.AppUser objects.
   */
  public static ims.admin.vo.AppUserVoCollection createAppUserVoCollectionFromAppUser(
      DomainObjectMap map, java.util.List domainObjectList) {
    ims.admin.vo.AppUserVoCollection voList = new ims.admin.vo.AppUserVoCollection();
    if (null == domainObjectList) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    for (int i = 0; i < domainObjectList.size(); i++) {
      ims.core.configuration.domain.objects.AppUser domainObject =
          (ims.core.configuration.domain.objects.AppUser) domainObjectList.get(i);
      ims.admin.vo.AppUserVo vo = create(map, domainObject);

      if (vo != null) voList.add(vo);

      if (domainObject != null) {
        if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true)
          rieCount++;
        else activeCount++;
      }
    }

    voList.setRieCount(rieCount);
    voList.setActiveCount(activeCount);
    return voList;
  }
  /**
   * Create the ValueObject collection to hold the set of DomainObjects.
   *
   * @param map - maps DomainObjects to created ValueObjects
   * @param domainObjectSet - Set of ims.core.configuration.domain.objects.AppUser objects.
   */
  public static ims.admin.vo.AppUserVoCollection createAppUserVoCollectionFromAppUser(
      DomainObjectMap map, java.util.Set domainObjectSet) {
    ims.admin.vo.AppUserVoCollection voList = new ims.admin.vo.AppUserVoCollection();
    if (null == domainObjectSet) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    java.util.Iterator iterator = domainObjectSet.iterator();
    while (iterator.hasNext()) {
      ims.core.configuration.domain.objects.AppUser domainObject =
          (ims.core.configuration.domain.objects.AppUser) iterator.next();
      ims.admin.vo.AppUserVo vo = create(map, domainObject);

      if (vo != null) voList.add(vo);

      if (domainObject != null) {
        if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true)
          rieCount++;
        else activeCount++;
      }
    }
    voList.setRieCount(rieCount);
    voList.setActiveCount(activeCount);
    return voList;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.core.configuration.domain.objects.AppUser
   */
  public static ims.admin.vo.AppUserVo insert(
      DomainObjectMap map,
      ims.admin.vo.AppUserVo valueObject,
      ims.core.configuration.domain.objects.AppUser domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_AppUser(domainObject.getId());
    valueObject.setIsRIE(domainObject.getIsRIE());

    // If this is a recordedInError record, and the domainObject
    // value isIncludeRecord has not been set, then we return null and
    // not the value object
    if (valueObject.getIsRIE() != null
        && valueObject.getIsRIE().booleanValue() == true
        && !domainObject.isIncludeRecord()) return null;

    // If this is not a recordedInError record, and the domainObject
    // value isIncludeRecord has been set, then we return null and
    // not the value object
    if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false)
        && domainObject.isIncludeRecord()) return null;

    // Roles
    valueObject.setRoles(
        ims.admin.vo.domain.AppRoleShortVoAssembler.createAppRoleShortVoCollectionFromAppRole(
            map, domainObject.getRoles()));
    // mos
    valueObject.setMos(
        ims.core.vo.domain.MemberOfStaffShortVoAssembler.create(map, domainObject.getMos()));
    // PreviousPasswords
    valueObject.setPreviousPasswords(
        ims.admin.vo.domain.AppUserPasswordVoAssembler
            .createAppUserPasswordVoCollectionFromAppUserPassword(
                map, domainObject.getPreviousPasswords()));
    // EmailAccount
    valueObject.setEmailAccount(
        ims.admin.vo.domain.UserEmailAccountVoAssembler.create(
            map, domainObject.getEmailAccount()));
    // UseExternalAuthentication
    valueObject.setUseExternalAuthentication(domainObject.isUseExternalAuthentication());
    // NotificationDetails
    valueObject.setNotificationDetails(
        ims.admin.vo.domain.UserNotificationDetailsVoAssembler.create(
            map, domainObject.getNotificationDetails()));
    // SecretKey
    valueObject.setSecretKey(domainObject.getSecretKey());
    // sdsUserId
    valueObject.setSdsUserId(domainObject.getSdsUserId());
    // Username
    valueObject.setUsername(domainObject.getUsername());
    // Password
    valueObject.setPassword(domainObject.getPassword());
    // EncodedPassword
    valueObject.setEncodedPassword(domainObject.getEncodedPassword());
    // Theme
    valueObject.setTheme(domainObject.getTheme());
    // PwdExpDate
    java.util.Date PwdExpDate = domainObject.getPwdExpDate();
    if (null != PwdExpDate) {
      valueObject.setPwdExpDate(new ims.framework.utils.DateTime(PwdExpDate));
    }
    // EffectiveFrom
    java.util.Date EffectiveFrom = domainObject.getEffectiveFrom();
    if (null != EffectiveFrom) {
      valueObject.setEffectiveFrom(new ims.framework.utils.DateTime(EffectiveFrom));
    }
    // EffectiveTo
    java.util.Date EffectiveTo = domainObject.getEffectiveTo();
    if (null != EffectiveTo) {
      valueObject.setEffectiveTo(new ims.framework.utils.DateTime(EffectiveTo));
    }
    // IsActive
    valueObject.setIsActive(domainObject.isIsActive());
    // DebugMode
    valueObject.setDebugMode(domainObject.isDebugMode());
    // LDAPUsername
    valueObject.setLDAPUsername(domainObject.getLDAPUsername());
    // LDAPPassword
    valueObject.setLDAPPassword(domainObject.getLDAPPassword());
    // Locked
    valueObject.setLocked(domainObject.isLocked());
    return valueObject;
  }