public TrackingLiteVo saveTrackingAndTrackingMovementTimes( TrackingLiteVo record, TrackingMovementTimesVo trackingMovementTimes, CurrentPartialAdmissionForSendToAreaVo partialAdmission, Boolean trigersPreAdmissiontoPAS, EpisodeofCareVo epOfCare, CareContextVo careContext) throws StaleObjectException // WDEV-18278 { if (record == null || trackingMovementTimes == null) throw new DomainRuntimeException(" Tracking or TrackingMovementTimes are not validated."); DomainFactory factory = getDomainFactory(); Tracking doTracking = TrackingLiteVoAssembler.extractTracking(factory, record); factory.save(doTracking); TrackingMovementTimes doTrackingMovementTimes = TrackingMovementTimesVoAssembler.extractTrackingMovementTimes( factory, trackingMovementTimes); factory.save(doTrackingMovementTimes); if (Boolean.TRUE.equals(trigersPreAdmissiontoPAS)) { if (partialAdmission != null) { EDPartialAdmission doPartialAdmission = CurrentPartialAdmissionForSendToAreaVoAssembler.extractEDPartialAdmission( factory, partialAdmission); factory.save(doPartialAdmission); } if (record != null) { EDPartialAdmissionDialog dom = (EDPartialAdmissionDialog) getDomainImpl(EDPartialAdmissionDialogImpl.class); try { dom.triggerCancelPartialAdmission( record.getAttendance(), record.getCurrentPartialAdmission()); } catch (DomainInterfaceException e) { e.printStackTrace(); } } } if (careContext != null && epOfCare != null) { CareContext doCare = CareContextVoAssembler.extractCareContext(factory, careContext); factory.save(doCare); EpisodeofCareVo lastEpofcare = getEpisodeOfCare(epOfCare.getID_EpisodeOfCare()); EpisodeOfCare doEpisode = EpisodeofCareVoAssembler.extractEpisodeOfCare(factory, lastEpofcare); doEpisode.getCareContexts().add(doCare); factory.save(doEpisode); } return TrackingLiteVoAssembler.create(doTracking); }
public TrackingLiteVo getTrackingLiteVo(TrackingRefVo trackingRef) { if (trackingRef == null) throw new CodingRuntimeException("Tracking cannot be null"); DomainFactory factory = getDomainFactory(); String hsql = "from Tracking as t1_1 where (t1_1.id = :idTracking) "; List trackings = factory.find( hsql, new String[] {"idTracking"}, new Object[] {trackingRef.getID_Tracking()}); if (trackings != null && trackings.size() > 0) { TrackingLiteVoCollection tempColl = TrackingLiteVoAssembler.createTrackingLiteVoCollectionFromTracking(trackings); if (tempColl != null && tempColl.size() > 0) { return tempColl.get(0); } } return null; }