use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class OpenRosaServices method mayProceedSubmission.
private boolean mayProceedSubmission(String studyOid, StudySubjectBean ssBean) throws Exception {
boolean accessPermission = false;
StudyBean study = getParentStudy(studyOid);
StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(study.getId(), "participantPortal");
participantPortalRegistrar = new ParticipantPortalRegistrar();
// ACTIVE ,
String pManageStatus = participantPortalRegistrar.getRegistrationStatus(studyOid).toString();
// PENDING ,
// INACTIVE
// enabled , disabled
String participateStatus = pStatus.getValue().toString();
// available , pending , frozen , locked
String studyStatus = study.getStatus().getName().toString();
logger.info("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus + " studySubjectStatus: " + ssBean.getStatus().getName());
if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && pManageStatus.equalsIgnoreCase("ACTIVE") && ssBean.getStatus() == Status.AVAILABLE) {
accessPermission = true;
}
return accessPermission;
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class OpenRosaServices method mayProceedPreview.
private boolean mayProceedPreview(String studyOid) throws Exception {
boolean accessPermission = false;
StudyBean study = getParentStudy(studyOid);
StudyParameterValueDAO spvdao = new StudyParameterValueDAO(dataSource);
StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(study.getId(), "participantPortal");
participantPortalRegistrar = new ParticipantPortalRegistrar();
// ACTIVE ,
String pManageStatus = participantPortalRegistrar.getRegistrationStatus(study.getOid()).toString();
// PENDING ,
// INACTIVE
// enabled , disabled
String participateStatus = pStatus.getValue().toString();
// available , pending , frozen , locked
String studyStatus = study.getStatus().getName().toString();
logger.info("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus);
if (participateStatus.equalsIgnoreCase("enabled") && (studyStatus.equalsIgnoreCase("available") || studyStatus.equalsIgnoreCase("pending") || studyStatus.equalsIgnoreCase("frozen") || studyStatus.equalsIgnoreCase("locked")) && (pManageStatus.equalsIgnoreCase("ACTIVE") || pManageStatus.equalsIgnoreCase("PENDING") || pManageStatus.equalsIgnoreCase("INACTIVE"))) {
accessPermission = true;
}
return accessPermission;
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class InitUpdateSubStudyServlet method processRequest.
@Override
public void processRequest() throws Exception {
// baseUrl();
String userName = request.getRemoteUser();
StudyDAO sdao = new StudyDAO(sm.getDataSource());
String idString = request.getParameter("id");
logger.info("study id:" + idString);
if (StringUtil.isBlank(idString)) {
addPageMessage(respage.getString("please_choose_a_study_to_edit"));
forwardPage(Page.STUDY_LIST_SERVLET);
} else {
int studyId = Integer.valueOf(idString.trim()).intValue();
StudyBean study = (StudyBean) sdao.findByPK(studyId);
checkRoleByUserAndStudy(ub, study.getParentStudyId(), study.getId());
String parentStudyName = "";
StudyBean parent = new StudyBean();
if (study.getParentStudyId() > 0) {
parent = (StudyBean) sdao.findByPK(study.getParentStudyId());
parentStudyName = parent.getName();
// at this time, this feature is only available for site
createEventDefinitions(parent);
}
if (currentStudy.getId() != study.getId()) {
ArrayList parentConfigs = currentStudy.getStudyParameters();
// logger.info("parentConfigs size:" + parentConfigs.size());
ArrayList configs = new ArrayList();
StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
for (int i = 0; i < parentConfigs.size(); i++) {
StudyParamsConfig scg = (StudyParamsConfig) parentConfigs.get(i);
if (scg != null) {
// find the one that sub study can change
if (scg.getValue().getId() > 0 && scg.getParameter().isOverridable()) {
// logger.info("parameter:" +
// scg.getParameter().getHandle());
// logger.info("value:" +
// scg.getValue().getValue());
StudyParameterValueBean spvb = spvdao.findByHandleAndStudy(study.getId(), scg.getParameter().getHandle());
if (spvb.getValue().equals("enabled"))
baseUrl();
if (spvb.getId() > 0) {
// the sub study itself has the parameter
scg.setValue(spvb);
}
configs.add(scg);
}
}
}
study.setStudyParameters(configs);
}
request.setAttribute("parentStudy", parent);
session.setAttribute("parentName", parentStudyName);
session.setAttribute("newStudy", study);
request.setAttribute("facRecruitStatusMap", CreateStudyServlet.facRecruitStatusMap);
request.setAttribute("statuses", Status.toStudyUpdateMembersList());
FormProcessor fp = new FormProcessor(request);
logger.info("start date:" + study.getDatePlannedEnd());
if (study.getDatePlannedEnd() != null) {
fp.addPresetValue(UpdateSubStudyServlet.INPUT_END_DATE, local_df.format(study.getDatePlannedEnd()));
}
if (study.getDatePlannedStart() != null) {
fp.addPresetValue(UpdateSubStudyServlet.INPUT_START_DATE, local_df.format(study.getDatePlannedStart()));
}
if (study.getProtocolDateVerification() != null) {
fp.addPresetValue(UpdateSubStudyServlet.INPUT_VER_DATE, local_df.format(study.getProtocolDateVerification()));
}
setPresetValues(fp.getPresetValues());
forwardPage(Page.UPDATE_SUB_STUDY);
}
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class CreateSubStudyServlet method submitStudy.
/**
* Inserts the new study into database
*
*/
private void submitStudy() throws IOException {
FormProcessor fp = new FormProcessor(request);
StudyDAO sdao = new StudyDAO(sm.getDataSource());
StudyBean study = (StudyBean) session.getAttribute("newStudy");
ArrayList parameters = study.getStudyParameters();
logger.info("study bean to be created:\n");
logger.info(study.getName() + "\n" + study.getIdentifier() + "\n" + study.getParentStudyId() + "\n" + study.getSummary() + "\n" + study.getPrincipalInvestigator() + "\n" + study.getDatePlannedStart() + "\n" + study.getDatePlannedEnd() + "\n" + study.getFacilityName() + "\n" + study.getFacilityCity() + "\n" + study.getFacilityState() + "\n" + study.getFacilityZip() + "\n" + study.getFacilityCountry() + "\n" + study.getFacilityRecruitmentStatus() + "\n" + study.getFacilityContactName() + "\n" + study.getFacilityContactEmail() + "\n" + study.getFacilityContactPhone() + "\n" + study.getFacilityContactDegree());
study.setOwner(ub);
study.setCreatedDate(new Date());
StudyBean parent = (StudyBean) sdao.findByPK(study.getParentStudyId());
study.setType(parent.getType());
// YW 10-10-2007, enable setting site status
study.setStatus(study.getStatus());
// YW >>
study.setGenetic(parent.isGenetic());
study = (StudyBean) sdao.create(study);
StudyParameterValueDAO spvdao = new StudyParameterValueDAO(sm.getDataSource());
for (int i = 0; i < parameters.size(); i++) {
StudyParamsConfig config = (StudyParamsConfig) parameters.get(i);
StudyParameterValueBean spv = config.getValue();
spv.setStudyId(study.getId());
spv = (StudyParameterValueBean) spvdao.create(config.getValue());
}
// YW << here only "collectDob" and "genderRequired" have been corrected
// for sites.
StudyParameterValueBean spv = new StudyParameterValueBean();
StudyParameterValueBean parentSPV = spvdao.findByHandleAndStudy(parent.getId(), "collectDob");
spv.setStudyId(study.getId());
spv.setParameter("collectDob");
spv.setValue(parentSPV.getValue());
spvdao.create(spv);
parentSPV = spvdao.findByHandleAndStudy(parent.getId(), "genderRequired");
spv.setParameter("genderRequired");
spv.setValue(parentSPV.getValue());
spvdao.create(spv);
// YW >>
this.submitSiteEventDefinitions(study);
// switch user to the newly created site
// session.setAttribute("study", session.getAttribute("newStudy"));
// currentStudy = (StudyBean) session.getAttribute("study");
session.removeAttribute("newStudy");
addPageMessage(respage.getString("the_new_site_created_succesfully_current"));
ArrayList pageMessages = (ArrayList) request.getAttribute(PAGE_MESSAGE);
session.setAttribute("pageMessages", pageMessages);
response.sendRedirect(request.getContextPath() + Page.MANAGE_STUDY_MODULE.getFileName());
}
use of org.akaza.openclinica.bean.service.StudyParameterValueBean in project OpenClinica by OpenClinica.
the class AnonymousFormControllerV2 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 ,
String pManageStatus = participantPortalRegistrar.getRegistrationStatus(study.getOid()).toString();
// PENDING ,
// INACTIVE
// 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();
System.out.println("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus + " siteStatus: " + siteStatus);
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;
}
Aggregations