@Override protected Object formBackingObject(HttpServletRequest request) throws Exception { ReviewAeReportCommand command = new ReviewAeReportCommand(expeditedAdverseEventReportDao, reportDao); String aeReportId = request.getParameter("aeReport"); String reportId = request.getParameter("report"); ExpeditedAdverseEventReport aeReport = expeditedAdverseEventReportDao.getById(Integer.parseInt(aeReportId)); Report report = reportDao.getById(Integer.parseInt(reportId)); if (report.isWorkflowEnabled() && report.getLastVersion().getReportStatus().equals(ReportStatus.COMPLETED) && report.getWorkflowId() != null) { User user = workflowService.findCoordinatingCenterReviewer(report.getWorkflowId()); if (user != null) { Reporter r = new Reporter(); r.copy(user); aeReport.setReviewer(r); } } else { aeReport.setReviewer(aeReport.getReporter()); } String xml = adeersReportGenerator.generateCaaersXml(aeReport, report); String pngOutFile = WebUtils.getBaseFileName(aeReportId, reportId); // CAAERS-5904, see report as per the report definition format List<String> list = adeersReportGenerator.generateImage(xml, tempDir + File.separator + pngOutFile, report); command.addFiles(aeReportId, reportId, list); if (reportId != null && !reportId.equals("") && !reportId.equals("null")) command.setReportId(Integer.parseInt(reportId)); else command.setReportId(null); // (CAAERS-5865)to perform sync only for ctep-esys studies, // set studyOutOfSync to false, so sync will not run for non-ctep-esys studies if (aeReport.getStudy().getCtepEsysIdentifier() == null) { command.setStudyOutOfSync(false); } command.setAeReport(aeReport); for (Report r : aeReport.getReports()) { if (r.getId().equals(Integer.parseInt(reportId))) command.setWorkflowEnabled(r.getReportDefinition().getWorkflowEnabled()); } return command; }
@Override public void postProcess( HttpServletRequest request, SubmitExpeditedAdverseEventCommand command, Errors errors) { log.debug("In postProcess"); int targetPage = WebUtils.getTargetPage(request); if (log.isDebugEnabled()) log.debug("Should process SubmitReportTab:postProcess (back button) ? " + !(targetPage < 2)); if (targetPage < 2) return; // only process if we are moving forward. if (log.isDebugEnabled()) log.debug("Should process SubmitReportTab:postProcess (errors) ? " + !errors.hasErrors()); if (errors.hasErrors()) return; if (log.isDebugEnabled()) log.debug("Report active ? " + command.getReport().isActive()); if (log.isDebugEnabled()) log.debug("Report submitted already ? " + command.isSubmissionInprogress()); if (command.getReport().isActive() && (!command.isSubmissionInprogress())) { reportSubmissionService.submitReport(command.getReport()); command.setSubmissionInprogress(true); } }
@Override protected void createFieldGroups( AeInputFieldCreator creator, ExpeditedAdverseEventInputCommand command) { String baseProp = "responseDescription"; InputField desc = createTextArea( baseProp + ".eventDescription", "Description & treatment of event(s)", new TextSizeValidator(4000)); InputFieldAttributes.setColumns(desc, 70); InputFieldAttributes.setRows(desc, 8); Map<Object, Object> postEventStatusOpts = new LinkedHashMap<Object, Object>(); postEventStatusOpts.put("", "Please select"); postEventStatusOpts.putAll( WebUtils.collectOptions( Arrays.asList(PostAdverseEventStatus.values()), null, "displayName")); Map<Object, Object> eventStatusOpts = new LinkedHashMap<Object, Object>(); eventStatusOpts.put("", "Please select"); eventStatusOpts.putAll( WebUtils.collectOptions(Arrays.asList(EventStatus.values()), null, "displayName")); InputField removedDateField = createPastDateField( baseProp + ".dateRemovedFromProtocol", "Date removed from protocol", false); InputField treatmentTimeField = createTimeField( baseProp + ".primaryTreatmentApproximateTime", "Event treatment, approximate time"); treatmentTimeField .getAttributes() .put( InputField.HELP, "ae.treatment.aeReport.treatmentInformation.primaryTreatmentApproximateTime"); creator.createFieldGroup( "desc", desc, treatmentTimeField, createSelectField( baseProp + ".presentStatus", "Present status", false, postEventStatusOpts), createPastDateField(baseProp + ".recoveryDate", "Date of recovery or death", false), createBooleanSelectField( baseProp + ".retreated", "Has the participant been re-treated?", false), removedDateField); InputField reducedDose = InputFieldFactory.createTextField( baseProp + ".reducedDose", "If reduced, specify: New dose", false); creator.createFieldGroup( "DCP_INFO", createSelectField( baseProp + ".blindBroken", "Was blind broken due to event?", false, createBooleanOptions()), createSelectField( baseProp + ".studyDrugInterrupted", "Was study agent stopped/interrupted/reduced in response to event?", false, createBooleanOptions()), reducedDose, createPastDateField(baseProp + ".reducedDate", "Date dose reduced", false), InputFieldFactory.createTextField( baseProp + ".daysNotGiven", "If interrupted, specify total number of days not given", false), InputFieldFactory.createCheckboxField(baseProp + ".autopsyPerformed", "Autopsy performed?"), InputFieldFactory.createTextField(baseProp + ".causeOfDeath", "Cause of death"), createSelectField( baseProp + ".eventAbate", "Did event abate after study drug was stopped or dose reduced?", false, eventStatusOpts), createSelectField( baseProp + ".eventReappear", "Did event reappear after study drug was reintroduced?", false, eventStatusOpts)); }
@Override public Map<String, InputFieldGroup> createFieldGroups(final T command) { InputFieldGroup participantFieldGroup; Map<Object, Object> options = null; participantFieldGroup = new DefaultInputFieldGroup(PARTICIPANT_FIELD_GROUP); FieldValidator fv = FieldValidator.ALPHANUMERIC_VALIDATOR; if (!command.isUnidentifiedMode()) { participantFieldGroup .getFields() .add( InputFieldFactory.createTextField( "participant.firstName", "First Name", FieldValidator.NOT_NULL_VALIDATOR, fv)); participantFieldGroup .getFields() .add( InputFieldFactory.createTextField( "participant.lastName", "Last Name", FieldValidator.NOT_NULL_VALIDATOR, fv)); participantFieldGroup .getFields() .add(InputFieldFactory.createTextField("participant.maidenName", "Maiden Name", fv)); participantFieldGroup .getFields() .add(InputFieldFactory.createTextField("participant.middleName", "Middle Name", fv)); } InputField dobYear = InputFieldFactory.createTextField("yearString", "Year", true); InputFieldAttributes.setSize(dobYear, 4); InputField dobMonth = InputFieldFactory.createTextField("monthString", "Month", true); InputFieldAttributes.setSize(dobMonth, 2); InputField dobDay = InputFieldFactory.createTextField("dayString", "Day"); InputFieldAttributes.setSize(dobDay, 2); CompositeField dobField; if (command.isUnidentifiedMode()) dobField = new CompositeField( "participant.dateOfBirth", new DefaultInputFieldGroup(null, "Date of birth") .addField(dobYear) .addField(dobMonth)); else dobField = new CompositeField( "participant.dateOfBirth", new DefaultInputFieldGroup(null, "Date of birth") .addField(dobYear) .addField(dobMonth) .addField(dobDay)); dobField.setRequired(true); dobField .getAttributes() .put(InputField.HELP, "par.par_create_participant.participant.dateOfBirth"); participantFieldGroup.getFields().add(dobField); participantFieldGroup .getFields() .add( InputFieldFactory.createSelectField( "participant.gender", "Gender", true, collectOptions(listValues.getParticipantGender()))); participantFieldGroup .getFields() .add( InputFieldFactory.createSelectField( "participant.ethnicity", "Ethnicity", true, collectOptions(listValues.getParticipantEthnicity()))); participantFieldGroup .getFields() .add( InputFieldFactory.createSelectField( "participant.race", "Race", true, collectOptions(listValues.getParticipantRace()))); /* repeatingFieldGroupFactory = new RepeatingFieldGroupFactory("main", "participant.identifiers"); repeatingFieldGroupFactory.addField(InputFieldFactory.createTextField("value", "Identifier", true)); */ options = new LinkedHashMap<Object, Object>(); List<Lov> list = configurationProperty.getMap().get("participantIdentifiersType"); options.put("", "Please select"); options.putAll(WebUtils.collectOptions(list, "code", "desc")); InputFieldGroupMap map = new InputFieldGroupMap(); if (!command.isUnidentifiedMode()) { byte i = 0; byte j = 0; InputFieldGroup idtFieldGroupOrg; InputFieldGroup idtFieldGroupSys; for (Identifier idt : command.participant.getIdentifiers()) { if (idt instanceof SystemAssignedIdentifier) { String s = "participant.systemAssignedIdentifiers[" + i + "]."; idtFieldGroupSys = new DefaultInputFieldGroup("mainSys" + i); idtFieldGroupSys .getFields() .add( InputFieldFactory.createTextField( s + "value", "Identifier", FieldValidator.NOT_NULL_VALIDATOR, FieldValidator.IDENTIFIER_VALIDATOR)); idtFieldGroupSys .getFields() .add( InputFieldFactory.createSelectField( s + "type", "Identifier Type", true, options)); idtFieldGroupSys .getFields() .add(InputFieldFactory.createTextField(s + "systemName", "System Name", true)); map.addInputFieldGroup(idtFieldGroupSys); i++; } else { String s = "participant.organizationIdentifiers[" + j + "]."; idtFieldGroupOrg = new DefaultInputFieldGroup("mainOrg" + j); idtFieldGroupOrg .getFields() .add( InputFieldFactory.createTextField( s + "value", "Identifier", FieldValidator.NOT_NULL_VALIDATOR, FieldValidator.IDENTIFIER_VALIDATOR)); idtFieldGroupOrg .getFields() .add( InputFieldFactory.createSelectField( s + "type", "Identifier Type", true, options)); idtFieldGroupOrg .getFields() .add( InputFieldFactory.createAutocompleterField( s + "organization", "Organization", true)); map.addInputFieldGroup(idtFieldGroupOrg); j++; } } } map.addInputFieldGroup(participantFieldGroup); return map; }
protected Map<Object, Object> collectOptions(final List<ListValues> list) { Map<Object, Object> options = new LinkedHashMap<Object, Object>(); options.putAll(WebUtils.collectOptions(list, "code", "desc")); return options; }