public BedAvailabilityVo save(BedAvailabilityVo bedAvailabilityToSave, TrackingForBedAvailabilityVo trackingToSave) throws StaleObjectException, UniqueKeyViolationException { if (bedAvailabilityToSave == null && trackingToSave == null) throw new CodingRuntimeException("Cannot save null BedAvailability or TrackingForBedAvailability "); DomainFactory factory = getDomainFactory(); if (bedAvailabilityToSave != null && trackingToSave == null) { if (!bedAvailabilityToSave.isValidated()) throw new DomainRuntimeException("BedAvailabilityVo Not Validated."); BedAvailability domainBedAvailability = BedAvailabilityVoAssembler.extractBedAvailability(factory, bedAvailabilityToSave); factory.save(domainBedAvailability); return BedAvailabilityVoAssembler.create(domainBedAvailability); } else if (bedAvailabilityToSave == null && trackingToSave != null) { if (!trackingToSave.isValidated()) throw new DomainRuntimeException("TrackingForBedAvailability Not Validated."); Tracking domainTracking = TrackingForBedAvailabilityVoAssembler.extractTracking(factory, trackingToSave); factory.save(domainTracking); TrackingForBedAvailabilityVo track = TrackingForBedAvailabilityVoAssembler.create(domainTracking); if (track != null) return track.getBedAvailability(); } return null; }
public ims.emergency.vo.BedAvailabilityVo get(ims.emergency.vo.BedAvailabilityRefVo bedAvailability) { if(bedAvailability == null || bedAvailability.getID_BedAvailability() == null) return null; BedAvailability doEdTransfer = (BedAvailability) getDomainFactory().getDomainObject(BedAvailability.class, bedAvailability.getID_BedAvailability()); return BedAvailabilityVoAssembler.create(doEdTransfer); }
public ims.emergency.vo.BedAvailabilityVo save(ims.emergency.vo.BedAvailabilityVo bed) throws ims.domain.exceptions.StaleObjectException { if(bed == null) throw new CodingRuntimeException("Cannot save a null BedAvailabilityVo."); if(!bed.isValidated()) throw new CodingRuntimeException("BedAvailabilityVo is not validated."); DomainFactory factory = getDomainFactory(); BedAvailability doBed = BedAvailabilityVoAssembler.extractBedAvailability(factory, bed); factory.save(doBed); return BedAvailabilityVoAssembler.create(doBed); }
public BedAvailabilityVoCollection listBedAvailability(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) return null; String query = "select bed from BedAvailability as bed left join bed.attendance as cc where cc.id = :CareContextId order by bed.systemInformation.creationDateTime desc"; List<?> list = getDomainFactory().find(query, new String[] {"CareContextId"}, new Object[] {careContext.getID_CareContext()}); return BedAvailabilityVoAssembler.createBedAvailabilityVoCollectionFromBedAvailability(list); }