public static ims.clinical.domain.objects.PerfProcAndSignOutIntraOp extractPerfProcAndSignOutIntraOp( ims.domain.ILightweightDomainFactory domainFactory, ims.clinical.vo.PerformedProcAndSignOutIntraOpVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_PerfProcAndSignOutIntraOp(); ims.clinical.domain.objects.PerfProcAndSignOutIntraOp domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.clinical.domain.objects.PerfProcAndSignOutIntraOp) domMap.get(valueObject); } // ims.clinical.vo.PerformedProcAndSignOutIntraOpVo ID_PerfProcAndSignOutIntraOp field is // unknown domainObject = new ims.clinical.domain.objects.PerfProcAndSignOutIntraOp(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_PerfProcAndSignOutIntraOp()); if (domMap.get(key) != null) { return (ims.clinical.domain.objects.PerfProcAndSignOutIntraOp) domMap.get(key); } domainObject = (ims.clinical.domain.objects.PerfProcAndSignOutIntraOp) domainFactory.getDomainObject( ims.clinical.domain.objects.PerfProcAndSignOutIntraOp.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_PerfProcAndSignOutIntraOp()); ims.scheduling.domain.objects.Booking_Appointment value1 = null; if (null != valueObject.getTheatreAppointment()) { if (valueObject.getTheatreAppointment().getBoId() == null) { if (domMap.get(valueObject.getTheatreAppointment()) != null) { value1 = (ims.scheduling.domain.objects.Booking_Appointment) domMap.get(valueObject.getTheatreAppointment()); } } else if (valueObject.getBoVersion() == -1) // RefVo was not modified since obtained from the Assembler, no need to update the // BO field { value1 = domainObject.getTheatreAppointment(); } else { value1 = (ims.scheduling.domain.objects.Booking_Appointment) domainFactory.getDomainObject( ims.scheduling.domain.objects.Booking_Appointment.class, valueObject.getTheatreAppointment().getBoId()); } } domainObject.setTheatreAppointment(value1); domainObject.setUnplannedreturntotheatre(valueObject.getUnplannedreturntotheatre()); domainObject.setConfirmedCountsComplete(valueObject.getConfirmedCountsComplete()); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value4 = null; if (null != valueObject.getAntibioticsAfterKnifeToSkin()) { value4 = domainFactory.getLookupInstance(valueObject.getAntibioticsAfterKnifeToSkin().getID()); } domainObject.setAntibioticsAfterKnifeToSkin(value4); ims.framework.utils.DateTime dateTime5 = valueObject.getTimeIntraOpAntibioticsGiven(); java.util.Date value5 = null; if (dateTime5 != null) { value5 = dateTime5.getJavaDate(); } domainObject.setTimeIntraOpAntibioticsGiven(value5); domainObject.setAdministrationRecordCompleted(valueObject.getAdministrationRecordCompleted()); domainObject.setAnySpecimensHaveBeenLabelled(valueObject.getAnySpecimensHaveBeenLabelled()); // create LookupInstance from vo LookupType ims.domain.lookups.LookupInstance value8 = null; if (null != valueObject.getAnyEquipmentProblemsAddressed()) { value8 = domainFactory.getLookupInstance(valueObject.getAnyEquipmentProblemsAddressed().getID()); } domainObject.setAnyEquipmentProblemsAddressed(value8); domainObject.setKeyConcernsDocumented(valueObject.getKeyConcernsDocumented()); // SaveAsRefVO - treated as a refVo in extract methods ims.core.resource.people.domain.objects.Hcp value10 = null; if (null != valueObject.getSignatureByRegisteredPractitioner()) { if (valueObject.getSignatureByRegisteredPractitioner().getBoId() == null) { if (domMap.get(valueObject.getSignatureByRegisteredPractitioner()) != null) { value10 = (ims.core.resource.people.domain.objects.Hcp) domMap.get(valueObject.getSignatureByRegisteredPractitioner()); } } else { value10 = (ims.core.resource.people.domain.objects.Hcp) domainFactory.getDomainObject( ims.core.resource.people.domain.objects.Hcp.class, valueObject.getSignatureByRegisteredPractitioner().getBoId()); } } domainObject.setSignatureByRegisteredPractitioner(value10); return domainObject; }
/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.clinical.domain.objects.PerfProcAndSignOutIntraOp */ public static ims.clinical.vo.PerformedProcAndSignOutIntraOpVo insert( DomainObjectMap map, ims.clinical.vo.PerformedProcAndSignOutIntraOpVo valueObject, ims.clinical.domain.objects.PerfProcAndSignOutIntraOp domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_PerfProcAndSignOutIntraOp(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; // TheatreAppointment if (domainObject.getTheatreAppointment() != null) { if (domainObject.getTheatreAppointment() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the // id already. { HibernateProxy p = (HibernateProxy) domainObject.getTheatreAppointment(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setTheatreAppointment(new ims.scheduling.vo.Booking_AppointmentRefVo(id, -1)); } else { valueObject.setTheatreAppointment( new ims.scheduling.vo.Booking_AppointmentRefVo( domainObject.getTheatreAppointment().getId(), domainObject.getTheatreAppointment().getVersion())); } } // Unplannedreturntotheatre valueObject.setUnplannedreturntotheatre(domainObject.isUnplannedreturntotheatre()); // ConfirmedCountsComplete valueObject.setConfirmedCountsComplete(domainObject.isConfirmedCountsComplete()); // AntibioticsAfterKnifeToSkin ims.domain.lookups.LookupInstance instance4 = domainObject.getAntibioticsAfterKnifeToSkin(); if (null != instance4) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance4.getImage() != null) { img = new ims.framework.utils.ImagePath( instance4.getImage().getImageId(), instance4.getImage().getImagePath()); } color = instance4.getColor(); if (color != null) color.getValue(); ims.core.vo.lookups.YesNoNotApplicable voLookup4 = new ims.core.vo.lookups.YesNoNotApplicable( instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color); ims.core.vo.lookups.YesNoNotApplicable parentVoLookup4 = voLookup4; ims.domain.lookups.LookupInstance parent4 = instance4.getParent(); while (parent4 != null) { if (parent4.getImage() != null) { img = new ims.framework.utils.ImagePath( parent4.getImage().getImageId(), parent4.getImage().getImagePath()); } else { img = null; } color = parent4.getColor(); if (color != null) color.getValue(); parentVoLookup4.setParent( new ims.core.vo.lookups.YesNoNotApplicable( parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color)); parentVoLookup4 = parentVoLookup4.getParent(); parent4 = parent4.getParent(); } valueObject.setAntibioticsAfterKnifeToSkin(voLookup4); } // TimeIntraOpAntibioticsGiven java.util.Date TimeIntraOpAntibioticsGiven = domainObject.getTimeIntraOpAntibioticsGiven(); if (null != TimeIntraOpAntibioticsGiven) { valueObject.setTimeIntraOpAntibioticsGiven( new ims.framework.utils.DateTime(TimeIntraOpAntibioticsGiven)); } // AdministrationRecordCompleted valueObject.setAdministrationRecordCompleted(domainObject.isAdministrationRecordCompleted()); // AnySpecimensHaveBeenLabelled valueObject.setAnySpecimensHaveBeenLabelled(domainObject.isAnySpecimensHaveBeenLabelled()); // AnyEquipmentProblemsAddressed ims.domain.lookups.LookupInstance instance8 = domainObject.getAnyEquipmentProblemsAddressed(); if (null != instance8) { ims.framework.utils.ImagePath img = null; ims.framework.utils.Color color = null; img = null; if (instance8.getImage() != null) { img = new ims.framework.utils.ImagePath( instance8.getImage().getImageId(), instance8.getImage().getImagePath()); } color = instance8.getColor(); if (color != null) color.getValue(); ims.core.vo.lookups.YesNoNotApplicable voLookup8 = new ims.core.vo.lookups.YesNoNotApplicable( instance8.getId(), instance8.getText(), instance8.isActive(), null, img, color); ims.core.vo.lookups.YesNoNotApplicable parentVoLookup8 = voLookup8; ims.domain.lookups.LookupInstance parent8 = instance8.getParent(); while (parent8 != null) { if (parent8.getImage() != null) { img = new ims.framework.utils.ImagePath( parent8.getImage().getImageId(), parent8.getImage().getImagePath()); } else { img = null; } color = parent8.getColor(); if (color != null) color.getValue(); parentVoLookup8.setParent( new ims.core.vo.lookups.YesNoNotApplicable( parent8.getId(), parent8.getText(), parent8.isActive(), null, img, color)); parentVoLookup8 = parentVoLookup8.getParent(); parent8 = parent8.getParent(); } valueObject.setAnyEquipmentProblemsAddressed(voLookup8); } // KeyConcernsDocumented valueObject.setKeyConcernsDocumented(domainObject.isKeyConcernsDocumented()); // SignatureByRegisteredPractitioner valueObject.setSignatureByRegisteredPractitioner( ims.core.vo.domain.HcpLiteVoAssembler.create( map, domainObject.getSignatureByRegisteredPractitioner())); return valueObject; }