コード例 #1
0
  /**
   * Create the ValueObject collection to hold the set of DomainObjects.
   *
   * @param map - maps DomainObjects to created ValueObjects
   * @param domainObjectSet - Set of ims.core.admin.domain.objects.CareContext objects.
   */
  public static ims.core.vo.CareContextSmallVoCollection
      createCareContextSmallVoCollectionFromCareContext(
          DomainObjectMap map, java.util.Set domainObjectSet) {
    ims.core.vo.CareContextSmallVoCollection voList =
        new ims.core.vo.CareContextSmallVoCollection();
    if (null == domainObjectSet) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    java.util.Iterator iterator = domainObjectSet.iterator();
    while (iterator.hasNext()) {
      ims.core.admin.domain.objects.CareContext domainObject =
          (ims.core.admin.domain.objects.CareContext) iterator.next();
      ims.core.vo.CareContextSmallVo vo = create(map, domainObject);

      if (vo != null) voList.add(vo);

      if (domainObject != null) {
        if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true)
          rieCount++;
        else activeCount++;
      }
    }
    voList.setRieCount(rieCount);
    voList.setActiveCount(activeCount);
    return voList;
  }
コード例 #2
0
  /**
   * Create the ValueObject collection to hold the list of DomainObjects.
   *
   * @param map - maps DomainObjects to created ValueObjects
   * @param domainObjectList - List of ims.core.admin.domain.objects.CareContext objects.
   */
  public static ims.core.vo.CareContextSmallVoCollection
      createCareContextSmallVoCollectionFromCareContext(
          DomainObjectMap map, java.util.List domainObjectList) {
    ims.core.vo.CareContextSmallVoCollection voList =
        new ims.core.vo.CareContextSmallVoCollection();
    if (null == domainObjectList) {
      return voList;
    }
    int rieCount = 0;
    int activeCount = 0;
    for (int i = 0; i < domainObjectList.size(); i++) {
      ims.core.admin.domain.objects.CareContext domainObject =
          (ims.core.admin.domain.objects.CareContext) domainObjectList.get(i);
      ims.core.vo.CareContextSmallVo vo = create(map, domainObject);

      if (vo != null) voList.add(vo);

      if (domainObject != null) {
        if (domainObject.getIsRIE() != null && domainObject.getIsRIE().booleanValue() == true)
          rieCount++;
        else activeCount++;
      }
    }

    voList.setRieCount(rieCount);
    voList.setActiveCount(activeCount);
    return voList;
  }
コード例 #3
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.domain.objects.CareContext
   */
  public static ims.core.vo.CareContextMinVo insert(
      DomainObjectMap map,
      ims.core.vo.CareContextMinVo valueObject,
      ims.core.admin.domain.objects.CareContext domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // EpisodeOfCare
    valueObject.setEpisodeOfCare(
        ims.core.vo.domain.EpisodeOfCareForPatientDocumentsVoAssembler.create(
            map, domainObject.getEpisodeOfCare()));
    // StartDateTime
    java.util.Date StartDateTime = domainObject.getStartDateTime();
    if (null != StartDateTime) {
      valueObject.setStartDateTime(new ims.framework.utils.DateTime(StartDateTime));
    }
    // ResponsibleHCP
    if (domainObject.getResponsibleHCP() != null) {
      if (domainObject.getResponsibleHCP()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
      // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getResponsibleHCP();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setResponsibleHCP(new ims.core.resource.people.vo.HcpRefVo(id, -1));
      } else {
        valueObject.setResponsibleHCP(
            new ims.core.resource.people.vo.HcpRefVo(
                domainObject.getResponsibleHCP().getId(),
                domainObject.getResponsibleHCP().getVersion()));
      }
    }
    return valueObject;
  }
コード例 #4
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.domain.objects.CareContext
   */
  public static ims.core.vo.CareContextSmallVo insert(
      DomainObjectMap map,
      ims.core.vo.CareContextSmallVo valueObject,
      ims.core.admin.domain.objects.CareContext domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

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

    // Context
    ims.domain.lookups.LookupInstance instance1 = domainObject.getContext();
    if (null != instance1) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance1.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance1.getImage().getImageId(), instance1.getImage().getImagePath());
      }
      color = instance1.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.ContextType voLookup1 =
          new ims.core.vo.lookups.ContextType(
              instance1.getId(), instance1.getText(), instance1.isActive(), null, img, color);
      ims.core.vo.lookups.ContextType parentVoLookup1 = voLookup1;
      ims.domain.lookups.LookupInstance parent1 = instance1.getParent();
      while (parent1 != null) {
        if (parent1.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent1.getImage().getImageId(), parent1.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent1.getColor();
        if (color != null) color.getValue();
        parentVoLookup1.setParent(
            new ims.core.vo.lookups.ContextType(
                parent1.getId(), parent1.getText(), parent1.isActive(), null, img, color));
        parentVoLookup1 = parentVoLookup1.getParent();
        parent1 = parent1.getParent();
      }
      valueObject.setContext(voLookup1);
    }
    // StartDateTime
    java.util.Date StartDateTime = domainObject.getStartDateTime();
    if (null != StartDateTime) {
      valueObject.setStartDateTime(new ims.framework.utils.DateTime(StartDateTime));
    }
    // EndDateTime
    java.util.Date EndDateTime = domainObject.getEndDateTime();
    if (null != EndDateTime) {
      valueObject.setEndDateTime(new ims.framework.utils.DateTime(EndDateTime));
    }
    // CareContextHistory
    valueObject.setCareContextHistory(
        ims.core.vo.domain.CareContextHistVoAssembler
            .createCareContextHistVoCollectionFromCareContextHistory(
                map, domainObject.getCareContextHistory()));
    return valueObject;
  }