/**
   * Create the ValueObject from the ims.icps.configuration.domain.objects.ICPPhase object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param domainObject
   */
  public static ims.icp.vo.ICPPhaseVo create(
      DomainObjectMap map, ims.icps.configuration.domain.objects.ICPPhase domainObject) {
    if (null == domainObject) {
      return null;
    }
    // check if the domainObject already has a valueObject created for it
    ims.icp.vo.ICPPhaseVo valueObject =
        (ims.icp.vo.ICPPhaseVo) map.getValueObject(domainObject, ims.icp.vo.ICPPhaseVo.class);
    if (null == valueObject) {
      valueObject = new ims.icp.vo.ICPPhaseVo(domainObject.getId(), domainObject.getVersion());
      map.addValueObject(domainObject, valueObject);

      valueObject = insert(map, valueObject, domainObject);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.icps.configuration.domain.objects.ICPPhase
   */
  public static ims.icp.vo.ICPPhaseListVo insert(
      DomainObjectMap map,
      ims.icp.vo.ICPPhaseListVo valueObject,
      ims.icps.configuration.domain.objects.ICPPhase domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_ICPPhase(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());
    // Description
    valueObject.setDescription(domainObject.getDescription());
    // Status
    ims.domain.lookups.LookupInstance instance3 = domainObject.getStatus();
    if (null != instance3) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance3.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance3.getImage().getImageId(), instance3.getImage().getImagePath());
      }
      color = instance3.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.PreActiveActiveInactiveStatus voLookup3 =
          new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.core.vo.lookups.PreActiveActiveInactiveStatus parentVoLookup3 = voLookup3;
      ims.domain.lookups.LookupInstance parent3 = instance3.getParent();
      while (parent3 != null) {
        if (parent3.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent3.getImage().getImageId(), parent3.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent3.getColor();
        if (color != null) color.getValue();
        parentVoLookup3.setParent(
            new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setStatus(voLookup3);
    }
    return valueObject;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.icps.configuration.domain.objects.ICPPhase
   */
  public static ims.icp.vo.ICPPhaseVo insert(
      DomainObjectMap map,
      ims.icp.vo.ICPPhaseVo valueObject,
      ims.icps.configuration.domain.objects.ICPPhase domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Rules
    valueObject.setRules(
        ims.admin.vo.domain.BusinessRuleVoAssembler.createBusinessRuleVoCollectionFromBusinessRule(
            map, domainObject.getRules()));
    // Description
    valueObject.setDescription(domainObject.getDescription());
    // isActivatedOnInitiation
    valueObject.setIsActivatedOnInitiation(domainObject.isIsActivatedOnInitiation());
    // Actions
    valueObject.setActions(
        ims.icp.vo.domain.ICPActionLiteVoAssembler.createICPActionLiteVoCollectionFromICPAction(
            map, domainObject.getActions()));
    // Name
    valueObject.setName(domainObject.getName());
    // Goals
    valueObject.setGoals(
        ims.icp.vo.domain.IcpPhaseGoalVoAssembler.createIcpPhaseGoalVoCollectionFromICPPhaseGoal(
            map, domainObject.getGoals()));
    // HelpURL
    valueObject.setHelpURL(domainObject.getHelpURL());
    // Sequence
    valueObject.setSequence(domainObject.getSequence());
    // Status
    ims.domain.lookups.LookupInstance instance9 = domainObject.getStatus();
    if (null != instance9) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance9.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance9.getImage().getImageId(), instance9.getImage().getImagePath());
      }
      color = instance9.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.PreActiveActiveInactiveStatus voLookup9 =
          new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
              instance9.getId(), instance9.getText(), instance9.isActive(), null, img, color);
      ims.core.vo.lookups.PreActiveActiveInactiveStatus parentVoLookup9 = voLookup9;
      ims.domain.lookups.LookupInstance parent9 = instance9.getParent();
      while (parent9 != null) {
        if (parent9.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent9.getImage().getImageId(), parent9.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent9.getColor();
        if (color != null) color.getValue();
        parentVoLookup9.setParent(
            new ims.core.vo.lookups.PreActiveActiveInactiveStatus(
                parent9.getId(), parent9.getText(), parent9.isActive(), null, img, color));
        parentVoLookup9 = parentVoLookup9.getParent();
        parent9 = parent9.getParent();
      }
      valueObject.setStatus(voLookup9);
    }
    return valueObject;
  }