/** * Copy one ValueObject to another * * @param valueObjectDest to be updated * @param valueObjectSrc to copy values from */ public static ims.emergency.vo.TrackingForSeenByHCPVo copy( ims.emergency.vo.TrackingForSeenByHCPVo valueObjectDest, ims.emergency.vo.TrackingForSeenByHCPVo valueObjectSrc) { if (null == valueObjectSrc) { return valueObjectSrc; } valueObjectDest.setID_Tracking(valueObjectSrc.getID_Tracking()); valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE()); // Patient valueObjectDest.setPatient(valueObjectSrc.getPatient()); // CurrentArea valueObjectDest.setCurrentArea(valueObjectSrc.getCurrentArea()); // CurrentStatus valueObjectDest.setCurrentStatus(valueObjectSrc.getCurrentStatus()); // isDischarged valueObjectDest.setIsDischarged(valueObjectSrc.getIsDischarged()); // SeenBy valueObjectDest.setSeenBy(valueObjectSrc.getSeenBy()); // TriageDetails valueObjectDest.setTriageDetails(valueObjectSrc.getTriageDetails()); // SeenByNurse valueObjectDest.setSeenByNurse(valueObjectSrc.getSeenByNurse()); // Attendance valueObjectDest.setAttendance(valueObjectSrc.getAttendance()); return valueObjectDest; }
public static ims.emergency.domain.objects.Tracking extractTracking( ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.TrackingForSeenByHCPVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_Tracking(); ims.emergency.domain.objects.Tracking domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.emergency.domain.objects.Tracking) domMap.get(valueObject); } // ims.emergency.vo.TrackingForSeenByHCPVo ID_Tracking field is unknown domainObject = new ims.emergency.domain.objects.Tracking(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_Tracking()); if (domMap.get(key) != null) { return (ims.emergency.domain.objects.Tracking) domMap.get(key); } domainObject = (ims.emergency.domain.objects.Tracking) domainFactory.getDomainObject(ims.emergency.domain.objects.Tracking.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_Tracking()); ims.core.patient.domain.objects.Patient value1 = null; if (null != valueObject.getPatient()) { if (valueObject.getPatient().getBoId() == null) { if (domMap.get(valueObject.getPatient()) != null) { value1 = (ims.core.patient.domain.objects.Patient) domMap.get(valueObject.getPatient()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value1 = domainObject.getPatient(); } else { value1 = (ims.core.patient.domain.objects.Patient) domainFactory.getDomainObject( ims.core.patient.domain.objects.Patient.class, valueObject.getPatient().getBoId()); } } domainObject.setPatient(value1); // SaveAsRefVO - treated as a refVo in extract methods ims.emergency.configuration.domain.objects.TrackingArea value2 = null; if (null != valueObject.getCurrentArea()) { if (valueObject.getCurrentArea().getBoId() == null) { if (domMap.get(valueObject.getCurrentArea()) != null) { value2 = (ims.emergency.configuration.domain.objects.TrackingArea) domMap.get(valueObject.getCurrentArea()); } } else { value2 = (ims.emergency.configuration.domain.objects.TrackingArea) domainFactory.getDomainObject( ims.emergency.configuration.domain.objects.TrackingArea.class, valueObject.getCurrentArea().getBoId()); } } domainObject.setCurrentArea(value2); domainObject.setCurrentStatus( ims.emergency.vo.domain.TrackingAttendanceStatusVoAssembler.extractTrackingAttendanceStatus( domainFactory, valueObject.getCurrentStatus(), domMap)); domainObject.setIsDischarged(valueObject.getIsDischarged()); domainObject.setSeenBy( ims.emergency.vo.domain.SeenByHCPVoAssembler.extractSeenByHCP( domainFactory, valueObject.getSeenBy(), domMap)); domainObject.setTriageDetails( ims.emergency.vo.domain.TriageForSeenByHcpVoAssembler.extractTriage( domainFactory, valueObject.getTriageDetails(), domMap)); domainObject.setSeenByNurse( ims.emergency.vo.domain.SeenByHCPVoAssembler.extractSeenByHCP( domainFactory, valueObject.getSeenByNurse(), domMap)); domainObject.setAttendance( ims.emergency.vo.domain.AttendanceForSeenByHCPVoAssembler.extractEmergencyAttendance( domainFactory, valueObject.getAttendance(), domMap)); return domainObject; }