Search in sources :

Example 41 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class OdmStudySubjectController method mayProceed.

private boolean mayProceed(String studyOid, StudySubjectBean ssBean) throws Exception {
    boolean accessPermission = false;
    StudyBean study = getParentStudy(studyOid);
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
    StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(study.getId(), "participantPortal");
    participantPortalRegistrar = new ParticipantPortalRegistrar();
    // ACTIVE ,
    String pManageStatus = participantPortalRegistrar.getRegistrationStatus(studyOid).toString();
    // PENDING ,
    // INACTIVE
    // enabled , disabled
    String participateStatus = pStatus.getValue().toString();
    // available , pending , frozen , locked
    String studyStatus = study.getStatus().getName().toString();
    logger.info("pManageStatus: " + pManageStatus + "  participantStatus: " + participateStatus + "   studyStatus: " + studyStatus + "  studySubjectStatus: " + ssBean.getStatus().getName());
    System.out.println("pManageStatus: " + pManageStatus + "  participantStatus: " + participateStatus + "   studyStatus: " + studyStatus + "  studySubjectStatus: " + ssBean.getStatus().getName());
    if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && pManageStatus.equalsIgnoreCase("ACTIVE") && ssBean.getStatus() == Status.AVAILABLE) {
        accessPermission = true;
    }
    return accessPermission;
}
Also used : ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO)

Example 42 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class OdmController method mayProceed.

private boolean mayProceed(String studyOid) throws Exception {
    boolean accessPermission = false;
    StudyBean study = getParentStudy(studyOid);
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
    StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(study.getId(), "participantPortal");
    participantPortalRegistrar = new ParticipantPortalRegistrar();
    // ACTIVE ,
    String pManageStatus = participantPortalRegistrar.getRegistrationStatus(studyOid).toString();
    // PENDING ,
    // INACTIVE
    // enabled , disabled
    String participateStatus = pStatus.getValue().toString();
    // available , pending , frozen , locked
    String studyStatus = study.getStatus().getName().toString();
    System.out.println("pManageStatus: " + pManageStatus + "  participantStatus: " + participateStatus + "   studyStatus: " + studyStatus);
    logger.info("pManageStatus: " + pManageStatus + "  participantStatus: " + participateStatus + "   studyStatus: " + studyStatus);
    if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && pManageStatus.equalsIgnoreCase("ACTIVE")) {
        accessPermission = true;
    }
    return accessPermission;
}
Also used : ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO)

Example 43 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class OpenRosaServices method mayProceedSubmission.

private boolean mayProceedSubmission(String studyOid, StudySubjectBean ssBean) throws Exception {
    boolean accessPermission = false;
    StudyBean study = getParentStudy(studyOid);
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
    StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(study.getId(), "participantPortal");
    participantPortalRegistrar = new ParticipantPortalRegistrar();
    // ACTIVE ,
    String pManageStatus = participantPortalRegistrar.getRegistrationStatus(studyOid).toString();
    // PENDING ,
    // INACTIVE
    // enabled , disabled
    String participateStatus = pStatus.getValue().toString();
    // available , pending , frozen , locked
    String studyStatus = study.getStatus().getName().toString();
    logger.info("pManageStatus: " + pManageStatus + "  participantStatus: " + participateStatus + "   studyStatus: " + studyStatus + "  studySubjectStatus: " + ssBean.getStatus().getName());
    if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && pManageStatus.equalsIgnoreCase("ACTIVE") && ssBean.getStatus() == Status.AVAILABLE) {
        accessPermission = true;
    }
    return accessPermission;
}
Also used : ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO)

Example 44 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class OpenRosaServices method mayProceedPreview.

private boolean mayProceedPreview(String studyOid) throws Exception {
    boolean accessPermission = false;
    StudyBean study = getParentStudy(studyOid);
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
    StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(study.getId(), "participantPortal");
    participantPortalRegistrar = new ParticipantPortalRegistrar();
    // ACTIVE ,
    String pManageStatus = participantPortalRegistrar.getRegistrationStatus(study.getOid()).toString();
    // PENDING ,
    // INACTIVE
    // enabled , disabled
    String participateStatus = pStatus.getValue().toString();
    // available , pending , frozen , locked
    String studyStatus = study.getStatus().getName().toString();
    logger.info("pManageStatus: " + pManageStatus + "  participantStatus: " + participateStatus + "   studyStatus: " + studyStatus);
    if (participateStatus.equalsIgnoreCase("enabled") && (studyStatus.equalsIgnoreCase("available") || studyStatus.equalsIgnoreCase("pending") || studyStatus.equalsIgnoreCase("frozen") || studyStatus.equalsIgnoreCase("locked")) && (pManageStatus.equalsIgnoreCase("ACTIVE") || pManageStatus.equalsIgnoreCase("PENDING") || pManageStatus.equalsIgnoreCase("INACTIVE"))) {
        accessPermission = true;
    }
    return accessPermission;
}
Also used : ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO)

Example 45 with StudyParameterValueDAO

use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.

the class InitUpdateSubStudyServlet method processRequest.

@Override
public void processRequest() throws Exception {
    // baseUrl();
    String userName = request.getRemoteUser();
    StudyDAO sdao = new StudyDAO(sm.getDataSource());
    String idString = request.getParameter("id");
    logger.info("study id:" + idString);
    if (StringUtil.isBlank(idString)) {
        addPageMessage(respage.getString("please_choose_a_study_to_edit"));
        forwardPage(Page.STUDY_LIST_SERVLET);
    } else {
        int studyId = Integer.valueOf(idString.trim()).intValue();
        StudyBean study = (StudyBean) sdao.findByPK(studyId);
        checkRoleByUserAndStudy(ub, study.getParentStudyId(), study.getId());
        String parentStudyName = "";
        StudyBean parent = new StudyBean();
        if (study.getParentStudyId() > 0) {
            parent = (StudyBean) sdao.findByPK(study.getParentStudyId());
            parentStudyName = parent.getName();
            // at this time, this feature is only available for site
            createEventDefinitions(parent);
        }
        if (currentStudy.getId() != study.getId()) {
            ArrayList parentConfigs = currentStudy.getStudyParameters();
            // logger.info("parentConfigs size:" + parentConfigs.size());
            ArrayList configs = new ArrayList();
            StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
            for (int i = 0; i < parentConfigs.size(); i++) {
                StudyParamsConfig scg = (StudyParamsConfig) parentConfigs.get(i);
                if (scg != null) {
                    // find the one that sub study can change
                    if (scg.getValue().getId() > 0 && scg.getParameter().isOverridable()) {
                        // logger.info("parameter:" +
                        // scg.getParameter().getHandle());
                        // logger.info("value:" +
                        // scg.getValue().getValue());
                        StudyParameterValueBean spvb = spvdao.findByHandleAndStudy(study.getId(), scg.getParameter().getHandle());
                        if (spvb.getValue().equals("enabled"))
                            baseUrl();
                        if (spvb.getId() > 0) {
                            // the sub study itself has the parameter
                            scg.setValue(spvb);
                        }
                        configs.add(scg);
                    }
                }
            }
            study.setStudyParameters(configs);
        }
        request.setAttribute("parentStudy", parent);
        session.setAttribute("parentName", parentStudyName);
        session.setAttribute("newStudy", study);
        request.setAttribute("facRecruitStatusMap", CreateStudyServlet.facRecruitStatusMap);
        request.setAttribute("statuses", Status.toStudyUpdateMembersList());
        FormProcessor fp = new FormProcessor(request);
        logger.info("start date:" + study.getDatePlannedEnd());
        if (study.getDatePlannedEnd() != null) {
            fp.addPresetValue(UpdateSubStudyServlet.INPUT_END_DATE, local_df.format(study.getDatePlannedEnd()));
        }
        if (study.getDatePlannedStart() != null) {
            fp.addPresetValue(UpdateSubStudyServlet.INPUT_START_DATE, local_df.format(study.getDatePlannedStart()));
        }
        if (study.getProtocolDateVerification() != null) {
            fp.addPresetValue(UpdateSubStudyServlet.INPUT_VER_DATE, local_df.format(study.getProtocolDateVerification()));
        }
        setPresetValues(fp.getPresetValues());
        forwardPage(Page.UPDATE_SUB_STUDY);
    }
}
Also used : StudyParamsConfig(org.akaza.openclinica.bean.service.StudyParamsConfig) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Aggregations

StudyParameterValueDAO (org.akaza.openclinica.dao.service.StudyParameterValueDAO)54 ArrayList (java.util.ArrayList)37 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)36 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)29 StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)27 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)22 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)21 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)17 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)16 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)15 Date (java.util.Date)13 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)10 FormLayoutDAO (org.akaza.openclinica.dao.submit.FormLayoutDAO)10 HashMap (java.util.HashMap)9 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)9 ParticipantPortalRegistrar (org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar)9 Iterator (java.util.Iterator)8 FormLayoutBean (org.akaza.openclinica.bean.submit.FormLayoutBean)8 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)8 StudyConfigService (org.akaza.openclinica.dao.service.StudyConfigService)7