/**
   * Create the ValueObject collection to hold the list of DomainObjects.
   *
   * @param map - maps DomainObjects to created ValueObjects
   * @param domainObjectList - List of ims.scheduling.domain.objects.Sch_Session objects.
   */
  public static ims.scheduling.vo.SessionManagementVoCollection
      createSessionManagementVoCollectionFromSch_Session(
          DomainObjectMap map, java.util.List domainObjectList) {
    ims.scheduling.vo.SessionManagementVoCollection voList =
        new ims.scheduling.vo.SessionManagementVoCollection();
    if (null == domainObjectList) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    for (int i = 0; i < domainObjectList.size(); i++) {
      ims.scheduling.domain.objects.Sch_Session domainObject =
          (ims.scheduling.domain.objects.Sch_Session) domainObjectList.get(i);
      ims.scheduling.vo.SessionManagementVo 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.scheduling.domain.objects.Sch_Session objects.
   */
  public static ims.scheduling.vo.SessionManagementVoCollection
      createSessionManagementVoCollectionFromSch_Session(
          DomainObjectMap map, java.util.Set domainObjectSet) {
    ims.scheduling.vo.SessionManagementVoCollection voList =
        new ims.scheduling.vo.SessionManagementVoCollection();
    if (null == domainObjectSet) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    java.util.Iterator iterator = domainObjectSet.iterator();
    while (iterator.hasNext()) {
      ims.scheduling.domain.objects.Sch_Session domainObject =
          (ims.scheduling.domain.objects.Sch_Session) iterator.next();
      ims.scheduling.vo.SessionManagementVo 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.scheduling.domain.objects.Sch_Session
   */
  public static ims.scheduling.vo.SessionManagementVo insert(
      DomainObjectMap map,
      ims.scheduling.vo.SessionManagementVo valueObject,
      ims.scheduling.domain.objects.Sch_Session domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_Sch_Session(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;

    // Name
    valueObject.setName(domainObject.getName());
    // SessionDate
    java.util.Date SessionDate = domainObject.getSessionDate();
    if (null != SessionDate) {
      valueObject.setSessionDate(new ims.framework.utils.Date(SessionDate));
    }
    // StartTm
    String StartTm = domainObject.getStartTm();
    if (null != StartTm) {
      valueObject.setStartTm(new ims.framework.utils.Time(StartTm));
    }
    // EndTm
    String EndTm = domainObject.getEndTm();
    if (null != EndTm) {
      valueObject.setEndTm(new ims.framework.utils.Time(EndTm));
    }
    // Service
    valueObject.setService(
        ims.core.vo.domain.ServiceShortVoAssembler.create(map, domainObject.getService()));
    // SessionStatus
    ims.domain.lookups.LookupInstance instance6 = domainObject.getSessionStatus();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.scheduling.vo.lookups.Session_Status_and_Reason voLookup6 =
          new ims.scheduling.vo.lookups.Session_Status_and_Reason(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.scheduling.vo.lookups.Session_Status_and_Reason parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.scheduling.vo.lookups.Session_Status_and_Reason(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setSessionStatus(voLookup6);
    }
    // RemainingSlots
    valueObject.setRemainingSlots(domainObject.getRemainingSlots());
    // TotalSlots
    valueObject.setTotalSlots(domainObject.getTotalSlots());
    // RemainingTime
    valueObject.setRemainingTime(domainObject.getRemainingTime());
    // SchLocation
    valueObject.setSchLocation(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getSchLocation()));
    // SessionType
    ims.domain.lookups.LookupInstance instance11 = domainObject.getSessionType();
    if (null != instance11) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance11.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance11.getImage().getImageId(), instance11.getImage().getImagePath());
      }
      color = instance11.getColor();
      if (color != null) color.getValue();

      ims.scheduling.vo.lookups.Sched_Profile_Type voLookup11 =
          new ims.scheduling.vo.lookups.Sched_Profile_Type(
              instance11.getId(), instance11.getText(), instance11.isActive(), null, img, color);
      ims.scheduling.vo.lookups.Sched_Profile_Type parentVoLookup11 = voLookup11;
      ims.domain.lookups.LookupInstance parent11 = instance11.getParent();
      while (parent11 != null) {
        if (parent11.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent11.getImage().getImageId(), parent11.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent11.getColor();
        if (color != null) color.getValue();
        parentVoLookup11.setParent(
            new ims.scheduling.vo.lookups.Sched_Profile_Type(
                parent11.getId(), parent11.getText(), parent11.isActive(), null, img, color));
        parentVoLookup11 = parentVoLookup11.getParent();
        parent11 = parent11.getParent();
      }
      valueObject.setSessionType(voLookup11);
    }
    // ListOwners
    valueObject.setListOwners(
        ims.scheduling.vo.domain.Session_ListOwnerVoAssembler
            .createSession_ListOwnerVoCollectionFromSession_ListOwner(
                map, domainObject.getListOwners()));
    // DirectoryofServices
    valueObject.setDirectoryofServices(
        ims.scheduling.vo.domain.DirectoryOfServiceVoAssembler
            .createDirectoryOfServiceVoCollectionFromDirectoryofService(
                map, domainObject.getDirectoryofServices()));
    // IsTheatreSession
    valueObject.setIsTheatreSession(domainObject.isIsTheatreSession());
    return valueObject;
  }