Search in sources :

Example 96 with StudyDAO

use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.

the class RuleController method create.

@RequestMapping(value = "/studies/{study}/validateRule", method = RequestMethod.POST)
@ResponseBody
public Response create(@RequestBody org.openclinica.ns.rules.v31.Rules rules, Model model, HttpSession session, @PathVariable("study") String studyOid) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    RulesPostImportContainer rpic = mapRulesToRulesPostImportContainer(rules);
    StudyDAO studyDao = new StudyDAO(dataSource);
    StudyBean currentStudy = studyDao.findByOid(studyOid);
    UserAccountBean userAccount = getUserAccount();
    mayProceed(userAccount, currentStudy);
    getRulePostImportContainerService(currentStudy, userAccount);
    rpic = getRulePostImportContainerService(currentStudy, userAccount).validateRuleDefs(rpic);
    rpic = getRulePostImportContainerService(currentStudy, userAccount).validateRuleSetDefs(rpic);
    Response response = new Response();
    response.setValid(Boolean.TRUE);
    if (rpic.getInValidRuleDefs().size() > 0 || rpic.getInValidRuleSetDefs().size() > 0) {
        response.setValid(Boolean.FALSE);
        for (AuditableBeanWrapper<RuleBean> beanWrapper : rpic.getInValidRuleDefs()) {
            for (String error : beanWrapper.getImportErrors()) {
                org.openclinica.ns.response.v31.MessagesType messageType = new MessagesType();
                messageType.setMessage(error);
                response.getMessages().add(messageType);
            }
        }
        for (AuditableBeanWrapper<RuleSetBean> beanWrapper : rpic.getInValidRuleSetDefs()) {
            for (String error : beanWrapper.getImportErrors()) {
                org.openclinica.ns.response.v31.MessagesType messageType = new MessagesType();
                messageType.setMessage(error);
                response.getMessages().add(messageType);
            }
        }
    }
    logger.debug("RPIC READY");
    return response;
}
Also used : Locale(java.util.Locale) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) MessagesType(org.openclinica.ns.response.v31.MessagesType) RulesTestMessagesType(org.openclinica.ns.rules_test.v31.RulesTestMessagesType) MessagesType(org.openclinica.ns.response.v31.MessagesType) Response(org.openclinica.ns.response.v31.Response) HttpServletResponse(javax.servlet.http.HttpServletResponse) RulesPostImportContainer(org.akaza.openclinica.domain.rule.RulesPostImportContainer) org.openclinica.ns.rules.v31(org.openclinica.ns.rules.v31) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean) RuleSetRuleBean(org.akaza.openclinica.domain.rule.RuleSetRuleBean) RuleBean(org.akaza.openclinica.domain.rule.RuleBean) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 97 with StudyDAO

use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.

the class SDVController method viewAllSubjectFormHandler.

@RequestMapping("/viewAllSubjectSDVform")
public ModelMap viewAllSubjectFormHandler(HttpServletRequest request, HttpServletResponse response, @RequestParam("studyId") int studyId) {
    ModelMap gridMap = new ModelMap();
    StudyDAO studyDAO = new StudyDAO(dataSource);
    // StudyEventDAO studyEventDAO = new StudyEventDAO(dataSource);
    StudyBean studyBean = (StudyBean) studyDAO.findByPK(studyId);
    String pattern = "MM/dd/yyyy";
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    // List<StudyEventBean> studyEventBeans = studyEventDAO.findAllByStudy(studyBean);
    // List<EventCRFBean> eventCRFBeans = sdvUtil.getAllEventCRFs(studyEventBeans);
    // set up the parameters to take part in filtering
    ServletRequestDataBinder dataBinder = new ServletRequestDataBinder(new SdvFilterDataBean());
    dataBinder.setAllowedFields(new String[] { "study_subject_id", "studyEventDefinition", "studyEventStatus", "eventCRFStatus", "sdvRequirement", "eventcrfSDVStatus", "startUpdatedDate", "endDate", "eventCRFName" });
    dataBinder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(sdf, true));
    dataBinder.bind(request);
    BindingResult bindingResult = dataBinder.getBindingResult();
    // eventCRFBeans = sdvUtil.filterEventCRFs(eventCRFBeans,bindingResult);
    // set up request attributes for sidebar
    // Not necessary when using old page design...
    // setUpSidebar(request);
    request.setAttribute("studyId", studyId);
    // We need a study subject id for the first tab; take it somewhat arbitrarily from the first study event bean
    /* int studySubjectId = 0;

        StudyEventBean studyBeanUrl = studyEventBeans.get(0);
        if(studyBeanUrl != null) {
            studySubjectId= studyBeanUrl.getStudySubjectId();
        }
        request.setAttribute("studySubjectId",studySubjectId);*/
    // set up the elements for the view's filter box
    /*sdvUtil.prepareSDVSelectElements(request,studyBean);*/
    ArrayList<String> pageMessages = (ArrayList<String>) request.getAttribute("pageMessages");
    if (pageMessages == null) {
        pageMessages = new ArrayList<String>();
    }
    request.setAttribute("pageMessages", pageMessages);
    String sdvMatrix = sdvUtil.renderEventCRFTableWithLimit(request, studyId, "");
    gridMap.addAttribute(SUBJECT_SDV_TABLE_ATTRIBUTE, sdvMatrix);
    return gridMap;
}
Also used : BindingResult(org.springframework.validation.BindingResult) CustomDateEditor(org.springframework.beans.propertyeditors.CustomDateEditor) ModelMap(org.springframework.ui.ModelMap) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ServletRequestDataBinder(org.springframework.web.bind.ServletRequestDataBinder) ArrayList(java.util.ArrayList) SdvFilterDataBean(org.akaza.openclinica.controller.helper.SdvFilterDataBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) SimpleDateFormat(java.text.SimpleDateFormat) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 98 with StudyDAO

use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.

the class StudyController method createStudy.

public StudyBean createStudy(StudyBean studyBean, UserAccountBean owner) {
    sdao = new StudyDAO(dataSource);
    StudyBean sBean = (StudyBean) sdao.create(studyBean);
    sBean = (StudyBean) sdao.findByPK(sBean.getId());
    return sBean;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Example 99 with StudyDAO

use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.

the class TechAdminServlet method processRequest.

/*
     * (non-Javadoc)
     *
     * @see org.akaza.openclinica.control.core.SecureController#processRequest()
     */
@Override
protected void processRequest() throws Exception {
    // find last 5 modifed studies
    StudyDAO sdao = new StudyDAO(sm.getDataSource());
    // ArrayList studies = (ArrayList) sdao.findAllByLimit(true);
    // request.setAttribute("studies", studies);
    ArrayList allStudies = (ArrayList) sdao.findAll();
    // request.setAttribute("allStudyNumber", new
    // Integer(allStudies.size()));
    UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());
    // ArrayList users = (ArrayList) udao.findAllByLimit(true);
    // request.setAttribute("users", users);
    ArrayList allUsers = (ArrayList) udao.findAll();
    // request.setAttribute("allUserNumber", new Integer(allUsers.size()));
    SubjectDAO subdao = new SubjectDAO(sm.getDataSource());
    // ArrayList subjects = (ArrayList) subdao.findAllByLimit(true);
    // request.setAttribute("subjects", subjects);
    ArrayList allSubjects = (ArrayList) subdao.findAll();
    // request.setAttribute("allSubjectNumber", new
    // Integer(allSubjects.size()));
    CRFDAO cdao = new CRFDAO(sm.getDataSource());
    // ArrayList crfs = (ArrayList) cdao.findAllByLimit(true);
    // request.setAttribute("crfs", subjects);
    ArrayList allCrfs = (ArrayList) cdao.findAll();
    // request.setAttribute("allCrfNumber", new Integer(allCrfs.size()));
    resetPanel();
    panel.setStudyInfoShown(false);
    panel.setOrderedData(true);
    setToPanel(resword.getString("in_the_application"), "");
    if (allSubjects.size() > 0) {
        setToPanel(resword.getString("subjects"), new Integer(allSubjects.size()).toString());
    }
    if (allUsers.size() > 0) {
        setToPanel(resword.getString("users"), new Integer(allUsers.size()).toString());
    }
    if (allStudies.size() > 0) {
        setToPanel(resword.getString("studies"), new Integer(allStudies.size()).toString());
    }
    if (allCrfs.size() > 0) {
        setToPanel(resword.getString("CRFs"), new Integer(allCrfs.size()).toString());
    }
    forwardPage(Page.TECH_ADMIN_SYSTEM);
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) ArrayList(java.util.ArrayList) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 100 with StudyDAO

use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.

the class AnonymousFormControllerV2 method getStudy.

private StudyBean getStudy(String oid) {
    sdao = new StudyDAO(dataSource);
    StudyBean studyBean = (StudyBean) sdao.findByOid(oid);
    return studyBean;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Aggregations

StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)205 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)184 ArrayList (java.util.ArrayList)116 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)73 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)59 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)57 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)50 Date (java.util.Date)49 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)49 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)47 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)46 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)45 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)43 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)43 HashMap (java.util.HashMap)42 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)39 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)37 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)35 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)34 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)30