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