/** * Function used to save a PatientGoalTarget to database */ public PatientGoalTargetVo savePatientGoalTarget(PatientGoalTargetVo patientGoalTarget) throws StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException { // Check if PatientGoalTargetVo was validated if (patientGoalTarget == null || !patientGoalTarget.isValidated()) { throw new DomainRuntimeException("Logical error - PatientGoalTargetVo has not been validated"); } // Extract a domain object from PatientGoalTargetVo DomainFactory factory = getDomainFactory(); PatientGoalTarget doPatientGoalTarget = PatientGoalTargetVoAssembler.extractPatientGoalTarget(factory, patientGoalTarget); // Save to database factory.save(doPatientGoalTarget); // Return saved PatientGoalTargetVo (with ID from database) return PatientGoalTargetVoAssembler.create(doPatientGoalTarget); }
/** * Function used to get a PatientGoalTarget from database */ public PatientGoalTargetVo getPatientGoalTarget(PatientGoalTargetRefVo patientGoalTargetRef) { // If no PatientGoalTargetRefVo is provided or no ID is present return null if (patientGoalTargetRef == null || !patientGoalTargetRef.getID_PatientGoalTargetIsNotNull()) return null; // Return PatientGoalTarget based on ID return PatientGoalTargetVoAssembler.create((PatientGoalTarget) getDomainFactory().getDomainObject(PatientGoalTarget.class, patientGoalTargetRef.getID_PatientGoalTarget())); }