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