public static ims.core.resource.place.domain.objects.Location extractLocation(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.admin.vo.LocationShortVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_Location();
    ims.core.resource.place.domain.objects.Location domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.resource.place.domain.objects.Location) domMap.get(valueObject);
      }
      // ims.admin.vo.LocationShortVo ID_Location field is unknown
      domainObject = new ims.core.resource.place.domain.objects.Location();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Location());
      if (domMap.get(key) != null) {
        return (ims.core.resource.place.domain.objects.Location) domMap.get(key);
      }
      domainObject =
          (ims.core.resource.place.domain.objects.Location)
              domainFactory.getDomainObject(
                  ims.core.resource.place.domain.objects.Location.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_Location());

    // 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.getUpperName() != null && valueObject.getUpperName().equals("")) {
      valueObject.setUpperName(null);
    }
    domainObject.setUpperName(valueObject.getUpperName());
    // 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.getName() != null && valueObject.getName().equals("")) {
      valueObject.setName(null);
    }
    domainObject.setName(valueObject.getName());
    domainObject.setIsActive(valueObject.getIsActive());
    domainObject.setIsVirtual(valueObject.getIsVirtual());
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value5 = null;
    if (null != valueObject.getType()) {
      value5 = domainFactory.getLookupInstance(valueObject.getType().getID());
    }
    domainObject.setType(value5);
    domainObject.setDisplayInEDTracking(valueObject.getDisplayInEDTracking());
    domainObject.setCaseNoteFolderLocation(valueObject.getCaseNoteFolderLocation());

    return domainObject;
  }