Search in sources :

Example 71 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class StudyModuleController method registerRandimization.

@RequestMapping(value = "/{study}/randomize", method = RequestMethod.POST)
public String registerRandimization(@PathVariable("study") String studyOid, HttpServletRequest request) throws Exception {
    studyDao = new StudyDAO(dataSource);
    StudyBean study = studyDao.findByOid(studyOid);
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
    StudyParameterValueBean spv = spvdao.findByHandleAndStudy(study.getId(), "randomization");
    RandomizationRegistrar randomizationRegistrar = new RandomizationRegistrar();
    Locale locale = LocaleResolver.getLocale(request);
    ResourceBundleProvider.updateLocale(locale);
    respage = ResourceBundleProvider.getPageMessagesBundle(locale);
    String status = "";
    UserAccountBean userBean = (UserAccountBean) request.getSession().getAttribute("userBean");
    // Update OC Study configuration
    // send another email to sales@openclinica.com thru MandrillViaOcUi
    status = randomizationRegistrar.randomizeStudy(study.getOid(), study.getIdentifier(), userBean);
    if (status.equals("")) {
    // addRegMessage(request, respage.getString("randomization_not_available"));
    } else {
        // Update OC Study configuration
        randomizationRegistrar.sendEmail(mailSender, userBean, respage.getString("randomization_email_subject_sent_to_user"), respage.getString("randomization_email_content_message_sent_to_user"));
        spv.setStudyId(study.getId());
        spv.setParameter("randomization");
        spv.setValue("enabled");
        if (spv.getId() > 0)
            spvdao.update(spv);
        else
            spvdao.create(spv);
        StudyBean currentStudy = (StudyBean) request.getSession().getAttribute("study");
        currentStudy.getStudyParameterConfig().setRandomization("enabled");
    }
    return "redirect:/pages/studymodule";
}
Also used : Locale(java.util.Locale) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) RandomizationRegistrar(org.akaza.openclinica.service.pmanage.RandomizationRegistrar) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 72 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class SystemController method getLdapModule.

/**
 * @api {get} /pages/auth/api/v1/system/modules/auth Retrieve Ldap Module Info
 * @apiName getLdapModule
 * @apiPermission Authenticate using api-key. admin
 * @apiVersion 3.8.0
 * @apiGroup System
 * @apiDescription Retrieves Ldap Module Status Info Per Study
 * @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK
 *                    [{
 *                    "Study Oid": "S_BL101",
 *                    "Module": {
 *                    "Ldap": {
 *                    "enabled": "True",
 *                    "status": "ACTIVE",
 *                    "metadata": {
 *                    "ldap.host": "ldap server url"
 *                    }
 *                    }
 *                    }
 *                    }]
 */
@RequestMapping(value = "/modules/auth", method = RequestMethod.GET)
public ResponseEntity<ArrayList<HashMap<String, Object>>> getLdapModule(HttpServletRequest request) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    ArrayList<HashMap<String, Object>> studyListMap = new ArrayList();
    HttpSession session = request.getSession();
    session.removeAttribute("ldap");
    ArrayList<StudyBean> studyList = getStudyList();
    for (StudyBean studyBean : studyList) {
        HashMap<String, Object> mapRuleDesignerModule = getLdapModuleInSession(studyBean, session);
        HashMap<String, Object> mapStudy = new HashMap<>();
        mapStudy.put("Module", mapRuleDesignerModule);
        mapStudy.put("Study Oid", studyBean.getOid());
        studyListMap.add(mapStudy);
    }
    return new ResponseEntity<ArrayList<HashMap<String, Object>>>(studyListMap, org.springframework.http.HttpStatus.OK);
}
Also used : Locale(java.util.Locale) ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 73 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class SystemController method getAllModules.

/**
 * @api {get} /pages/auth/api/v1/system/modules Retrieve All Modules Info
 * @apiName getModules
 * @apiPermission Authenticate using api-key. admin
 * @apiVersion 3.8.0
 * @apiGroup System
 * @apiDescription Retrieves All Modules Status Info Per Study
 * @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK
 *                    [{
 *                    "Modules": [{
 *                    "Participate": {
 *                    "enabled": "False",
 *                    "status": "INACTIVE",
 *                    "metadata": {}
 *                    }
 *                    }, {
 *                    "Randomize": {
 *                    "enabled": "False",
 *                    "status": "INACTIVE",
 *                    "metadata": {}
 *                    }
 *                    }, {
 *                    "Rule Designer": {
 *                    "enabled": "True",
 *                    "status": "INACTIVE",
 *                    "metadata": {
 *                    "Designer URL": "designer Url"
 *                    }
 *                    }
 *                    }, {
 *                    "Messaging": {
 *                    "enabled": "True",
 *                    "status": "ACTIVE",
 *                    "metadata": {
 *                    "mail.host": "your host",
 *                    "mail.protocol": "smtp"
 *                    }
 *                    }
 *                    }, {
 *                    "Datamart": {
 *                    "enabled": "False",
 *                    "status": "ACTIVE",
 *                    "metadata": {
 *                    "Role Properties": {
 *                    "Login": "True",
 *                    "CreateRole": "False",
 *                    "RoleName": "datamart",
 *                    "Inherit": "True",
 *                    "CreateDb": "False",
 *                    "SuperUser": "False"
 *                    },
 *                    "db1.dataBase": "postgres",
 *                    "db1.url": "jdbc:postgresql url",
 *                    "db1.username": "datamart"
 *                    }
 *                    }
 *                    }, {
 *                    "Web Service": {
 *                    "enabled": "True",
 *                    "status": "INACTIVE",
 *                    "metadata": {
 *                    "WebService URL": "web service url",
 *                    "Http Status Code": "404"
 *                    }
 *                    }
 *                    }, {
 *                    "Ldap": {
 *                    "enabled": "True",
 *                    "status": "ACTIVE",
 *                    "metadata": {
 *                    "ldap.host": "ldap server url"
 *                    }
 *                    }
 *                    }],
 *                    "Study Oid": "S_BL101"
 *                    }]
 */
@RequestMapping(value = "/modules", method = RequestMethod.GET)
public ResponseEntity<ArrayList<HashMap<String, Object>>> getAllModules(HttpServletRequest request) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    HashMap<String, Object> map = new HashMap<>();
    ArrayList<HashMap<String, Object>> studyListMap = new ArrayList();
    HttpSession session = request.getSession();
    session.removeAttribute("ruledesigner");
    session.removeAttribute("messaging");
    session.removeAttribute("datamart");
    session.removeAttribute("webservice");
    session.removeAttribute("ldap");
    ArrayList<StudyBean> studyList = getStudyList();
    for (StudyBean studyBean : studyList) {
        ArrayList<HashMap<String, Object>> listOfModules = new ArrayList();
        HashMap<String, Object> mapParticipantModule = getParticipateModule(studyBean);
        listOfModules.add(mapParticipantModule);
        HashMap<String, Object> mapRandomizeModule = getRandomizeModule(studyBean);
        listOfModules.add(mapRandomizeModule);
        HashMap<String, Object> mapRuleDesignerModule = getRuleDesignerModuleInSession(studyBean, session);
        listOfModules.add(mapRuleDesignerModule);
        HashMap<String, Object> mapMessagingModule = getMessagingModuleInSession(studyBean, session);
        listOfModules.add(mapMessagingModule);
        HashMap<String, Object> mapDatamartModule = getDatamartModuleInSession(studyBean, session);
        listOfModules.add(mapDatamartModule);
        HashMap<String, Object> mapWebServiceModule = getWebServiceModuleInSession(studyBean, session);
        listOfModules.add(mapWebServiceModule);
        HashMap<String, Object> mapLdapModule = getLdapModuleInSession(studyBean, session);
        listOfModules.add(mapLdapModule);
        HashMap<String, Object> mapStudy = new HashMap<>();
        mapStudy.put("Modules", listOfModules);
        mapStudy.put("Study Oid", studyBean.getOid());
        studyListMap.add(mapStudy);
    }
    return new ResponseEntity<ArrayList<HashMap<String, Object>>>(studyListMap, org.springframework.http.HttpStatus.OK);
}
Also used : Locale(java.util.Locale) ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 74 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class SystemController method getStudyList.

public ArrayList<StudyBean> getStudyList() {
    StudyDAO sdao = new StudyDAO(dataSource);
    ArrayList<StudyBean> sBeans = (ArrayList<StudyBean>) sdao.findAllParents();
    return sBeans;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Example 75 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class SystemController method getWebServicesModule.

/**
 * @api {get} /pages/auth/api/v1/system/modules/webservices Retrieve Web Services Module Info
 * @apiName getWebServicesModule
 * @apiPermission Authenticate using api-key. admin
 * @apiVersion 3.8.0
 * @apiGroup System
 * @apiDescription Retrieves Web Services Module Status Info Per Study
 * @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK
 *                    [{
 *                    "Study Oid": "S_BL101",
 *                    "Module": {
 *                    "Web Service": {
 *                    "enabled": "True",
 *                    "status": "INACTIVE",
 *                    "metadata": {
 *                    "WebService URL": "web service url",
 *                    "Http Status Code": "404"
 *                    }
 *                    }
 *                    }
 *                    }]
 */
@RequestMapping(value = "/modules/webservices", method = RequestMethod.GET)
public ResponseEntity<ArrayList<HashMap<String, Object>>> getWebServicesModule(HttpServletRequest request) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    ArrayList<HashMap<String, Object>> studyListMap = new ArrayList();
    HttpSession session = request.getSession();
    session.removeAttribute("webservice");
    ArrayList<StudyBean> studyList = getStudyList();
    for (StudyBean studyBean : studyList) {
        HashMap<String, Object> mapRuleDesignerModule = getWebServiceModuleInSession(studyBean, session);
        HashMap<String, Object> mapStudy = new HashMap<>();
        mapStudy.put("Module", mapRuleDesignerModule);
        mapStudy.put("Study Oid", studyBean.getOid());
        studyListMap.add(mapStudy);
    }
    return new ResponseEntity<ArrayList<HashMap<String, Object>>>(studyListMap, org.springframework.http.HttpStatus.OK);
}
Also used : Locale(java.util.Locale) ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)366 ArrayList (java.util.ArrayList)185 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)184 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)92 HashMap (java.util.HashMap)85 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)68 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)65 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)62 Date (java.util.Date)61 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)59 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)58 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)56 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)45 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)42 Locale (java.util.Locale)41 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)41 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)38