コード例 #1
0
 /**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.core.vo.CareContextSmallVo copy(
     ims.core.vo.CareContextSmallVo valueObjectDest,
     ims.core.vo.CareContextSmallVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_CareContext(valueObjectSrc.getID_CareContext());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // Context
   valueObjectDest.setContext(valueObjectSrc.getContext());
   // StartDateTime
   valueObjectDest.setStartDateTime(valueObjectSrc.getStartDateTime());
   // EndDateTime
   valueObjectDest.setEndDateTime(valueObjectSrc.getEndDateTime());
   // CareContextHistory
   valueObjectDest.setCareContextHistory(valueObjectSrc.getCareContextHistory());
   return valueObjectDest;
 }
コード例 #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.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;
  }