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;
}
Aggregations