public SentToXrayVo save(SentToXrayVo sentToXRayToSave, TrackingForSendToXRayVo tracking) throws StaleObjectException { if (sentToXRayToSave == null) throw new CodingRuntimeException("Cannot save null SentToXRay "); if (!sentToXRayToSave.isValidated()) throw new DomainRuntimeException("SentToXrayVo Not Validated."); DomainFactory factory = getDomainFactory(); SentToXray domainSentToXRay = SentToXrayVoAssembler.extractSentToXray(factory, sentToXRayToSave); factory.save(domainSentToXRay); if (tracking!=null) { if (!tracking.isValidated()) throw new DomainRuntimeException("TrackingForAllocatedMedicVo Not Validated."); Tracking domainTracking = TrackingForSendToXRayVoAssembler.extractTracking(factory, tracking); factory.save(domainTracking); } return SentToXrayVoAssembler.create(domainSentToXRay); }
public TrackingForSendToXRayVo getTracking(TrackingRefVo trackingRef) { if (trackingRef == null || trackingRef.getID_Tracking() == null) { throw new CodingRuntimeException("Cannot get TrackingAreaRefVo on null Id for Tracking "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select tracking from Tracking as tracking where tracking.id = :trackingID "); List<?> list = factory.find(hql.toString(), new String[] {"trackingID"}, new Object[] {trackingRef.getID_Tracking()}); return TrackingForSendToXRayVoAssembler.createTrackingForSendToXRayVoCollectionFromTracking(list).get(0); }