Search in sources :

Example 1 with ParticipantPortalRegistrar

use of org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar in project OpenClinica by OpenClinica.

the class EnketoUrlService method getRedirectUrl.

private String getRedirectUrl(String studySubjectOid, String studyOid) {
    String portalURL = CoreResources.getField("portalURL");
    String url = "";
    if (portalURL != null && !portalURL.equals("")) {
        ParticipantPortalRegistrar registrar = new ParticipantPortalRegistrar();
        Authorization pManageAuthorization = registrar.getAuthorization(studyOid);
        try {
            URL pManageUrl = new URL(portalURL);
            if (pManageAuthorization != null && pManageAuthorization.getStudy() != null && pManageAuthorization.getStudy().getHost() != null && !pManageAuthorization.getStudy().getHost().equals("")) {
                url = pManageUrl.getProtocol() + "://" + pManageAuthorization.getStudy().getHost() + "." + pManageUrl.getHost() + ((pManageUrl.getPort() > 0) ? ":" + String.valueOf(pManageUrl.getPort()) : "");
            }
        } catch (MalformedURLException e) {
            logger.error("Error building redirect URL: " + e.getMessage());
            logger.error(ExceptionUtils.getStackTrace(e));
            return "";
        }
    }
    if (!url.equals(""))
        url = url + "/#/event/" + studySubjectOid + "/dashboard";
    return url;
}
Also used : Authorization(org.akaza.openclinica.service.pmanage.Authorization) MalformedURLException(java.net.MalformedURLException) ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) URL(java.net.URL)

Example 2 with ParticipantPortalRegistrar

use of org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar in project OpenClinica by OpenClinica.

the class ListStudySubjectTableFactory method viewParticipateBuilder.

private String viewParticipateBuilder(StudySubjectBean studySubject) throws Exception {
    participantPortalRegistrar = new ParticipantPortalRegistrar();
    StudyBean study = (StudyBean) studyDAO.findByPK(studySubject.getStudyId());
    StudyBean pStudy = getParentStudy(study.getOid());
    String url = participantPortalRegistrar.getStudyHost(pStudy.getOid());
    HtmlBuilder actionLink = new HtmlBuilder();
    // actionLink.a().href("url?id=" + studySubject.getId());
    actionLink.a().href(url + "?ssid=" + URLEncoder.encode(studySubject.getLabel(), "UTF-8"));
    actionLink.append("onMouseDown=\"javascript:setImage('bt_Participate1','images/bt_Ocui_d.gif');\"");
    actionLink.append("onMouseUp=\"javascript:setImage('bt_Participate1','images/bt_Ocui.gif');\"").close();
    actionLink.img().name("bt_Participate1").src("images/bt_Ocui.gif").border("0").alt(resword.getString("connect_participant")).title(resword.getString("connect_participant")).append("hspace=\"2\"").end().aEnd();
    actionLink.append("   ");
    return actionLink.toString();
}
Also used : ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) HtmlBuilder(org.jmesa.view.html.HtmlBuilder)

Example 3 with ParticipantPortalRegistrar

use of org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar in project OpenClinica by OpenClinica.

the class ListStudySubjectTableFactory method pManageStatus.

private String pManageStatus(StudySubjectBean studySubjectBean) throws Exception {
    participantPortalRegistrar = new ParticipantPortalRegistrar();
    StudyBean study = (StudyBean) studyDAO.findByPK(studySubjectBean.getStudyId());
    StudyBean pStudy = getParentStudy(study.getOid());
    // ACTIVE
    String pManageStatus = participantPortalRegistrar.getCachedRegistrationStatus(pStudy.getOid(), session).toString();
    return pManageStatus;
}
Also used : ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean)

Example 4 with ParticipantPortalRegistrar

use of org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar in project OpenClinica by OpenClinica.

the class EditFormController 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;
}
Also used : ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO)

Example 5 with ParticipantPortalRegistrar

use of org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar in project OpenClinica by OpenClinica.

the class EditFormController method getRedirectUrl.

private String getRedirectUrl(String studySubjectOid, String studyOid) {
    String portalURL = CoreResources.getField("portalURL");
    String url = "";
    if (portalURL != null && !portalURL.equals("")) {
        ParticipantPortalRegistrar registrar = new ParticipantPortalRegistrar();
        Authorization pManageAuthorization = registrar.getAuthorization(studyOid);
        try {
            URL pManageUrl = new URL(portalURL);
            if (pManageAuthorization != null && pManageAuthorization.getStudy() != null && pManageAuthorization.getStudy().getHost() != null && !pManageAuthorization.getStudy().getHost().equals("")) {
                url = pManageUrl.getProtocol() + "://" + pManageAuthorization.getStudy().getHost() + "." + pManageUrl.getHost() + ((pManageUrl.getPort() > 0) ? ":" + String.valueOf(pManageUrl.getPort()) : "");
            }
        } catch (MalformedURLException e) {
            logger.error("Error building redirect URL: " + e.getMessage());
            logger.error(ExceptionUtils.getStackTrace(e));
            return "";
        }
    }
    if (!url.equals(""))
        url = url + "/#/event/" + studySubjectOid + "/dashboard";
    return url;
}
Also used : Authorization(org.akaza.openclinica.service.pmanage.Authorization) MalformedURLException(java.net.MalformedURLException) ParticipantPortalRegistrar(org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar) URL(java.net.URL)

Aggregations

ParticipantPortalRegistrar (org.akaza.openclinica.service.pmanage.ParticipantPortalRegistrar)22 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)13 StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)10 StudyParameterValueDAO (org.akaza.openclinica.dao.service.StudyParameterValueDAO)10 URL (java.net.URL)5 Authorization (org.akaza.openclinica.service.pmanage.Authorization)5 MalformedURLException (java.net.MalformedURLException)4 StudyParameterValue (org.akaza.openclinica.domain.datamap.StudyParameterValue)4 ArrayList (java.util.ArrayList)3 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)3 Study (org.akaza.openclinica.domain.datamap.Study)3 HashMap (java.util.HashMap)2 MessagingException (javax.mail.MessagingException)2 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)2 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)2 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)2 OpenClinicaSystemException (org.akaza.openclinica.exception.OpenClinicaSystemException)2 RandomizationRegistrar (org.akaza.openclinica.service.pmanage.RandomizationRegistrar)2 SeRandomizationDTO (org.akaza.openclinica.service.pmanage.SeRandomizationDTO)2 MailException (org.springframework.mail.MailException)2