use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.
the class UserInfoController method mayProceed.
private boolean mayProceed(String studyOid) throws Exception {
boolean accessPermission = false;
StudyBean siteStudy = getStudy(studyOid);
StudyBean study = getParentStudy(studyOid);
StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(study.getId(), "participantPortal");
participantPortalRegistrar = new ParticipantPortalRegistrar();
// ACTIVE , PENDING , INACTIVE
String pManageStatus = participantPortalRegistrar.getRegistrationStatus(study.getOid()).toString();
// enabled , disabled
String participateStatus = pStatus.getValue().toString();
// available , pending , frozen , locked
String studyStatus = study.getStatus().getName().toString();
// available , pending , frozen , locked
String siteStatus = siteStudy.getStatus().getName().toString();
logger.info("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus + " siteStatus: " + siteStatus);
if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && siteStatus.equalsIgnoreCase("available") && pManageStatus.equalsIgnoreCase("ACTIVE")) {
accessPermission = true;
}
return accessPermission;
}
use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.
the class StudyModuleController method registerParticipate.
@RequestMapping(value = "/{study}/register", method = RequestMethod.POST)
public String registerParticipate(@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(), "participantPortal");
ParticipantPortalRegistrar registrar = new ParticipantPortalRegistrar();
Locale locale = LocaleResolver.getLocale(request);
ResourceBundleProvider.updateLocale(locale);
respage = ResourceBundleProvider.getPageMessagesBundle(locale);
// Check if desired hostName is available. If so, send OCUI registration request
String hostName = request.getParameter("hostName");
if (hostName == null || hostName.equals("")) {
addRegMessage(request, respage.getString("participate_hostname_invalid"));
return "redirect:/pages/studymodule";
}
String status = "";
String nameAvailability = registrar.getHostNameAvailability(hostName);
if (nameAvailability.equals(ParticipantPortalRegistrar.UNAVAILABLE)) {
addRegMessage(request, respage.getString("participate_hostname_not_available"));
return "redirect:/pages/studymodule";
} else if (nameAvailability.equals(ParticipantPortalRegistrar.UNKNOWN)) {
addRegMessage(request, respage.getString("participate_not_available"));
return "redirect:/pages/studymodule";
} else if (nameAvailability.equals(ParticipantPortalRegistrar.INVALID)) {
addRegMessage(request, respage.getString("participate_hostname_invalid"));
return "redirect:/pages/studymodule";
} else {
// Returned status was 'available'. Proceed with registration.
status = registrar.registerStudy(study.getOid(), hostName, study.getIdentifier());
}
// parameter.
if (status.equals("")) {
addRegMessage(request, respage.getString("participate_not_available"));
} else {
// Update OC Study configuration
spv.setStudyId(study.getId());
spv.setParameter("participantPortal");
spv.setValue("enabled");
if (spv.getId() > 0)
spvdao.update(spv);
else
spvdao.create(spv);
StudyBean currentStudy = (StudyBean) request.getSession().getAttribute("study");
currentStudy.getStudyParameterConfig().setParticipantPortal("enabled");
}
return "redirect:/pages/studymodule";
}
use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.
the class StudyModuleController method reactivateParticipate.
@RequestMapping(value = "/{study}/reactivate", method = RequestMethod.GET)
public String reactivateParticipate(@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(), "participantPortal");
spv.setStudyId(study.getId());
spv.setParameter("participantPortal");
spv.setValue("enabled");
if (spv.getId() > 0)
spvdao.update(spv);
else
spvdao.create(spv);
StudyBean currentStudy = (StudyBean) request.getSession().getAttribute("study");
currentStudy.getStudyParameterConfig().setParticipantPortal("enabled");
return "redirect:/pages/studymodule";
}
use of org.akaza.openclinica.dao.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.
the class StudyModuleController method reactivateRandomization.
@RequestMapping(value = "/{study}/reactivaterandomization", method = RequestMethod.GET)
public String reactivateRandomization(@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");
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.service.StudyParameterValueDAO in project OpenClinica by OpenClinica.
the class StudyModuleController method deactivateRandomization.
@RequestMapping(value = "/{study}/deactivaterandomization", method = RequestMethod.GET)
public String deactivateRandomization(@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");
spv.setStudyId(study.getId());
spv.setParameter("randomization");
spv.setValue("disabled");
if (spv.getId() > 0)
spvdao.update(spv);
else
spvdao.create(spv);
StudyBean currentStudy = (StudyBean) request.getSession().getAttribute("study");
currentStudy.getStudyParameterConfig().setRandomization("disabled");
return "redirect:/pages/studymodule";
}
Aggregations