Search in sources :

Example 6 with StudyParameter

use of org.akaza.openclinica.bean.service.StudyParameter in project OpenClinica by OpenClinica.

the class StudyConfigService method setParametersForStudy.

/**
     * This method construct an object which has all the study parameter values
     *
     * @param study
     * @return
     */
public StudyBean setParametersForStudy(StudyBean study) {
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(ds);
    ArrayList parameters = spvdao.findAllParameters();
    StudyParameterConfig spc = new StudyParameterConfig();
    for (int i = 0; i < parameters.size(); i++) {
        StudyParameter sp = (StudyParameter) parameters.get(i);
        String handle = sp.getHandle();
        // logger.info("handle:" + handle);
        StudyParameterValueBean spv = spvdao.findByHandleAndStudy(study.getId(), handle);
        // TO DO: will change to use java reflection later
        if (spv.getId() > 0) {
            if (handle.equalsIgnoreCase("collectDob")) {
                spc.setCollectDob(spv.getValue());
            } else if (handle.equalsIgnoreCase("genderRequired")) {
                spc.setGenderRequired(spv.getValue());
            } else if (handle.equalsIgnoreCase("discrepancyManagement")) {
                spc.setDiscrepancyManagement(spv.getValue());
            } else if (handle.equalsIgnoreCase("subjectPersonIdRequired")) {
                spc.setSubjectPersonIdRequired(spv.getValue());
            // logger.info("subjectPersonIdRequired" +
            // spc.getSubjectPersonIdRequired());
            } else if (handle.equalsIgnoreCase("interviewerNameRequired")) {
                spc.setInterviewerNameRequired(spv.getValue());
            } else if (handle.equalsIgnoreCase("interviewerNameDefault")) {
                spc.setInterviewerNameDefault(spv.getValue());
            } else if (handle.equalsIgnoreCase("interviewerNameEditable")) {
                spc.setInterviewerNameEditable(spv.getValue());
            } else if (handle.equalsIgnoreCase("interviewDateRequired")) {
                spc.setInterviewDateRequired(spv.getValue());
            } else if (handle.equalsIgnoreCase("interviewDateDefault")) {
                spc.setInterviewDateDefault(spv.getValue());
            } else if (handle.equalsIgnoreCase("interviewDateEditable")) {
                spc.setInterviewDateEditable(spv.getValue());
            } else if (handle.equalsIgnoreCase("subjectIdGeneration")) {
                spc.setSubjectIdGeneration(spv.getValue());
                logger.debug("subjectIdGeneration" + spc.getSubjectIdGeneration());
            } else if (handle.equalsIgnoreCase("subjectIdPrefixSuffix")) {
                spc.setSubjectIdPrefixSuffix(spv.getValue());
            } else if (handle.equalsIgnoreCase("personIdShownOnCRF")) {
                spc.setPersonIdShownOnCRF(spv.getValue());
            } else if (handle.equalsIgnoreCase("secondaryLabelViewable")) {
                spc.setSecondaryLabelViewable(spv.getValue());
            } else if (handle.equalsIgnoreCase("adminForcedReasonForChange")) {
                spc.setAdminForcedReasonForChange(spv.getValue());
            } else if (handle.equalsIgnoreCase("eventLocationRequired")) {
                spc.setEventLocationRequired(spv.getValue());
            } else if (handle.equalsIgnoreCase("participantPortal")) {
                spc.setParticipantPortal(spv.getValue());
            } else if (handle.equalsIgnoreCase("randomization")) {
                spc.setRandomization(spv.getValue());
            }
        }
    }
    study.setStudyParameterConfig(spc);
    return study;
}
Also used : StudyParameterConfig(org.akaza.openclinica.bean.service.StudyParameterConfig) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyParameter(org.akaza.openclinica.bean.service.StudyParameter) ArrayList(java.util.ArrayList)

Aggregations

StudyParameter (org.akaza.openclinica.bean.service.StudyParameter)6 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 Iterator (java.util.Iterator)3 StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)3 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)1 StudyParameterConfig (org.akaza.openclinica.bean.service.StudyParameterConfig)1 StudyParamsConfig (org.akaza.openclinica.bean.service.StudyParamsConfig)1 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)1