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 addResultSets(Analysis analysis, Result result) { Sample sample = analysis.getSampleItem().getSample(); Patient patient = sampleHumanDAO.getPatientForSample(sample); List<DocumentTrack> documents = documentTrackDAO.getByTypeRecordAndTable(RESULT_REPORT_ID, RESULT_TABLE_ID, result.getId()); if (documents.isEmpty()) { newResultSet.add(new ResultSet(result, null, null, patient, sample, null, false)); } else { modifiedResultSet.add(new ResultSet(result, null, null, patient, sample, null, false)); } }
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); } } } } } }
public void validateQuantifiableItems(AnalysisItem analysisItem, List<ActionError> errors) { if (analysisItem.isHasQualifiedResult() && isBlankOrNull(analysisItem.getQualifiedResultValue()) && analysisItemWillBeUpdated(analysisItem)) { errors.add(new ActionError("errors.missing.result.details", new StringBuilder("Result"))); } // verify that qualifiedResultValue has been entered if required if (!isBlankOrNull(analysisItem.getQualifiedDictionaryId())) { String[] qualifiedDictionaryIds = analysisItem.getQualifiedDictionaryId().replace("[", "").replace("]", "").split(","); Set<String> qualifiedDictIdsSet = new HashSet<String>(Arrays.asList(qualifiedDictionaryIds)); if (qualifiedDictIdsSet.contains(analysisItem.getResult()) && isBlankOrNull(analysisItem.getQualifiedResultValue())) { errors.add(new ActionError("errors.missing.result.details", new StringBuilder("Result"))); } } }
/** * Creates a GPX-formatted file attachment for the given entry. * * @param user * @param entryId * @param fileName * @param activityId * @param track * @param track */ public void createAttachment( User user, int entryId, String fileName, String title, String activityId, GpsTrack track) throws DataAccessException, IOException { Attachment a = new Attachment(); a.setUserName(user.getUserName()); a.setUserId(user.getUserId()); a.setEntryId(entryId); a.setFileType("map"); a.setFileName(fileName); a.setActivityId(activityId); a.setTitle(title); GpxFormatter formatter = new GpxFormatter(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); List<GpsTrack> tracks = new ArrayList<GpsTrack>(); tracks.add(track); formatter.format(tracks, baos); log.debug(new String(baos.toByteArray())); a.setBytes(baos.toByteArray()); new AttachmentDao().create(a); }
/** * Process the specified HTTP request, and create the corresponding HTTP response (or forward to * another web component that will create it). Return an <code>ActionForward</code> instance * describing where and how control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @exception Exception if business logic throws an exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need MessageResources messages = getResources(request); // save errors ActionMessages errors = new ActionMessages(); // START check for login (security) if (!SecurityService.getInstance().checkForLogin(request.getSession(false))) { return (mapping.findForward("welcome")); } // END check for login (security) // START get id of current project from either request, attribute, or cookie // id of project from request String projectId = null; projectId = request.getParameter("projectViewId"); // check attribute in request if (projectId == null) { projectId = (String) request.getAttribute("projectViewId"); } // id of project from cookie if (projectId == null) { projectId = StandardCode.getInstance().getCookie("projectViewId", request.getCookies()); } // default project to last if not in request or cookie if (projectId == null) { List results = ProjectService.getInstance().getProjectList(); ListIterator iterScroll = null; for (iterScroll = results.listIterator(); iterScroll.hasNext(); iterScroll.next()) {} iterScroll.previous(); Project p = (Project) iterScroll.next(); projectId = String.valueOf(p.getProjectId()); } Integer id = Integer.valueOf(projectId); // END get id of current project from either request, attribute, or cookie // get project to edit Project p = ProjectService.getInstance().getSingleProject(id); // get this project's sources Set sources = p.getSourceDocs(); // for each source add each sources' Tasks List totalLinTasks = new ArrayList(); // for each source for (Iterator sourceIter = sources.iterator(); sourceIter.hasNext(); ) { SourceDoc sd = (SourceDoc) sourceIter.next(); // for each target of this source for (Iterator linTargetIter = sd.getTargetDocs().iterator(); linTargetIter.hasNext(); ) { TargetDoc td = (TargetDoc) linTargetIter.next(); // for each lin Task of this target for (Iterator linTaskIter = td.getLinTasks().iterator(); linTaskIter.hasNext(); ) { LinTask lt = (LinTask) linTaskIter.next(); if (lt.getPersonName() != null && lt.getDueDateDate() != null && (lt.getTaskName().equalsIgnoreCase("Translation") || lt.getTaskName().equalsIgnoreCase("Editing") || lt.getTaskName().trim().equalsIgnoreCase("Proofreading") || lt.getTaskName().equalsIgnoreCase("Proofreading / Linguistic QA"))) { totalLinTasks.add(lt); } System.out.println( sd.getLanguage() + "--------" + td.getLanguage() + "---------" + lt.getTaskName()); } } } // Sort by task (orderNum), then source (language), then target (language) Collections.sort(totalLinTasks, CompareTaskLin.getInstance()); Collections.sort(totalLinTasks, CompareTaskLanguages.getInstance()); // array for display in jsp LinTask[] linTasksArray = (LinTask[]) totalLinTasks.toArray(new LinTask[0]); for (int i = 0; i < totalLinTasks.size(); i++) { request.setAttribute(projectId, log); } // place all Tasks for this project into the form for display DynaValidatorForm qvg = (DynaValidatorForm) form; // HERE down is standard and does not need to change when adding task blocks // place this project into request for further display in jsp page request.setAttribute("project", p); // add this project id to cookies; this will remember the last project response.addCookie(StandardCode.getInstance().setCookie("projectViewId", projectId)); // add tab location to cookies; this will remember which tab we are at response.addCookie(StandardCode.getInstance().setCookie("projectViewTab", "Team")); // an update of totals may be required // Forward control to the specified success URI return (mapping.findForward("Success")); }
private List<Analysis> createAnalysisFromElisaAnalysisItem(AnalysisItem analysisItem) { List<Analysis> analysisList = new ArrayList<Analysis>(); Analysis analysis = new Analysis(); if (!isBlankOrNull(analysisItem.getMurexResult())) { analysis = getAnalysisFromId(analysisItem.getMurexAnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getBiolineResult())) { analysis = getAnalysisFromId(analysisItem.getBiolineAnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getIntegralResult())) { analysis = getAnalysisFromId(analysisItem.getIntegralAnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getVironostikaResult())) { analysis = getAnalysisFromId(analysisItem.getVironostikaAnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getGenieIIResult())) { analysis = getAnalysisFromId(analysisItem.getGenieIIAnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getGenieII10Result())) { analysis = getAnalysisFromId(analysisItem.getGenieII10AnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getGenieII100Result())) { analysis = getAnalysisFromId(analysisItem.getGenieII100AnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getWesternBlot1Result())) { analysis = getAnalysisFromId(analysisItem.getWesternBlot1AnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getWesternBlot2Result())) { analysis = getAnalysisFromId(analysisItem.getWesternBlot2AnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getP24AgResult())) { analysis = getAnalysisFromId(analysisItem.getP24AgAnalysisId()); analysisList.add(analysis); } if (!isBlankOrNull(analysisItem.getInnoliaResult())) { analysis = getAnalysisFromId(analysisItem.getInnoliaAnalysisId()); analysisList.add(analysis); } analysisList.add(analysis); return analysisList; }