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