public static ims.core.admin.pas.domain.objects.PASEvent extractPASEvent( ims.domain.ILightweightDomainFactory domainFactory, ims.clinical.vo.PasEventForHospitalAtNightVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_PASEvent(); ims.core.admin.pas.domain.objects.PASEvent domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.core.admin.pas.domain.objects.PASEvent) domMap.get(valueObject); } // ims.clinical.vo.PasEventForHospitalAtNightVo ID_PASEvent field is unknown domainObject = new ims.core.admin.pas.domain.objects.PASEvent(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PASEvent()); if (domMap.get(key) != null) { return (ims.core.admin.pas.domain.objects.PASEvent) domMap.get(key); } domainObject = (ims.core.admin.pas.domain.objects.PASEvent) domainFactory.getDomainObject(ims.core.admin.pas.domain.objects.PASEvent.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_PASEvent()); ims.core.resource.place.domain.objects.Location value1 = null; if (null != valueObject.getLocation()) { if (valueObject.getLocation().getBoId() == null) { if (domMap.get(valueObject.getLocation()) != null) { value1 = (ims.core.resource.place.domain.objects.Location) domMap.get(valueObject.getLocation()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value1 = domainObject.getLocation(); } else { value1 = (ims.core.resource.place.domain.objects.Location) domainFactory.getDomainObject( ims.core.resource.place.domain.objects.Location.class, valueObject.getLocation().getBoId()); } } domainObject.setLocation(value1); return domainObject; }
/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.clinical.vo.PasEventForHospitalAtNightVo copy( ims.clinical.vo.PasEventForHospitalAtNightVo valueObjectDest, ims.clinical.vo.PasEventForHospitalAtNightVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_PASEvent(valueObjectSrc.getID_PASEvent()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Location valueObjectDest.setLocation(valueObjectSrc.getLocation()); return valueObjectDest; }