コード例 #1
0
 /**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.coe.vo.AccommodationHomeFacilities copy(
     ims.coe.vo.AccommodationHomeFacilities valueObjectDest,
     ims.coe.vo.AccommodationHomeFacilities valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_AccommodationHomeFacilities(
       valueObjectSrc.getID_AccommodationHomeFacilities());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // HomeFacilities
   valueObjectDest.setHomeFacilities(valueObjectSrc.getHomeFacilities());
   // Status
   valueObjectDest.setStatus(valueObjectSrc.getStatus());
   // Details
   valueObjectDest.setDetails(valueObjectSrc.getDetails());
   return valueObjectDest;
 }
コード例 #2
0
  public static ims.coe.assessment.domain.objects.AccommodationHomeFacilities
      extractAccommodationHomeFacilities(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.coe.vo.AccommodationHomeFacilities valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_AccommodationHomeFacilities();
    ims.coe.assessment.domain.objects.AccommodationHomeFacilities domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.coe.assessment.domain.objects.AccommodationHomeFacilities)
            domMap.get(valueObject);
      }
      // ims.coe.vo.AccommodationHomeFacilities ID_AccommodationHomeFacilities field is unknown
      domainObject = new ims.coe.assessment.domain.objects.AccommodationHomeFacilities();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName()
              + "__"
              + valueObject.getID_AccommodationHomeFacilities());
      if (domMap.get(key) != null) {
        return (ims.coe.assessment.domain.objects.AccommodationHomeFacilities) domMap.get(key);
      }
      domainObject =
          (ims.coe.assessment.domain.objects.AccommodationHomeFacilities)
              domainFactory.getDomainObject(
                  ims.coe.assessment.domain.objects.AccommodationHomeFacilities.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_AccommodationHomeFacilities());

    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value1 = null;
    if (null != valueObject.getHomeFacilities()) {
      value1 = domainFactory.getLookupInstance(valueObject.getHomeFacilities().getID());
    }
    domainObject.setHomeFacilities(value1);
    // create LookupInstance from vo LookupType
    ims.domain.lookups.LookupInstance value2 = null;
    if (null != valueObject.getStatus()) {
      value2 = domainFactory.getLookupInstance(valueObject.getStatus().getID());
    }
    domainObject.setStatus(value2);
    // 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.getDetails() != null && valueObject.getDetails().equals("")) {
      valueObject.setDetails(null);
    }
    domainObject.setDetails(valueObject.getDetails());

    return domainObject;
  }