コード例 #1
0
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.core.admin.pas.domain.objects.BedSpaceState
   */
  public static ims.core.vo.BedSpaceStateVo insert(
      DomainObjectMap map,
      ims.core.vo.BedSpaceStateVo valueObject,
      ims.core.admin.pas.domain.objects.BedSpaceState domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // CurrentBedStatus
    valueObject.setCurrentBedStatus(
        ims.core.vo.domain.BedSpaceStateStatusLiteVoAssembler.create(
            map, domainObject.getCurrentBedStatus()));
    // isMaternity
    valueObject.setIsMaternity(domainObject.isIsMaternity());
    // NoOfInfants
    valueObject.setNoOfInfants(domainObject.getNoOfInfants());
    // BedSpace
    valueObject.setBedSpace(
        ims.core.vo.domain.BedSpaceVoAssembler.create(map, domainObject.getBedSpace()));
    // Ward
    valueObject.setWard(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getWard()));
    // InpatientEpisode
    valueObject.setInpatientEpisode(
        ims.core.vo.domain.InpatientEpisodeLiteVoAssembler.create(
            map, domainObject.getInpatientEpisode()));
    // PreviousBedStatus
    valueObject.setPreviousBedStatus(
        ims.core.vo.domain.BedSpaceStateStatusLiteVoAssembler.create(
            map, domainObject.getPreviousBedStatus()));
    // Comment
    valueObject.setComment(domainObject.getComment());
    // Bay
    valueObject.setBay(
        ims.core.vo.domain.LocationLiteVoAssembler.create(map, domainObject.getBay()));
    return valueObject;
  }
コード例 #2
0
  public static ims.core.admin.pas.domain.objects.BedSpaceState extractBedSpaceState(
      ims.domain.ILightweightDomainFactory domainFactory,
      ims.core.vo.BedSpaceStateVo valueObject,
      HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_BedSpaceState();
    ims.core.admin.pas.domain.objects.BedSpaceState domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.admin.pas.domain.objects.BedSpaceState) domMap.get(valueObject);
      }
      // ims.core.vo.BedSpaceStateVo ID_BedSpaceState field is unknown
      domainObject = new ims.core.admin.pas.domain.objects.BedSpaceState();
      domMap.put(valueObject, domainObject);
    } else {
      String key = (valueObject.getClass().getName() + "__" + valueObject.getID_BedSpaceState());
      if (domMap.get(key) != null) {
        return (ims.core.admin.pas.domain.objects.BedSpaceState) domMap.get(key);
      }
      domainObject =
          (ims.core.admin.pas.domain.objects.BedSpaceState)
              domainFactory.getDomainObject(
                  ims.core.admin.pas.domain.objects.BedSpaceState.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_BedSpaceState());

    domainObject.setCurrentBedStatus(
        ims.core.vo.domain.BedSpaceStateStatusLiteVoAssembler.extractBedSpaceStateStatus(
            domainFactory, valueObject.getCurrentBedStatus(), domMap));
    domainObject.setIsMaternity(valueObject.getIsMaternity());
    domainObject.setNoOfInfants(valueObject.getNoOfInfants());
    domainObject.setBedSpace(
        ims.core.vo.domain.BedSpaceVoAssembler.extractBedSpace(
            domainFactory, valueObject.getBedSpace(), domMap));
    domainObject.setWard(
        ims.core.vo.domain.LocationLiteVoAssembler.extractLocation(
            domainFactory, valueObject.getWard(), domMap));
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.admin.pas.domain.objects.InpatientEpisode value6 = null;
    if (null != valueObject.getInpatientEpisode()) {
      if (valueObject.getInpatientEpisode().getBoId() == null) {
        if (domMap.get(valueObject.getInpatientEpisode()) != null) {
          value6 =
              (ims.core.admin.pas.domain.objects.InpatientEpisode)
                  domMap.get(valueObject.getInpatientEpisode());
        }
      } else {
        value6 =
            (ims.core.admin.pas.domain.objects.InpatientEpisode)
                domainFactory.getDomainObject(
                    ims.core.admin.pas.domain.objects.InpatientEpisode.class,
                    valueObject.getInpatientEpisode().getBoId());
      }
    }
    domainObject.setInpatientEpisode(value6);
    domainObject.setPreviousBedStatus(
        ims.core.vo.domain.BedSpaceStateStatusLiteVoAssembler.extractBedSpaceStateStatus(
            domainFactory, valueObject.getPreviousBedStatus(), domMap));
    // 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.getComment() != null && valueObject.getComment().equals("")) {
      valueObject.setComment(null);
    }
    domainObject.setComment(valueObject.getComment());
    // SaveAsRefVO - treated as a refVo in extract methods
    ims.core.resource.place.domain.objects.Location value9 = null;
    if (null != valueObject.getBay()) {
      if (valueObject.getBay().getBoId() == null) {
        if (domMap.get(valueObject.getBay()) != null) {
          value9 =
              (ims.core.resource.place.domain.objects.Location) domMap.get(valueObject.getBay());
        }
      } else {
        value9 =
            (ims.core.resource.place.domain.objects.Location)
                domainFactory.getDomainObject(
                    ims.core.resource.place.domain.objects.Location.class,
                    valueObject.getBay().getBoId());
      }
    }
    domainObject.setBay(value9);

    return domainObject;
  }