/** * Saves ClientImmunisationSchedule (the ClientImmunisationSchedule must be non-null and * validated) */ public ClientImmunisationScheduleVo saveClientImmunisationSchedule( ClientImmunisationScheduleVo clientImmunisationSchdule) throws DomainInterfaceException, StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException { if (clientImmunisationSchdule == null) throw new DomainInterfaceException("Can not save a null client immunisation schedule"); if (!clientImmunisationSchdule.isValidated()) throw new DomainInterfaceException( "The ClientImmunisationScheduleVo was not validated (RecordingSchedulingImpl.java)"); DomainFactory factory = getDomainFactory(); ClientImmunisationSchedule extractClientImmunisationSchedule = ClientImmunisationScheduleVoAssembler.extractClientImmunisationSchedule( factory, clientImmunisationSchdule); factory.save(extractClientImmunisationSchedule); return ClientImmunisationScheduleVoAssembler.create(extractClientImmunisationSchedule); }
/** Returns client immunisation schedule for provided client (null if there is none) */ public ClientImmunisationScheduleVo getClientImmunisationSchedule(PatientRefVo client) throws DomainInterfaceException { if (client == null) throw new DomainInterfaceException( "There was no client selected. No immunisation schedule to display"); DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String query = "select cis from ClientImmunisationSchedule as cis left join cis.client as pat where pat.id = :ID"; markers.add("ID"); values.add(client.getID_Patient()); List results = factory.find(query, markers, values); if (results == null || results.size() == 0) return null; return ClientImmunisationScheduleVoAssembler.create( (ClientImmunisationSchedule) (results.get(0))); }