Search in sources :

Example 1 with ParticipantDTO

use of org.akaza.openclinica.bean.login.ParticipantDTO in project OpenClinica by OpenClinica.

the class ParticipantPortalRegistrar method sendEmailThruMandrillViaOcui.

public String sendEmailThruMandrillViaOcui(ParticipantDTO participantDTO, String hostname) {
    String host = hostname.substring(0, hostname.indexOf("/#/login"));
    String pManageUrl = host + "/app/rest/oc/email";
    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
    requestFactory.setReadTimeout(PARTICIPATE_READ_TIMEOUT);
    RestTemplate rest = new RestTemplate(requestFactory);
    try {
        ParticipantDTO response = rest.postForObject(pManageUrl, participantDTO, ParticipantDTO.class);
    } catch (Exception e) {
        logger.error(e.getMessage());
        logger.error(ExceptionUtils.getStackTrace(e));
    }
    return "";
}
Also used : RestTemplate(org.springframework.web.client.RestTemplate) ParticipantDTO(org.akaza.openclinica.bean.login.ParticipantDTO) HttpComponentsClientHttpRequestFactory(org.springframework.http.client.HttpComponentsClientHttpRequestFactory) MalformedURLException(java.net.MalformedURLException)

Example 2 with ParticipantDTO

use of org.akaza.openclinica.bean.login.ParticipantDTO in project OpenClinica by OpenClinica.

the class NotificationActionProcessor method buildNewPDTO.

public ParticipantDTO buildNewPDTO() {
    pDTO = new ParticipantDTO();
    String msg = null;
    msg = message.replaceAll("\\$\\{participant.accessCode}", "");
    msg = msg.replaceAll("\\$\\{participant.firstname}", "");
    msg = msg.replaceAll("\\$\\{participant.loginurl}", "");
    msg = msg.replaceAll("\\\\n", "\n");
    pDTO.setMessage(msg);
    String eSubject = null;
    eSubject = emailSubject.replaceAll("\\$\\{participant.accessCode}", "");
    eSubject = eSubject.replaceAll("\\$\\{participant.firstname}", "");
    eSubject = eSubject.replaceAll("\\$\\{participant.loginurl}", "");
    eSubject = eSubject.replaceAll("\\\\n", "\n");
    pDTO.setEmailSubject(eSubject);
    return pDTO;
}
Also used : ParticipantDTO(org.akaza.openclinica.bean.login.ParticipantDTO)

Example 3 with ParticipantDTO

use of org.akaza.openclinica.bean.login.ParticipantDTO in project OpenClinica by OpenClinica.

the class NotificationActionProcessor method runNotificationAction.

public void runNotificationAction(RuleActionBean ruleActionBean, RuleSetBean ruleSet, int studySubjectBeanId, int eventOrdinal) {
    String emailList = ((NotificationActionBean) ruleActionBean).getTo();
    String message = ((NotificationActionBean) ruleActionBean).getMessage();
    String emailSubject = ((NotificationActionBean) ruleActionBean).getSubject();
    int sed_Id = ruleSet.getStudyEventDefinitionId();
    int studyId = ruleSet.getStudyId();
    String eventName = getStudyEventDefnBean(sed_Id).getName();
    if (eventOrdinal != 1)
        eventName = eventName + "(" + eventOrdinal + ")";
    String studyName = getStudyBean(studyId).getName();
    if (message == null)
        message = "";
    if (emailSubject == null)
        emailSubject = "";
    message = message.replaceAll("\\$\\{event.name}", eventName);
    message = message.replaceAll("\\$\\{study.name}", studyName);
    emailSubject = emailSubject.replaceAll("\\$\\{event.name}", eventName);
    emailSubject = emailSubject.replaceAll("\\$\\{study.name}", studyName);
    ParticipantDTO pDTO = null;
    StudyBean studyBean = getStudyBean(studyId);
    String[] listOfEmails = emailList.split(",");
    StudySubjectBean ssBean = (StudySubjectBean) ssdao.findByPK(studySubjectBeanId);
    StudyBean parentStudyBean = getParentStudy(ds, studyBean);
    String pUserName = parentStudyBean.getOid() + "." + ssBean.getOid();
    UserAccountBean uBean = (UserAccountBean) udao.findByUserName(pUserName);
    StudyParameterValueBean pStatus = spvdao.findByHandleAndStudy(studyBean.getId(), "participantPortal");
    // enabled , disabled
    String participateStatus = pStatus.getValue().toString();
    Thread thread = new Thread(new NotificationActionProcessor(listOfEmails, uBean, studyBean, message, emailSubject, participantPortalRegistrar, mailSender, participateStatus));
    thread.start();
}
Also used : StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) ParticipantDTO(org.akaza.openclinica.bean.login.ParticipantDTO)

Example 4 with ParticipantDTO

use of org.akaza.openclinica.bean.login.ParticipantDTO in project OpenClinica by OpenClinica.

the class NotificationActionProcessor method getParticipantInfo.

public ParticipantDTO getParticipantInfo(UserAccountBean uBean) {
    ParticipantDTO pDTO = null;
    if (uBean != null && uBean.isActive()) {
        if (uBean.getEmail() == null)
            return null;
        pDTO = new ParticipantDTO();
        pDTO.setAccessCode(uBean.getAccessCode());
        pDTO.setfName(uBean.getFirstName());
        pDTO.setEmailAccount(uBean.getEmail());
        pDTO.setPhone(uBean.getPhone());
    } else {
        return null;
    }
    return pDTO;
}
Also used : ParticipantDTO(org.akaza.openclinica.bean.login.ParticipantDTO)

Aggregations

ParticipantDTO (org.akaza.openclinica.bean.login.ParticipantDTO)4 MalformedURLException (java.net.MalformedURLException)1 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)1 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)1 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)1 StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)1 HttpComponentsClientHttpRequestFactory (org.springframework.http.client.HttpComponentsClientHttpRequestFactory)1 RestTemplate (org.springframework.web.client.RestTemplate)1