/** Tests saveNote() without pad. */ @Test public void testSaveNoteWithoutPad() { Note note = service.buildNote(null); note.setName("name"); note.setText("text"); service.saveNote(note, null); assertEquals(note, service.getNote(note.getId()).get()); }
/** Tests deleteNote(). */ @Test public void testDeleteNote() { Note note = service.buildNote(null); note.setName("name"); note.setText("text"); service.saveNote(note, null); service.deleteNote(note); assertFalse(service.getNote(note.getId()).isPresent()); }
/** Tests saveNote() with pad. */ @Test public void testSaveNoteWithPad() { Pad pad = padService.buildPad(); pad.setName("test"); padService.savePad(pad); Note note = service.buildNote(pad.getId()); note.setName("name"); note.setText("text"); service.saveNote(note, pad); assertEquals(note, service.getNote(note.getId()).get()); }
private void createNeededNotes(AnalysisItem analysisItem, NoteService noteService) { if (analysisItem.getIsRejected()) { Note note = noteService.createSavableNote( NoteType.INTERNAL, StringUtil.getMessageForKey("validation.note.retest"), RESULT_SUBJECT, currentUserId); noteUpdateList.add(note); } if (!GenericValidator.isBlankOrNull(analysisItem.getNote())) { NoteType noteType = analysisItem.getIsAccepted() ? NoteType.EXTERNAL : NoteType.INTERNAL; Note note = noteService.createSavableNote( noteType, analysisItem.getNote(), RESULT_SUBJECT, currentUserId); noteUpdateList.add(note); } }
private List<Result> createResultFromAnalysisItem( AnalysisItem analysisItem, AnalysisService analysisService, NoteService noteService) { ResultSaveBean bean = ResultSaveBeanAdapter.fromAnalysisItem(analysisItem); ResultSaveService resultSaveService = new ResultSaveService(analysisService.getAnalysis(), currentUserId); List<Result> results = resultSaveService.createResultsFromTestResultItem(bean, deletableList); if (analysisService.patientReportHasBeenDone() && resultSaveService.isUpdatedResult()) { analysisService.getAnalysis().setCorrectedSincePatientReport(true); noteUpdateList.add( noteService.createSavableNote( NoteType.EXTERNAL, StringUtil.getMessageForKey("note.corrected.result"), RESULT_SUBJECT, currentUserId)); } return results; }