public static ims.icps.instantiation.domain.objects.PatientICP extractPatientICP( ims.domain.ILightweightDomainFactory domainFactory, ims.icp.vo.PatientICPVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_PatientICP(); ims.icps.instantiation.domain.objects.PatientICP domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.icps.instantiation.domain.objects.PatientICP) domMap.get(valueObject); } // ims.icp.vo.PatientICPVo ID_PatientICP field is unknown domainObject = new ims.icps.instantiation.domain.objects.PatientICP(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PatientICP()); if (domMap.get(key) != null) { return (ims.icps.instantiation.domain.objects.PatientICP) domMap.get(key); } domainObject = (ims.icps.instantiation.domain.objects.PatientICP) domainFactory.getDomainObject( ims.icps.instantiation.domain.objects.PatientICP.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_PatientICP()); 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); ims.core.admin.domain.objects.CareContext value2 = null; if (null != valueObject.getCareContext()) { if (valueObject.getCareContext().getBoId() == null) { if (domMap.get(valueObject.getCareContext()) != null) { value2 = (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value2 = domainObject.getCareContext(); } else { value2 = (ims.core.admin.domain.objects.CareContext) domainFactory.getDomainObject( ims.core.admin.domain.objects.CareContext.class, valueObject.getCareContext().getBoId()); } } domainObject.setCareContext(value2); ims.core.admin.domain.objects.ClinicalContact value3 = null; if (null != valueObject.getClinicalContact()) { if (valueObject.getClinicalContact().getBoId() == null) { if (domMap.get(valueObject.getClinicalContact()) != null) { value3 = (ims.core.admin.domain.objects.ClinicalContact) domMap.get(valueObject.getClinicalContact()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value3 = domainObject.getClinicalContact(); } else { value3 = (ims.core.admin.domain.objects.ClinicalContact) domainFactory.getDomainObject( ims.core.admin.domain.objects.ClinicalContact.class, valueObject.getClinicalContact().getBoId()); } } domainObject.setClinicalContact(value3); ims.core.admin.pas.domain.objects.PASEvent value4 = null; if (null != valueObject.getPasEvent()) { if (valueObject.getPasEvent().getBoId() == null) { if (domMap.get(valueObject.getPasEvent()) != null) { value4 = (ims.core.admin.pas.domain.objects.PASEvent) domMap.get(valueObject.getPasEvent()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value4 = domainObject.getPasEvent(); } else { value4 = (ims.core.admin.pas.domain.objects.PASEvent) domainFactory.getDomainObject( ims.core.admin.pas.domain.objects.PASEvent.class, valueObject.getPasEvent().getBoId()); } } domainObject.setPasEvent(value4); // SaveAsRefVO - treated as a refVo in extract methods ims.icps.configuration.domain.objects.ICP value5 = null; if (null != valueObject.getICP()) { if (valueObject.getICP().getBoId() == null) { if (domMap.get(valueObject.getICP()) != null) { value5 = (ims.icps.configuration.domain.objects.ICP) domMap.get(valueObject.getICP()); } } else { value5 = (ims.icps.configuration.domain.objects.ICP) domainFactory.getDomainObject( ims.icps.configuration.domain.objects.ICP.class, valueObject.getICP().getBoId()); } } domainObject.setICP(value5); // SaveAsRefVO - treated as a refVo in extract methods ims.core.clinical.domain.objects.AuthoringInformation value6 = null; if (null != valueObject.getAuthoringInformation()) { if (valueObject.getAuthoringInformation().getBoId() == null) { if (domMap.get(valueObject.getAuthoringInformation()) != null) { value6 = (ims.core.clinical.domain.objects.AuthoringInformation) domMap.get(valueObject.getAuthoringInformation()); } } else { value6 = (ims.core.clinical.domain.objects.AuthoringInformation) domainFactory.getDomainObject( ims.core.clinical.domain.objects.AuthoringInformation.class, valueObject.getAuthoringInformation().getBoId()); } } domainObject.setAuthoringInformation(value6); // SaveAsRefVO treated as RefValueObject ims.icps.instantiation.vo.PatientICPStageRefVoCollection refCollection7 = new ims.icps.instantiation.vo.PatientICPStageRefVoCollection(); if (valueObject.getStages() != null) { for (int i7 = 0; i7 < valueObject.getStages().size(); i7++) { ims.icps.instantiation.vo.PatientICPStageRefVo ref7 = (ims.icps.instantiation.vo.PatientICPStageRefVo) valueObject.getStages().get(i7); refCollection7.add(ref7); } } int size7 = (null == refCollection7) ? 0 : refCollection7.size(); java.util.Set domainStages7 = domainObject.getStages(); if (domainStages7 == null) { domainStages7 = new java.util.HashSet(); } java.util.Set newSet7 = new java.util.HashSet(); for (int i = 0; i < size7; i++) { ims.icps.instantiation.vo.PatientICPStageRefVo vo = refCollection7.get(i); ims.icps.instantiation.domain.objects.PatientICPStage dom = null; if (null != vo) { if (vo.getBoId() == null) { if (domMap.get(vo) != null) { dom = (ims.icps.instantiation.domain.objects.PatientICPStage) domMap.get(vo); } } else { dom = (ims.icps.instantiation.domain.objects.PatientICPStage) domainFactory.getDomainObject( ims.icps.instantiation.domain.objects.PatientICPStage.class, vo.getBoId()); } } // Trying to avoid the hibernate collection being marked as dirty via its public interface // methods. (like add) if (!domainStages7.contains(dom)) { domainStages7.add(dom); } newSet7.add(dom); } java.util.Set removedSet7 = new java.util.HashSet(); java.util.Iterator iter7 = domainStages7.iterator(); // Find out which objects need to be removed while (iter7.hasNext()) { ims.domain.DomainObject o = (ims.domain.DomainObject) iter7.next(); if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue()) && !newSet7.contains(o)) { removedSet7.add(o); } } iter7 = removedSet7.iterator(); // Remove the unwanted objects while (iter7.hasNext()) { domainStages7.remove(iter7.next()); } domainObject.setStages(domainStages7); domainObject.setHasOutstandingAdminActions(valueObject.getHasOutstandingAdminActions()); domainObject.setHasOutstandingNursingActions(valueObject.getHasOutstandingNursingActions()); domainObject.setHasOutstandingPhysioActions(valueObject.getHasOutstandingPhysioActions()); domainObject.setHasOutstandingClinicalActions(valueObject.getHasOutstandingClinicalActions()); ims.scheduling.vo.Booking_AppointmentRefVoCollection refCollection12 = valueObject.getAppointments(); int size12 = (null == refCollection12) ? 0 : refCollection12.size(); java.util.Set domainAppointments12 = domainObject.getAppointments(); if (domainAppointments12 == null) { domainAppointments12 = new java.util.HashSet(); } java.util.Set newSet12 = new java.util.HashSet(); for (int i = 0; i < size12; i++) { ims.scheduling.vo.Booking_AppointmentRefVo vo = refCollection12.get(i); ims.scheduling.domain.objects.Booking_Appointment dom = null; if (null != vo) { if (vo.getBoId() == null) { if (domMap.get(vo) != null) { dom = (ims.scheduling.domain.objects.Booking_Appointment) domMap.get(vo); } } else { dom = (ims.scheduling.domain.objects.Booking_Appointment) domainFactory.getDomainObject( ims.scheduling.domain.objects.Booking_Appointment.class, vo.getBoId()); } } // Trying to avoid the hibernate collection being marked as dirty via its public interface // methods. (like add) if (!domainAppointments12.contains(dom)) { domainAppointments12.add(dom); } newSet12.add(dom); } java.util.Set removedSet12 = new java.util.HashSet(); java.util.Iterator iter12 = domainAppointments12.iterator(); // Find out which objects need to be removed while (iter12.hasNext()) { ims.domain.DomainObject o = (ims.domain.DomainObject) iter12.next(); if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue()) && !newSet12.contains(o)) { removedSet12.add(o); } } iter12 = removedSet12.iterator(); // Remove the unwanted objects while (iter12.hasNext()) { domainAppointments12.remove(iter12.next()); } domainObject.setAppointments(domainAppointments12); ims.icps.instantiation.vo.PatientCriticalEventsRefVoCollection refCollection13 = valueObject.getCriticalEvents(); int size13 = (null == refCollection13) ? 0 : refCollection13.size(); java.util.Set domainCriticalEvents13 = domainObject.getCriticalEvents(); if (domainCriticalEvents13 == null) { domainCriticalEvents13 = new java.util.HashSet(); } java.util.Set newSet13 = new java.util.HashSet(); for (int i = 0; i < size13; i++) { ims.icps.instantiation.vo.PatientCriticalEventsRefVo vo = refCollection13.get(i); ims.icps.instantiation.domain.objects.PatientCriticalEvents dom = null; if (null != vo) { if (vo.getBoId() == null) { if (domMap.get(vo) != null) { dom = (ims.icps.instantiation.domain.objects.PatientCriticalEvents) domMap.get(vo); } } else { dom = (ims.icps.instantiation.domain.objects.PatientCriticalEvents) domainFactory.getDomainObject( ims.icps.instantiation.domain.objects.PatientCriticalEvents.class, vo.getBoId()); } } // Trying to avoid the hibernate collection being marked as dirty via its public interface // methods. (like add) if (!domainCriticalEvents13.contains(dom)) { domainCriticalEvents13.add(dom); } newSet13.add(dom); } java.util.Set removedSet13 = new java.util.HashSet(); java.util.Iterator iter13 = domainCriticalEvents13.iterator(); // Find out which objects need to be removed while (iter13.hasNext()) { ims.domain.DomainObject o = (ims.domain.DomainObject) iter13.next(); if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue()) && !newSet13.contains(o)) { removedSet13.add(o); } } iter13 = removedSet13.iterator(); // Remove the unwanted objects while (iter13.hasNext()) { domainCriticalEvents13.remove(iter13.next()); } domainObject.setCriticalEvents(domainCriticalEvents13); ims.framework.utils.DateTime dateTime14 = valueObject.getStartedDateTime(); java.util.Date value14 = null; if (dateTime14 != null) { value14 = dateTime14.getJavaDate(); } domainObject.setStartedDateTime(value14); ims.framework.utils.DateTime dateTime15 = valueObject.getCompletedDateTime(); java.util.Date value15 = null; if (dateTime15 != null) { value15 = dateTime15.getJavaDate(); } domainObject.setCompletedDateTime(value15); ims.icps.instantiation.vo.PatientICPEvaluationNoteRefVoCollection refCollection16 = valueObject.getEvaluationNotes(); int size16 = (null == refCollection16) ? 0 : refCollection16.size(); java.util.Set domainEvaluationNotes16 = domainObject.getEvaluationNotes(); if (domainEvaluationNotes16 == null) { domainEvaluationNotes16 = new java.util.HashSet(); } java.util.Set newSet16 = new java.util.HashSet(); for (int i = 0; i < size16; i++) { ims.icps.instantiation.vo.PatientICPEvaluationNoteRefVo vo = refCollection16.get(i); ims.icps.instantiation.domain.objects.PatientICPEvaluationNote dom = null; if (null != vo) { if (vo.getBoId() == null) { if (domMap.get(vo) != null) { dom = (ims.icps.instantiation.domain.objects.PatientICPEvaluationNote) domMap.get(vo); } } else { dom = (ims.icps.instantiation.domain.objects.PatientICPEvaluationNote) domainFactory.getDomainObject( ims.icps.instantiation.domain.objects.PatientICPEvaluationNote.class, vo.getBoId()); } } // Trying to avoid the hibernate collection being marked as dirty via its public interface // methods. (like add) if (!domainEvaluationNotes16.contains(dom)) { domainEvaluationNotes16.add(dom); } newSet16.add(dom); } java.util.Set removedSet16 = new java.util.HashSet(); java.util.Iterator iter16 = domainEvaluationNotes16.iterator(); // Find out which objects need to be removed while (iter16.hasNext()) { ims.domain.DomainObject o = (ims.domain.DomainObject) iter16.next(); if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue()) && !newSet16.contains(o)) { removedSet16.add(o); } } iter16 = removedSet16.iterator(); // Remove the unwanted objects while (iter16.hasNext()) { domainEvaluationNotes16.remove(iter16.next()); } domainObject.setEvaluationNotes(domainEvaluationNotes16); return domainObject; }
public static ims.core.domain.objects.TransportBooking extractTransportBooking( ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.TransportBookingShortVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_TransportBooking(); ims.core.domain.objects.TransportBooking domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.core.domain.objects.TransportBooking) domMap.get(valueObject); } // ims.RefMan.vo.TransportBookingShortVo ID_TransportBooking field is unknown domainObject = new ims.core.domain.objects.TransportBooking(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_TransportBooking()); if (domMap.get(key) != null) { return (ims.core.domain.objects.TransportBooking) domMap.get(key); } domainObject = (ims.core.domain.objects.TransportBooking) domainFactory.getDomainObject(ims.core.domain.objects.TransportBooking.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_TransportBooking()); ims.scheduling.vo.Booking_AppointmentRefVoCollection refCollection1 = valueObject.getAppointments(); int size1 = (null == refCollection1) ? 0 : refCollection1.size(); java.util.Set domainAppointments1 = domainObject.getAppointments(); if (domainAppointments1 == null) { domainAppointments1 = new java.util.HashSet(); } java.util.Set newSet1 = new java.util.HashSet(); for (int i = 0; i < size1; i++) { ims.scheduling.vo.Booking_AppointmentRefVo vo = refCollection1.get(i); ims.scheduling.domain.objects.Booking_Appointment dom = null; if (null != vo) { if (vo.getBoId() == null) { if (domMap.get(vo) != null) { dom = (ims.scheduling.domain.objects.Booking_Appointment) domMap.get(vo); } } else { dom = (ims.scheduling.domain.objects.Booking_Appointment) domainFactory.getDomainObject( ims.scheduling.domain.objects.Booking_Appointment.class, vo.getBoId()); } } // Trying to avoid the hibernate collection being marked as dirty via its public interface // methods. (like add) if (!domainAppointments1.contains(dom)) { domainAppointments1.add(dom); } newSet1.add(dom); } java.util.Set removedSet1 = new java.util.HashSet(); java.util.Iterator iter1 = domainAppointments1.iterator(); // Find out which objects need to be removed while (iter1.hasNext()) { ims.domain.DomainObject o = (ims.domain.DomainObject) iter1.next(); if ((o == null || o.getIsRIE() == null || !o.getIsRIE().booleanValue()) && !newSet1.contains(o)) { removedSet1.add(o); } } iter1 = removedSet1.iterator(); // Remove the unwanted objects while (iter1.hasNext()) { domainAppointments1.remove(iter1.next()); } domainObject.setAppointments(domainAppointments1); java.util.Date value2 = null; ims.framework.utils.Date date2 = valueObject.getDateBooked(); if (date2 != null) { value2 = date2.getDate(); } domainObject.setDateBooked(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.getBookingReference() != null && valueObject.getBookingReference().equals("")) { valueObject.setBookingReference(null); } domainObject.setBookingReference(valueObject.getBookingReference()); ims.core.admin.domain.objects.CareContext value5 = null; if (null != valueObject.getCareContext()) { if (valueObject.getCareContext().getBoId() == null) { if (domMap.get(valueObject.getCareContext()) != null) { value5 = (ims.core.admin.domain.objects.CareContext) domMap.get(valueObject.getCareContext()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value5 = domainObject.getCareContext(); } else { value5 = (ims.core.admin.domain.objects.CareContext) domainFactory.getDomainObject( ims.core.admin.domain.objects.CareContext.class, valueObject.getCareContext().getBoId()); } } domainObject.setCareContext(value5); return domainObject; }