/** * savePendingEmergency */ public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException { if (hasWardChanged == null) throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency"); if (emergency == null) throw new CodingRuntimeException("emergency is null in method savePendingEmergency"); if (!emergency.isValidated()) throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency"); //WDEV-10421 DomainFactory factory = getDomainFactory(); PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency); if(hasWardChanged) { AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory(); doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard()); doAllocWardHist.setAllocatedWardDateTime(new Date()); if(getLoggedInUser() != null) doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser())); doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist); } factory.save(doPendingEmergency); //wdev-16866 if( tracking != null ) { Tracking doTracking = TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking); factory.save(doTracking); } //------------ }