コード例 #1
0
  public static ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment
      extractWheelchairAssessment(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.therapies.vo.WheelchairAssessmentVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_WheelchairAssessment();
    ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment)
            domMap.get(valueObject);
      }
      // ims.therapies.vo.WheelchairAssessmentVo ID_WheelchairAssessment field is unknown
      domainObject = new ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_WheelchairAssessment());
      if (domMap.get(key) != null) {
        return (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment)
            domMap.get(key);
      }
      domainObject =
          (ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment)
              domainFactory.getDomainObject(
                  ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment.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_WheelchairAssessment());

    ims.framework.utils.DateTime dateTime1 = valueObject.getAuthoringDateTime();
    java.util.Date value1 = null;
    if (dateTime1 != null) {
      value1 = dateTime1.getJavaDate();
    }
    domainObject.setAuthoringDateTime(value1);
    domainObject.setAuthoringCP(
        ims.core.vo.domain.HcpAssembler.extractHcp(
            domainFactory, valueObject.getAuthoringCP(), domMap));
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value3 = null;
    if (null != valueObject.getChairType()) {
      value3 = domainFactory.getLookupInstance(valueObject.getChairType().getID());
    }
    domainObject.setChairType(value3);
    domainObject.setSurfaceDistance(
        ims.therapies.vo.domain.WheelchairSurfaceDistanceVoAssembler
            .extractWheelchairSurfaceDistanceSet(
                domainFactory,
                valueObject.getSurfaceDistance(),
                domainObject.getSurfaceDistance(),
                domMap));
    domainObject.setPowerchairSkillsAssess(
        ims.therapies.vo.domain.PowerchairSkillsAssessmentVoAssembler
            .extractPowerchairSkillsAssessmentSet(
                domainFactory,
                valueObject.getPowerchairSkillsAssess(),
                domainObject.getPowerchairSkillsAssess(),
                domMap));
    domainObject.setWheelchairSkillsAssess(
        ims.therapies.vo.domain.WheelchairSkillsAssessmentVoAssembler
            .extractWheelchairSkillsAssessmentSet(
                domainFactory,
                valueObject.getWheelchairSkillsAssess(),
                domainObject.getWheelchairSkillsAssess(),
                domMap));
    ims.core.admin.domain.objects.ClinicalContact value7 = null;
    if (null != valueObject.getClinicalContact()) {
      if (valueObject.getClinicalContact().getBoId() == null) {
        if (domMap.get(valueObject.getClinicalContact()) != null) {
          value7 =
              (ims.core.admin.domain.objects.ClinicalContact)
                  domMap.get(valueObject.getClinicalContact());
        }
      } else if (valueObject.getBoVersion()
          == -1) // RefVo was not modified since obtained from the Assembler, no need to update the
                 // BO field
      {
        value7 = domainObject.getClinicalContact();
      } else {
        value7 =
            (ims.core.admin.domain.objects.ClinicalContact)
                domainFactory.getDomainObject(
                    ims.core.admin.domain.objects.ClinicalContact.class,
                    valueObject.getClinicalContact().getBoId());
      }
    }
    domainObject.setClinicalContact(value7);

    return domainObject;
  }
コード例 #2
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.therapies.mobilitytransfers.domain.objects.WheelchairAssessment
   */
  public static ims.therapies.vo.WheelchairAssessmentVo insert(
      DomainObjectMap map,
      ims.therapies.vo.WheelchairAssessmentVo valueObject,
      ims.therapies.mobilitytransfers.domain.objects.WheelchairAssessment domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // AuthoringDateTime
    java.util.Date AuthoringDateTime = domainObject.getAuthoringDateTime();
    if (null != AuthoringDateTime) {
      valueObject.setAuthoringDateTime(new ims.framework.utils.DateTime(AuthoringDateTime));
    }
    // AuthoringCP
    valueObject.setAuthoringCP(
        ims.core.vo.domain.HcpAssembler.create(map, domainObject.getAuthoringCP()));
    // ChairType
    ims.domain.lookups.LookupInstance instance3 = domainObject.getChairType();
    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.spinalinjuries.vo.lookups.WheelchairType voLookup3 =
          new ims.spinalinjuries.vo.lookups.WheelchairType(
              instance3.getId(), instance3.getText(), instance3.isActive(), null, img, color);
      ims.spinalinjuries.vo.lookups.WheelchairType 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.spinalinjuries.vo.lookups.WheelchairType(
                parent3.getId(), parent3.getText(), parent3.isActive(), null, img, color));
        parentVoLookup3 = parentVoLookup3.getParent();
        parent3 = parent3.getParent();
      }
      valueObject.setChairType(voLookup3);
    }
    // SurfaceDistance
    valueObject.setSurfaceDistance(
        ims.therapies.vo.domain.WheelchairSurfaceDistanceVoAssembler
            .createWheelchairSurfaceDistanceVoCollectionFromWheelchairSurfaceDistance(
                map, domainObject.getSurfaceDistance()));
    // PowerchairSkillsAssess
    valueObject.setPowerchairSkillsAssess(
        ims.therapies.vo.domain.PowerchairSkillsAssessmentVoAssembler
            .createPowerchairSkillsAssessmentVoCollectionFromPowerchairSkillsAssessment(
                map, domainObject.getPowerchairSkillsAssess()));
    // WheelchairSkillsAssess
    valueObject.setWheelchairSkillsAssess(
        ims.therapies.vo.domain.WheelchairSkillsAssessmentVoAssembler
            .createWheelchairSkillsAssessmentVoCollectionFromWheelchairSkillsAssessment(
                map, domainObject.getWheelchairSkillsAssess()));
    // ClinicalContact
    if (domainObject.getClinicalContact() != null) {
      if (domainObject.getClinicalContact()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getClinicalContact();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setClinicalContact(new ims.core.admin.vo.ClinicalContactRefVo(id, -1));
      } else {
        valueObject.setClinicalContact(
            new ims.core.admin.vo.ClinicalContactRefVo(
                domainObject.getClinicalContact().getId(),
                domainObject.getClinicalContact().getVersion()));
      }
    }
    return valueObject;
  }