public void saveAttendanceClinicalNotes(AttendanceClinicalNotesVo record) throws StaleObjectException { if(record == null ) throw new CodingRuntimeException("AttendanceClinicalNotesVo not provided"); DomainFactory factory = getDomainFactory(); AttendanceClinicalNotes doAttendanceClinicalNotes = AttendanceClinicalNotesVoAssembler.extractAttendanceClinicalNotes(factory, record); factory.save(doAttendanceClinicalNotes); }
public AttendanceClinicalNotesVo save(AttendanceClinicalNotesVo attendanceClinicalNoteToSave, ValueObject parentRecord) throws StaleObjectException { if (attendanceClinicalNoteToSave == null) throw new CodingRuntimeException("Cannot save null AttendanceClinicalNotesVo "); if (!attendanceClinicalNoteToSave.isValidated()) throw new DomainRuntimeException("AttendanceClinicalNotesVo Not Validated."); DomainFactory factory = getDomainFactory(); AttendanceClinicalNotes domainAttClinicalNote = AttendanceClinicalNotesVoAssembler.extractAttendanceClinicalNotes(factory, attendanceClinicalNoteToSave); factory.save(domainAttClinicalNote); AttendanceClinicalNotesVo attendanceClinicalNoteSaved = AttendanceClinicalNotesVoAssembler.create(domainAttClinicalNote); if (parentRecord!=null && parentRecord instanceof ReferralToSpecialtyTeamVo) { ReferralToSpecialtyTeamVo referralToSpecialtyToSave = (ReferralToSpecialtyTeamVo)parentRecord; referralToSpecialtyToSave=ReferralToSpecialtyTeamVoAssembler.create((ReferralToSpecTeam) factory.getDomainObject(ReferralToSpecTeam.class, referralToSpecialtyToSave.getID_ReferralToSpecTeam())); referralToSpecialtyToSave.setComments(populateCollComments(referralToSpecialtyToSave.getComments(),attendanceClinicalNoteSaved)); //save referralToSpecialty ReferralToSpecTeam domainReferralToSave = ReferralToSpecialtyTeamVoAssembler.extractReferralToSpecTeam(factory, referralToSpecialtyToSave); factory.save(domainReferralToSave); } else if (parentRecord!=null && parentRecord instanceof SeenByHCPVo) { SeenByHCPVo seenByHcpToSave = (SeenByHCPVo)parentRecord; seenByHcpToSave=SeenByHCPVoAssembler.create((SeenByHCP) factory.getDomainObject(SeenByHCP.class, seenByHcpToSave.getID_SeenByHCP())); seenByHcpToSave.setSeenByHCPNotes(populateCollComments(seenByHcpToSave.getSeenByHCPNotes(),attendanceClinicalNoteSaved)); //save referralToSpecialty SeenByHCP domainSeenByHcpToSave = SeenByHCPVoAssembler.extractSeenByHCP(factory, seenByHcpToSave); factory.save(domainSeenByHcpToSave); } return attendanceClinicalNoteSaved; }