private void createUpdateElisaList(List<AnalysisItem> resultItems) { for (AnalysisItem resultItem : resultItems) { if (resultItem.getIsAccepted()) { List<Analysis> acceptedAnalysisList = createAnalysisFromElisaAnalysisItem(resultItem); for (Analysis analysis : acceptedAnalysisList) { analysis.setStatusId(StatusService.getInstance().getStatusID(AnalysisStatus.Finalized)); analysisUpdateList.add(analysis); } } if (resultItem.getIsRejected()) { List<Analysis> rejectedAnalysisList = createAnalysisFromElisaAnalysisItem(resultItem); for (Analysis analysis : rejectedAnalysisList) { analysis.setStatusId( StatusService.getInstance().getStatusID(AnalysisStatus.BiologistRejected)); analysisUpdateList.add(analysis); } } } }
private void setSampleFinishedStatuses() { sampleFinishedStatus = new ArrayList<Integer>(); sampleFinishedStatus.add( Integer.parseInt(StatusService.getInstance().getStatusID(AnalysisStatus.Finalized))); sampleFinishedStatus.add( Integer.parseInt(StatusService.getInstance().getStatusID(AnalysisStatus.Canceled))); sampleFinishedStatus.add( Integer.parseInt( StatusService.getInstance().getStatusID(AnalysisStatus.NonConforming_depricated))); }
private void checkIfSamplesFinished(List<AnalysisItem> resultItemList) { sampleUpdateList = new ArrayList<Sample>(); String currentSampleId = ""; boolean sampleFinished = true; for (AnalysisItem analysisItem : resultItemList) { String analysisSampleId = sampleDAO.getSampleByAccessionNumber(analysisItem.getAccessionNumber()).getId(); if (!analysisSampleId.equals(currentSampleId)) { currentSampleId = analysisSampleId; List<Analysis> analysisList = analysisDAO.getAnalysesBySampleId(currentSampleId); for (Analysis analysis : analysisList) { if (!sampleFinishedStatus.contains(Integer.parseInt(analysis.getStatusId()))) { sampleFinished = false; break; } } if (sampleFinished) { Sample sample = new Sample(); sample.setId(currentSampleId); sampleDAO.getData(sample); sample.setStatusId(StatusService.getInstance().getStatusID(OrderStatus.Finished)); sampleUpdateList.add(sample); } sampleFinished = true; } } }
private void createUpdateList(List<AnalysisItem> analysisItems, boolean areListeners) { List<String> analysisIdList = new ArrayList<String>(); for (AnalysisItem analysisItem : analysisItems) { if (!analysisItem.isReadOnly() && analysisItemWillBeUpdated(analysisItem)) { AnalysisService analysisService = new AnalysisService(analysisItem.getAnalysisId()); Analysis analysis = analysisService.getAnalysis(); NoteService noteService = new NoteService(analysis); analysis.setSysUserId(currentUserId); if (!analysisIdList.contains(analysis.getId())) { if (analysisItem.getIsAccepted()) { analysis.setStatusId(StatusService.getInstance().getStatusID(AnalysisStatus.Finalized)); analysis.setReleasedDate(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); analysisIdList.add(analysis.getId()); analysisUpdateList.add(analysis); } if (analysisItem.getIsRejected()) { analysis.setStatusId( StatusService.getInstance().getStatusID(AnalysisStatus.BiologistRejected)); analysisIdList.add(analysis.getId()); analysisUpdateList.add(analysis); } } createNeededNotes(analysisItem, noteService); if (areResults(analysisItem)) { List<Result> results = createResultFromAnalysisItem(analysisItem, analysisService, noteService); for (Result result : results) { resultUpdateList.add(result); if (areListeners) { addResultSets(analysis, result); } } } } } }