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

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

    // ContactType
    valueObject.setContactType(domainObject.getContactType());
    // Active
    valueObject.setActive(domainObject.isActive());
    // Parent
    if (domainObject.getParent() != null) {
      if (domainObject.getParent()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getParent();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setParent(new ims.oncology.vo.ContactTypesByDisciplineItemRefVo(id, -1));
      } else {
        valueObject.setParent(
            new ims.oncology.vo.ContactTypesByDisciplineItemRefVo(
                domainObject.getParent().getId(), domainObject.getParent().getVersion()));
      }
    }
    // TaxonomyMap
    valueObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            map, domainObject.getTaxonomyMap()));
    return valueObject;
  }
 /**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.oncology.vo.ContactTypesByDisciplineItemVo copy(
     ims.oncology.vo.ContactTypesByDisciplineItemVo valueObjectDest,
     ims.oncology.vo.ContactTypesByDisciplineItemVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_ContactTypesByDisciplineItem(
       valueObjectSrc.getID_ContactTypesByDisciplineItem());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // ContactType
   valueObjectDest.setContactType(valueObjectSrc.getContactType());
   // Active
   valueObjectDest.setActive(valueObjectSrc.getActive());
   // Parent
   valueObjectDest.setParent(valueObjectSrc.getParent());
   // TaxonomyMap
   valueObjectDest.setTaxonomyMap(valueObjectSrc.getTaxonomyMap());
   return valueObjectDest;
 }
  public static ims.oncology.domain.objects.ContactTypesByDisciplineItem
      extractContactTypesByDisciplineItem(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.oncology.vo.ContactTypesByDisciplineItemVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_ContactTypesByDisciplineItem();
    ims.oncology.domain.objects.ContactTypesByDisciplineItem domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.oncology.domain.objects.ContactTypesByDisciplineItem) domMap.get(valueObject);
      }
      // ims.oncology.vo.ContactTypesByDisciplineItemVo ID_ContactTypesByDisciplineItem field is
      // unknown
      domainObject = new ims.oncology.domain.objects.ContactTypesByDisciplineItem();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName()
              + "__"
              + valueObject.getID_ContactTypesByDisciplineItem());
      if (domMap.get(key) != null) {
        return (ims.oncology.domain.objects.ContactTypesByDisciplineItem) domMap.get(key);
      }
      domainObject =
          (ims.oncology.domain.objects.ContactTypesByDisciplineItem)
              domainFactory.getDomainObject(
                  ims.oncology.domain.objects.ContactTypesByDisciplineItem.class, id);

      // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception,
      // but maybe should be handled as that further up.
      if (domainObject == null) return null;

      domMap.put(key, domainObject);
    }
    domainObject.setVersion(valueObject.getVersion_ContactTypesByDisciplineItem());

    // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty
    // string correctly
    // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them
    // consistent at least.
    if (valueObject.getContactType() != null && valueObject.getContactType().equals("")) {
      valueObject.setContactType(null);
    }
    domainObject.setContactType(valueObject.getContactType());
    domainObject.setActive(valueObject.getActive());
    ims.oncology.domain.objects.ContactTypesByDisciplineItem value3 = null;
    if (null != valueObject.getParent()) {
      if (valueObject.getParent().getBoId() == null) {
        if (domMap.get(valueObject.getParent()) != null) {
          value3 =
              (ims.oncology.domain.objects.ContactTypesByDisciplineItem)
                  domMap.get(valueObject.getParent());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
      // BO field
      {
        value3 = domainObject.getParent();
      } else {
        value3 =
            (ims.oncology.domain.objects.ContactTypesByDisciplineItem)
                domainFactory.getDomainObject(
                    ims.oncology.domain.objects.ContactTypesByDisciplineItem.class,
                    valueObject.getParent().getBoId());
      }
    }
    domainObject.setParent(value3);
    domainObject.setTaxonomyMap(
        ims.core.vo.domain.TaxonomyMapAssembler.extractTaxonomyMapList(
            domainFactory, valueObject.getTaxonomyMap(), domainObject.getTaxonomyMap(), domMap));

    return domainObject;
  }