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

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

    // TreatGoals
    valueObject.setTreatGoals(
        ims.generalmedical.vo.domain.OPDSpasticityAssessTreatGoalVoAssembler
            .createOPDSpasticityAssessTreatGoalVoCollectionFromOPDSpasAssessTreatGoal(
                map, domainObject.getTreatGoals()));
    // TreatmentPlan
    java.util.List listTreatmentPlan = domainObject.getTreatmentPlan();
    ims.spinalinjuries.vo.lookups.SATreatmentPlanCollection TreatmentPlan =
        new ims.spinalinjuries.vo.lookups.SATreatmentPlanCollection();
    for (java.util.Iterator iterator = listTreatmentPlan.iterator(); iterator.hasNext(); ) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;

      ims.domain.lookups.LookupInstance instance =
          (ims.domain.lookups.LookupInstance) iterator.next();
      if (instance.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance.getImage().getImageId(), instance.getImage().getImagePath());
      } else {
        img = null;
      }
      color = instance.getColor();
      if (color != null) color.getValue();
      ims.spinalinjuries.vo.lookups.SATreatmentPlan voInstance =
          new ims.spinalinjuries.vo.lookups.SATreatmentPlan(
              instance.getId(), instance.getText(), instance.isActive(), null, img, color);
      ims.spinalinjuries.vo.lookups.SATreatmentPlan parentVoInstance = voInstance;
      ims.domain.lookups.LookupInstance parent = instance.getParent();
      while (parent != null) {
        if (parent.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent.getImage().getImageId(), parent.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent.getColor();
        if (color != null) color.getValue();
        parentVoInstance.setParent(
            new ims.spinalinjuries.vo.lookups.SATreatmentPlan(
                parent.getId(), parent.getText(), parent.isActive(), null, img, color));
        parentVoInstance = parentVoInstance.getParent();
        parent = parent.getParent();
      }
      TreatmentPlan.add(voInstance);
    }
    valueObject.setTreatmentPlan(TreatmentPlan);
    // BotulismTreatment
    java.util.List listBotulismTreatment = domainObject.getBotulismTreatment();
    ims.spinalinjuries.vo.lookups.SABotulinmCollection BotulismTreatment =
        new ims.spinalinjuries.vo.lookups.SABotulinmCollection();
    for (java.util.Iterator iterator = listBotulismTreatment.iterator(); iterator.hasNext(); ) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;

      ims.domain.lookups.LookupInstance instance =
          (ims.domain.lookups.LookupInstance) iterator.next();
      if (instance.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance.getImage().getImageId(), instance.getImage().getImagePath());
      } else {
        img = null;
      }
      color = instance.getColor();
      if (color != null) color.getValue();
      ims.spinalinjuries.vo.lookups.SABotulinm voInstance =
          new ims.spinalinjuries.vo.lookups.SABotulinm(
              instance.getId(), instance.getText(), instance.isActive(), null, img, color);
      ims.spinalinjuries.vo.lookups.SABotulinm parentVoInstance = voInstance;
      ims.domain.lookups.LookupInstance parent = instance.getParent();
      while (parent != null) {
        if (parent.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent.getImage().getImageId(), parent.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent.getColor();
        if (color != null) color.getValue();
        parentVoInstance.setParent(
            new ims.spinalinjuries.vo.lookups.SABotulinm(
                parent.getId(), parent.getText(), parent.isActive(), null, img, color));
        parentVoInstance = parentVoInstance.getParent();
        parent = parent.getParent();
      }
      BotulismTreatment.add(voInstance);
    }
    valueObject.setBotulismTreatment(BotulismTreatment);
    // JointContracture
    valueObject.setJointContracture(domainObject.getJointContracture());
    // LimbFinding
    valueObject.setLimbFinding(
        ims.generalmedical.vo.domain.OPDSpasAssLimbsVoAssembler
            .createOPDSpasAssLimbsVoCollectionFromOPDSpasAssLimbs(
                map, domainObject.getLimbFinding()));
    // CareContext
    valueObject.setCareContext(
        ims.core.vo.domain.CareContextShortVoAssembler.create(map, domainObject.getCareContext()));
    // AuthoringInformation
    valueObject.setAuthoringInformation(
        ims.core.vo.domain.AuthoringInformationVoAssembler.create(
            map, domainObject.getAuthoringInformation()));
    return valueObject;
  }