/** * Returns true if at least one interpretive parameter has a value. * * @return True if we have at least one interpretive parameter value. */ private boolean hasSomeOrAllInterpretiveParameterValues() { InstrumentType instrumentType = getInstrumentType(); InstrumentRun instrumentRun = activeInstrumentRunService.getInstrumentRun(); for (InterpretativeParameter interpretiveParameter : instrumentType.getInterpretativeParameters()) { InstrumentRunValue instrumentRunValue = instrumentRun.getInstrumentRunValue(interpretiveParameter); if (instrumentRunValue != null) { if (instrumentRunValue.getData(interpretiveParameter.getDataType()).getValue() != null) return true; } } for (InstrumentInputParameter instrumentInputParameter : instrumentType.getInputParameters(false)) { InstrumentRunValue instrumentRunValue = instrumentRun.getInstrumentRunValue(instrumentInputParameter); if (instrumentRunValue != null) { if (instrumentRunValue.getData(instrumentInputParameter.getDataType()).getValue() != null) return true; } } return false; }
public WizardStepPanel setUpWizardFlow(WizardStepPanel startStepWhenResuming) { boolean resuming = startStepWhenResuming != null; WizardStepPanel startStep = startStepWhenResuming; WizardStepPanel lastStep = null; List<Instrument> activeInstrumentsForCurrentWorkstation = instrumentService.getActiveInstrumentsForCurrentWorkstation(getInstrumentType()); log.debug("instruments.count={}", activeInstrumentsForCurrentWorkstation.size()); if (activeInstrumentsForCurrentWorkstation.size() == 0) { log.debug("activeInstrumentsForCurrentWorkstation.size() == 0"); startStep = noInstrumentAvailableStep; lastStep = startStep; } else if (activeInstrumentsForCurrentWorkstation.size() > 1) { log.debug("activeInstrumentsForCurrentWorkstation.size() > 1"); // Found too many instruments of the correct type. // Prompt the user to enter the instrument they will be using for this measure. if (startStep == null || startStep.equals(instrumentSelectionStep)) { startStep = instrumentSelectionStep; lastStep = startStep; } else { if (lastStep != null) { lastStep.setNextStep(instrumentSelectionStep); } instrumentSelectionStep.setPreviousStep(lastStep); lastStep = instrumentSelectionStep; } instrumentSelected = true; } else { log.debug("activeInstrumentsForCurrentWorkstation.size() == 1"); // A single instrument of the correct type is associated with this workstation. if (resuming) { log.debug( "Resuming an InstrumentRun with the instrument type [" + getInstrumentType().getName() + "] and barcode [" + activeInstrumentsForCurrentWorkstation.get(0).getBarcode() + "]."); activeInstrumentRunService.setInstrument(activeInstrumentsForCurrentWorkstation.get(0)); } else { log.debug("Not resuming, instrumentSelected={}", instrumentSelected); if (!instrumentSelected) { log.debug( "Starting a new InstrumentRun with the instrument type [" + getInstrumentType().getName() + "] and barcode [" + activeInstrumentsForCurrentWorkstation.get(0).getBarcode() + "]."); activeInstrumentRunService.start( activeInterviewService.getParticipant(), activeInstrumentsForCurrentWorkstation.get(0), getInstrumentType()); instrumentSelected = true; } } } // are there observed contra-indications to display ? if (hasContraindications(Contraindication.Type.OBSERVED)) { if (startStep == null || startStep.equals(observedContraIndicationStep)) { startStep = observedContraIndicationStep; lastStep = startStep; } else { if (lastStep != null) { lastStep.setNextStep(observedContraIndicationStep); } observedContraIndicationStep.setPreviousStep(lastStep); lastStep = observedContraIndicationStep; } } else { log.debug("No contraindications of type OBSERVED. Skipping step."); } // are there asked contra-indications to display ? if (hasContraindications(Contraindication.Type.ASKED)) { if (startStep == null || startStep.equals(askedContraIndicationStep)) { startStep = askedContraIndicationStep; lastStep = startStep; } else { if (lastStep != null) { lastStep.setNextStep(askedContraIndicationStep); } askedContraIndicationStep.setPreviousStep(lastStep); lastStep = askedContraIndicationStep; } } else { log.debug("No contraindications of type ASKED. Skipping step."); } // are there input parameters with input source that requires user provisioning ? // or interpretative questions InstrumentType instrumentType = (InstrumentType) getModelObject(); log.debug( "instrumentInterpretativeParameters.count={}", instrumentType.getInterpretativeParameters().size()); log.debug("instrumentInputParameters.count={}", instrumentType.getInputParameters(false)); if (instrumentType.hasInterpretativeParameter() || instrumentType.hasInputParameter(false)) { if (startStep == null || startStep.equals(inputParametersStep)) { startStep = inputParametersStep; lastStep = startStep; } else { if (lastStep != null) { lastStep.setNextStep(inputParametersStep); } inputParametersStep.setPreviousStep(lastStep); lastStep = inputParametersStep; } } // are there output parameters that are to be captured automatically from instrument (i.e. // requires instrument // launch) ? log.debug("instrument.isInteractive={}", instrumentType.isInteractive()); if (instrumentType.isInteractive()) { if (startStep == null || startStep.equals(instrumentLaunchStep)) { startStep = instrumentLaunchStep; lastStep = startStep; } else { if (lastStep != null) { lastStep.setNextStep(instrumentLaunchStep); } instrumentLaunchStep.setPreviousStep(lastStep); lastStep = instrumentLaunchStep; } } // are there output parameters that are to be captured manually from instrument ? log.debug( "instrumentOutputParameters.MANUAL.count={}", instrumentType.getOutputParameters(InstrumentParameterCaptureMethod.MANUAL).size()); if (getOutputParametersOriginallyMarkedForManualCapture().size() > 0) { if (startStep == null || startStep.equals(outputParametersStep)) { startStep = outputParametersStep; lastStep = startStep; } else { if (lastStep != null) { lastStep.setNextStep(outputParametersStep); } outputParametersStep.setPreviousStep(lastStep); lastStep = outputParametersStep; } } // validation: final step if (startStep == null) { startStep = conclusionStep; lastStep = startStep; } else { if (lastStep != null) { lastStep.setNextStep(conclusionStep); } conclusionStep.setPreviousStep(lastStep); lastStep = conclusionStep; } return startStep; }