Search in sources :

Example 1 with StudyParameterConfig

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

the class MetaDataReportBean method addStudyDetails.

public void addStudyDetails(String currentIndent) {
    StringBuffer xml = this.getXmlOutput();
    String indent = this.getIndent();
    StudyBean study = odmstudy.getMetaDataVersion().getStudy();
    String temp = "";
    if (study.getId() > 0) {
        xml.append(currentIndent + "<OpenClinica:StudyDetails StudyOID=\"" + StringEscapeUtils.escapeXml(study.getOid()) + "\"");
        if (study.getParentStudyId() > 0) {
            temp = study.getName();
            if (temp != null && temp.length() > 0) {
                xml.append(" SiteName=\"" + StringEscapeUtils.escapeXml(temp) + "\"");
            }
            temp = study.getParentStudyName();
            if (temp != null && temp.length() > 0) {
                xml.append(" ParentStudyName=\"" + StringEscapeUtils.escapeXml(temp) + "\"");
            }
        //
        }
        xml.append(">");
        xml.append(nls);
        xml.append(currentIndent + indent + "<OpenClinica:StudyDescriptionAndStatus");
        temp = study.getOfficialTitle();
        if (temp != null && temp.length() > 0) {
            xml.append(" OfficialTitle=\"" + StringEscapeUtils.escapeXml(temp) + "\"");
        }
        temp = study.getSecondaryIdentifier();
        if (temp != null && temp.length() > 0) {
            xml.append(" SecondaryIDs=\"" + StringEscapeUtils.escapeXml(temp) + "\"");
        }
        xml.append(" DateCreated=\"" + new SimpleDateFormat("yyyy-MM-dd").format(study.getCreatedDate()) + "\"");
        if (study.getDatePlannedStart() instanceof java.util.Date) {
            xml.append(" StartDate=\"" + new SimpleDateFormat("yyyy-MM-dd").format(study.getDatePlannedStart()) + "\"");
        }
        if (study.getDatePlannedEnd() != null) {
            xml.append(" StudyCompletionDate=\"" + new SimpleDateFormat("yyyy-MM-dd").format(study.getDatePlannedEnd()) + "\"");
        }
        xml.append(">");
        xml.append(nls);
        temp = study.getStatus() == null ? "" : study.getStatus().getName();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:StudySytemStatus>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:StudySytemStatus>");
            xml.append(nls);
        }
        xml.append(currentIndent + indent + indent + "<OpenClinica:PrincipalInvestigator>" + StringEscapeUtils.escapeXml(study.getPrincipalInvestigator()) + "</OpenClinica:PrincipalInvestigator>");
        xml.append(nls);
        temp = study.getProtocolDescription();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:DetailedDescription>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:DetailedDescription>");
            xml.append(nls);
        }
        xml.append(currentIndent + indent + indent + "<OpenClinica:Sponsor>" + StringEscapeUtils.escapeXml(study.getSponsor()) + "</OpenClinica:Sponsor>");
        xml.append(nls);
        temp = study.getCollaborators();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Collaborators>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Collaborators>");
            xml.append(nls);
        }
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyPhase>" + StringEscapeUtils.escapeXml(study.getPhase()) + "</OpenClinica:StudyPhase>");
        xml.append(nls);
        temp = study.getProtocolType();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:ProtocolType>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:ProtocolType>");
            xml.append(nls);
        }
        if (study.getProtocolDateVerification() != null) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:ProtocolVerificationDate>" + new SimpleDateFormat("yyyy-MM-dd").format(study.getProtocolDateVerification()) + "</OpenClinica:ProtocolVerificationDate>");
            xml.append(nls);
        }
        xml.append(currentIndent + indent + indent + "<OpenClinica:Purpose>" + StringEscapeUtils.escapeXml(study.getPurpose()) + "</OpenClinica:Purpose>");
        xml.append(nls);
        temp = study.getDuration();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Duration>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Duration>");
            xml.append(nls);
        }
        temp = study.getSelection();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Selection>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Selection>");
            xml.append(nls);
        }
        temp = study.getTiming();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Timing>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Timing>");
            xml.append(nls);
        }
        temp = study.getAllocation();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Allocation>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Allocation>");
            xml.append(nls);
        }
        temp = study.getMasking();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Masking>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Masking>");
            xml.append(nls);
        }
        temp = study.getControl();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Control>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Control>");
            xml.append(nls);
        }
        temp = study.getAssignment();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:InterventionModel>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:InterventionModel>");
            xml.append(nls);
        }
        temp = study.getEndpoint();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:StudyClassification>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:StudyClassification>");
            xml.append(nls);
        }
        xml.append(currentIndent + indent + "</OpenClinica:StudyDescriptionAndStatus>");
        xml.append(nls);
        xml.append(currentIndent + indent + "<OpenClinica:ConditionsAndEligibility>");
        xml.append(nls);
        temp = study.getConditions();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Conditions>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Conditions>");
            xml.append(nls);
        }
        temp = study.getKeywords();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Keywords>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:Keywords>");
            xml.append(nls);
        }
        temp = study.getEligibility();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:EligibilityCriteria>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:EligibilityCriteria>");
            xml.append(nls);
        }
        temp = study.getGender();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Sex>" + temp + "</OpenClinica:Sex>");
            xml.append(nls);
        }
        temp = study.getAgeMin();
        String temp2 = study.getAgeMax();
        if (temp != null && temp.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Age MinimumAge=\"" + temp + "\"");
            if (temp2 != null && temp2.length() > 0) {
                xml.append(" MaximumAge=\"" + temp2 + "\"");
            }
            xml.append("/>");
            xml.append(nls);
        } else if (temp2 != null && temp2.length() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:Age  MaximumAge=\"" + temp2 + "\"");
            xml.append("/>");
            xml.append(nls);
        }
        xml.append(currentIndent + indent + indent + "<OpenClinica:HealthyVolunteersAccepted>");
        xml.append(study.getHealthyVolunteerAccepted() ? "Yes" : "No");
        xml.append("</OpenClinica:HealthyVolunteersAccepted>");
        xml.append(nls);
        if (study.getExpectedTotalEnrollment() > 0) {
            xml.append(currentIndent + indent + indent + "<OpenClinica:ExpectedTotalEnrollment>" + study.getExpectedTotalEnrollment() + "</OpenClinica:ExpectedTotalEnrollment>");
            xml.append(nls);
        }
        xml.append(currentIndent + indent + "</OpenClinica:ConditionsAndEligibility>");
        xml.append(nls);
        StringBuffer facility = new StringBuffer();
        temp = study.getFacilityName();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityName>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityName>" + nls : "");
        temp = study.getFacilityCity();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityCity>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityCity>" + nls : "");
        temp = study.getFacilityState();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityState>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityState>" + nls : "");
        temp = study.getFacilityZip();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:PostalCode>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:PostalCode>" + nls : "");
        temp = study.getFacilityCountry();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityCountry>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityCountry>" + nls : "");
        temp = study.getFacilityContactName();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityContactName>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityContactName>" + nls : "");
        temp = study.getFacilityContactDegree();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityContactDegree>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityContactDegree>" + nls : "");
        temp = study.getFacilityContactPhone();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityContactPhone>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityContactPhone>" + nls : "");
        temp = study.getFacilityContactEmail();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:FacilityContactEmail>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:FacilityContactEmail>" + nls : "");
        if (facility.length() > 0) {
            xml.append(currentIndent + indent + "<OpenClinica:FacilityInformation>");
            xml.append(nls);
            xml.append(facility);
            xml.append(currentIndent + indent + "</OpenClinica:FacilityInformation>");
            xml.append(nls);
        }
        facility = new StringBuffer();
        temp = study.getMedlineIdentifier();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:MEDLINEIdentifier>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:MEDLINEIdentifier>" + nls : "");
        facility.append(currentIndent + indent + indent + "<OpenClinica:ResultsReference>" + (study.isResultsReference() ? "Yes" : "No") + "</OpenClinica:ResultsReference>" + nls);
        temp = study.getUrl();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:URLReference>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:URLReference>" + nls : "");
        temp = study.getUrlDescription();
        facility.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:URLDescription>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:URLDescription>" + nls : "");
        xml.append(currentIndent + indent + "<OpenClinica:RelatedInformation>");
        xml.append(nls);
        xml.append(facility);
        xml.append(currentIndent + indent + "</OpenClinica:RelatedInformation>");
        xml.append(nls);
        StudyParameterConfig spc = study.getStudyParameterConfig();
        xml.append(currentIndent + indent + "<OpenClinica:StudyParameterConfiguration>");
        xml.append(nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_collectDob\"" + " Value=\"" + spc.getCollectDob() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_discrepancyManagement\"" + " Value=\"" + spc.getDiscrepancyManagement() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_subjectPersonIdRequired\"" + " Value=\"" + spc.getSubjectPersonIdRequired() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_genderRequired\"" + " Value=\"" + spc.getGenderRequired() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_subjectIdGeneration\"" + " Value=\"" + spc.getSubjectIdGeneration() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_interviewerNameRequired\"" + " Value=\"" + spc.getInterviewerNameRequired() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_interviewerNameDefault\"" + " Value=\"" + spc.getInterviewerNameDefault() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_interviewerNameEditable\"" + " Value=\"" + spc.getInterviewerNameEditable() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_interviewDateRequired\"" + " Value=\"" + spc.getInterviewDateRequired() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_interviewDateDefault\"" + " Value=\"" + spc.getInterviewDateDefault() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_interviewDateEditable\"" + " Value=\"" + spc.getInterviewDateEditable() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_personIdShownOnCRF\"" + " Value=\"" + spc.getPersonIdShownOnCRF() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_secondaryLabelViewable\"" + " Value=\"" + spc.getSecondaryLabelViewable() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_adminForcedReasonForChange\"" + " Value=\"" + spc.getAdminForcedReasonForChange() + "\"/>" + nls);
        xml.append(currentIndent + indent + indent + "<OpenClinica:StudyParameterListRef StudyParameterListID=\"SPL_eventLocationRequired\"" + " Value=\"" + spc.getEventLocationRequired() + "\"/>" + nls);
        addStudyParameterLists(currentIndent + indent + indent);
        xml.append(currentIndent + indent + "</OpenClinica:StudyParameterConfiguration>");
        xml.append(nls);
        xml.append(currentIndent + "</OpenClinica:StudyDetails>");
        xml.append(nls);
    }
}
Also used : StudyParameterConfig(org.akaza.openclinica.bean.service.StudyParameterConfig) OdmStudyBean(org.akaza.openclinica.bean.odmbeans.OdmStudyBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with StudyParameterConfig

use of org.akaza.openclinica.bean.service.StudyParameterConfig 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

StudyParameterConfig (org.akaza.openclinica.bean.service.StudyParameterConfig)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)1 OdmStudyBean (org.akaza.openclinica.bean.odmbeans.OdmStudyBean)1 StudyParameter (org.akaza.openclinica.bean.service.StudyParameter)1 StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)1