use of org.akaza.openclinica.bean.login.UserAccountBean 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.login.UserAccountBean 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;
}
use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.
the class RuleController method create.
@RequestMapping(value = "/studies/{study}/connect", method = RequestMethod.POST)
@ResponseBody
public org.openclinica.ns.response.v31.Response create(@RequestBody org.openclinica.ns.response.v31.Response responeType, Model model, HttpSession session, @PathVariable("study") String studyOid) throws Exception {
ResourceBundleProvider.updateLocale(new Locale("en_US"));
StudyDAO studyDao = new StudyDAO(dataSource);
StudyBean currentStudy = studyDao.findByOid(studyOid);
UserAccountBean userAccount = getUserAccount();
mayProceed(userAccount, currentStudy);
Response response = new Response();
response.setValid(Boolean.TRUE);
org.openclinica.ns.response.v31.MessagesType theMessageType = new MessagesType();
theMessageType.setMessage("Hello");
response.getMessages().add(theMessageType);
logger.debug("RPIC READY");
return response;
// model.addAttribute("response", response);
}
use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.
the class RuleController method studyMetadata.
@RequestMapping(value = "/studies/{study}/metadata", method = RequestMethod.GET)
public ModelAndView studyMetadata(Model model, HttpSession session, @PathVariable("study") String studyOid, HttpServletResponse response) throws Exception {
ResourceBundleProvider.updateLocale(new Locale("en_US"));
StudyBean currentStudy = (StudyBean) session.getAttribute("study");
UserAccountBean userAccount = (UserAccountBean) session.getAttribute("userBean");
UserAccountDAO userAccountDao = new UserAccountDAO(dataSource);
userAccount = (UserAccountBean) userAccountDao.findByUserName("root");
StudyDAO studyDao = new StudyDAO(dataSource);
currentStudy = studyDao.findByOid(studyOid);
MetaDataCollector mdc = new MetaDataCollector(dataSource, currentStudy, getRuleSetRuleDao());
AdminDataCollector adc = new AdminDataCollector(dataSource, currentStudy);
// RulesDataCollector rdc = new RulesDataCollector(sm.getDataSource(), currentStudy,getRuleSetRuleDao());
MetaDataCollector.setTextLength(200);
ODMBean odmb = mdc.getODMBean();
odmb.setSchemaLocation("http://www.cdisc.org/ns/odm/v1.3 OpenClinica-ODM1-3-0-OC3-0.xsd");
ArrayList<String> xmlnsList = new ArrayList<String>();
xmlnsList.add("xmlns=\"http://www.cdisc.org/ns/odm/v1.3\"");
// xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/openclinica_odm/v1.3\"");
xmlnsList.add("xmlns:OpenClinica=\"http://www.openclinica.org/ns/odm_ext_v130/v3.1\"");
xmlnsList.add("xmlns:OpenClinicaRules=\"http://www.openclinica.org/ns/rules/v3.1\"");
odmb.setXmlnsList(xmlnsList);
odmb.setODMVersion("oc1.3");
mdc.setODMBean(odmb);
adc.setOdmbean(odmb);
// rdc.setOdmbean(odmb);
mdc.collectFileData();
MetaDataReportBean metaReport = new MetaDataReportBean(mdc.getOdmStudyMap(), coreResources);
metaReport.setODMVersion("oc1.3");
metaReport.setOdmBean(mdc.getODMBean());
metaReport.createChunkedOdmXml(Boolean.FALSE);
adc.collectFileData();
AdminDataReportBean adminReport = new AdminDataReportBean(adc.getOdmAdminDataMap());
adminReport.setODMVersion("oc1.3");
adminReport.setOdmBean(mdc.getODMBean());
adminReport.createChunkedOdmXml(Boolean.FALSE);
// rdc.collectFileData();
// RulesDataReportBean rulesReport = new RulesDataReportBean(rdc.getOdmRulesDataMap(),getCoreResources());
// rulesReport.setODMVersion("oc1.3");
// rulesReport.setOdmBean(mdc.getODMBean());
// rulesReport.createChunkedOdmXml(Boolean.FALSE);
FullReportBean report = new FullReportBean();
report.setAdminDataMap(adc.getOdmAdminDataMap());
report.setOdmStudyMap(mdc.getOdmStudyMap());
report.setCoreResources(coreResources);
// report.setRulesDataMap(rdc.getOdmRulesDataMap());
report.setOdmBean(mdc.getODMBean());
report.setODMVersion("oc1.3");
report.createStudyMetaOdmXml(Boolean.FALSE);
response.setContentType("application/xml");
PrintWriter out = response.getWriter();
out.print(report.getXmlOutput().toString().trim());
return null;
}
use of org.akaza.openclinica.bean.login.UserAccountBean in project OpenClinica by OpenClinica.
the class UserAccountController method isApiKeyExist.
public Boolean isApiKeyExist(String uuid) {
UserAccountDAO udao = new UserAccountDAO(dataSource);
UserAccountBean uBean = (UserAccountBean) udao.findByApiKey(uuid);
if (uBean == null || !uBean.isActive()) {
return false;
} else {
return true;
}
}
Aggregations