use of org.akaza.openclinica.dao.managestudy.StudyDAO 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.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.
the class UserAccountController method getStudyByName.
private StudyBean getStudyByName(String name) {
sdao = new StudyDAO(dataSource);
StudyBean studyBean = (StudyBean) sdao.findByName(name);
return studyBean;
}
use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.
the class UserAccountController method getStudy.
private StudyBean getStudy(String oid) {
sdao = new StudyDAO(dataSource);
StudyBean studyBean = (StudyBean) sdao.findByOid(oid);
return studyBean;
}
use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.
the class UserInfoController method getStudy.
private StudyBean getStudy(Integer id) {
sdao = new StudyDAO(dataSource);
StudyBean studyBean = (StudyBean) sdao.findByPK(id);
return studyBean;
}
use of org.akaza.openclinica.dao.managestudy.StudyDAO in project OpenClinica by OpenClinica.
the class XsltTransformJob method initDependencies.
/**
* Initializes the dependencies of this job with the components from the Spring application context.
*
* @param scheduler
*/
private void initDependencies(Scheduler scheduler) {
try {
ApplicationContext ctx = (ApplicationContext) scheduler.getContext().get("applicationContext");
DataSource dataSource = ctx.getBean(DataSource.class);
mailSender = ctx.getBean(OpenClinicaMailSender.class);
auditEventDAO = ctx.getBean(AuditEventDAO.class);
datasetDao = ctx.getBean(DatasetDAO.class);
userAccountDao = ctx.getBean(UserAccountDAO.class);
studyDao = new StudyDAO(dataSource);
archivedDatasetFileDao = ctx.getBean(ArchivedDatasetFileDAO.class);
generateFileService = ctx.getBean(GenerateExtractFileService.class);
odmFileCreation = ctx.getBean(OdmFileCreation.class);
} catch (SchedulerException e) {
throw new IllegalStateException("Could not load dependencies from scheduler context", e);
}
}
Aggregations