use of org.akaza.openclinica.bean.submit.SectionBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method setSectionBean.
private FormDetailsBean setSectionBean(FormDetailsBean formDetail, Integer crfVId) {
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(crfVId));
ArrayList<SectionDetails> sectionBeans = new ArrayList<SectionDetails>();
SectionDAO secdao = new SectionDAO(this.ds);
ArrayList sections = secdao.findAllByCRFVersionId(crfVId);
Iterator iter = sections.iterator();
while (iter.hasNext()) {
SectionDetails sectionDetails = new SectionDetails();
SectionBean sectionBean = (SectionBean) iter.next();
sectionDetails.setSectionId(sectionBean.getId());
sectionDetails.setSectionLabel(sectionBean.getLabel());
sectionDetails.setSectionTitle(sectionBean.getTitle());
sectionDetails.setSectionSubtitle(sectionBean.getSubtitle());
sectionDetails.setSectionInstructions(sectionBean.getInstructions());
sectionDetails.setSectionPageNumber(sectionBean.getPageNumberLabel());
sectionBeans.add(sectionDetails);
}
formDetail.setSectionDetails(sectionBeans);
return formDetail;
}
use of org.akaza.openclinica.bean.submit.SectionBean in project OpenClinica by OpenClinica.
the class SectionDAO method findNext.
public SectionBean findNext(EventCRFBean ecb, SectionBean current) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(ecb.getCRFVersionId()));
variables.put(new Integer(2), new Integer(current.getOrdinal()));
String sql = digester.getQuery("findNext");
ArrayList rows = this.select(sql, variables);
SectionBean answer = new SectionBean();
if (rows.size() > 0) {
HashMap row = (HashMap) rows.get(0);
answer = (SectionBean) getEntityFromHashMap(row);
}
return answer;
}
use of org.akaza.openclinica.bean.submit.SectionBean in project OpenClinica by OpenClinica.
the class SectionDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
SectionBean eb = new SectionBean();
this.setEntityAuditInformation(eb, hm);
eb.setId(((Integer) hm.get("section_id")).intValue());
eb.setCRFVersionId(((Integer) hm.get("crf_version_id")).intValue());
eb.setLabel((String) hm.get("label"));
eb.setTitle((String) hm.get("title"));
eb.setInstructions((String) hm.get("instructions"));
eb.setSubtitle((String) hm.get("subtitle"));
eb.setPageNumberLabel((String) hm.get("page_number_label"));
eb.setOrdinal(((Integer) hm.get("ordinal")).intValue());
eb.setParentId(((Integer) hm.get("parent_id")).intValue());
eb.setBorders(((Integer) hm.get("borders")).intValue());
return eb;
}
use of org.akaza.openclinica.bean.submit.SectionBean in project OpenClinica by OpenClinica.
the class SectionDAO method findByLayoutId.
public Collection findByLayoutId(int ID) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(ID));
String sql = digester.getQuery("findByLayoutId");
ArrayList alist = this.selectByCache(sql, variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
SectionBean eb = (SectionBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.submit.SectionBean in project OpenClinica by OpenClinica.
the class RuleRunner method prepareEmailContents.
HashMap<String, String> prepareEmailContents(RuleSetBean ruleSet, RuleSetRuleBean ruleSetRule, StudyBean currentStudy, RuleActionBean ruleAction) {
// get the Study Event
StudyEventBean studyEvent = (StudyEventBean) getStudyEventDao().findByPK(Integer.valueOf(getExpressionService().getStudyEventDefenitionOrdninalCurated(ruleSet.getTarget().getValue())));
// get the Study Subject
StudySubjectBean studySubject = (StudySubjectBean) getStudySubjectDao().findByPK(studyEvent.getStudySubjectId());
// get Study/Site Associated with Subject
StudyBean theStudy = (StudyBean) getStudyDao().findByPK(studySubject.getStudyId());
String theStudyName, theSiteName = "";
if (theStudy.getParentStudyId() > 0) {
StudyBean theParentStudy = (StudyBean) getStudyDao().findByPK(theStudy.getParentStudyId());
theStudyName = theParentStudy.getName() + " / " + theParentStudy.getIdentifier();
theSiteName = theStudy.getName() + " / " + theStudy.getIdentifier();
} else {
theStudyName = theStudy.getName() + " / " + theStudy.getIdentifier();
}
// get the eventCrf & subsequently the CRF Version
//EventCRFBean eventCrf = (EventCRFBean) getEventCrfDao().findAllByStudyEvent(studyEvent).get(0);
EventCRFBean eventCrf = (EventCRFBean) getEventCrfDao().findAllByStudyEventAndCrfOrCrfVersionOid(studyEvent, getExpressionService().getCrfOid(ruleSet.getTarget().getValue())).get(0);
CRFVersionBean crfVersion = (CRFVersionBean) getCrfVersionDao().findByPK(eventCrf.getCRFVersionId());
CRFBean crf = (CRFBean) getCrfDao().findByPK(crfVersion.getCrfId());
String studyEventDefinitionName = getExpressionService().getStudyEventDefinitionFromExpression(ruleSet.getTarget().getValue(), currentStudy).getName();
studyEventDefinitionName += " [" + studyEvent.getSampleOrdinal() + "]";
String itemGroupName = getExpressionService().getItemGroupNameAndOrdinal(ruleSet.getTarget().getValue());
ItemGroupBean itemGroupBean = getExpressionService().getItemGroupExpression(ruleSet.getTarget().getValue());
ItemBean itemBean = getExpressionService().getItemExpression(ruleSet.getTarget().getValue(), itemGroupBean);
String itemName = itemBean.getName();
SectionBean section = (SectionBean) getSectionDAO().findByPK(getItemFormMetadataDAO().findByItemIdAndCRFVersionId(itemBean.getId(), crfVersion.getId()).getSectionId());
StringBuffer sb = new StringBuffer();
ResourceBundle respage = ResourceBundleProvider.getPageMessagesBundle();
sb.append(respage.getString("email_header_1"));
sb.append(" " + contextPath + " ");
sb.append(respage.getString("email_header_2"));
sb.append(" '" + currentStudy.getName() + "' ");
sb.append(respage.getString("email_header_3"));
sb.append(" \n\n ");
sb.append(respage.getString("email_body_1") + " " + theStudyName + " \n ");
sb.append(respage.getString("email_body_1_a") + " " + theSiteName + " \n ");
sb.append(respage.getString("email_body_2") + " " + studySubject.getName() + " \n ");
sb.append(respage.getString("email_body_3") + " " + studyEventDefinitionName + " \n ");
sb.append(respage.getString("email_body_4") + " " + crf.getName() + " " + crfVersion.getName() + " \n ");
sb.append(respage.getString("email_body_5") + " " + section.getTitle() + " \n ");
sb.append(respage.getString("email_body_6") + " " + itemGroupName + " \n ");
sb.append(respage.getString("email_body_7") + " " + itemName + " \n ");
sb.append(respage.getString("email_body_8") + " " + ruleAction.getCuratedMessage() + " \n ");
sb.append(" \n\n ");
sb.append(respage.getString("email_body_9"));
sb.append(" " + contextPath + " ");
sb.append(respage.getString("email_body_10"));
sb.append(" \n");
requestURLMinusServletPath = requestURLMinusServletPath == null ? "" : requestURLMinusServletPath;
sb.append(requestURLMinusServletPath + "/ViewSectionDataEntry?ecId=" + eventCrf.getId() + "§ionId=" + section.getId() + "&tabId=" + section.getOrdinal());
// &eventId="+ studyEvent.getId());
sb.append("\n\n");
sb.append(respage.getString("email_footer"));
String subject = contextPath + " - [" + currentStudy.getName() + "] ";
String ruleSummary = ruleAction.getSummary() != null ? ruleAction.getSummary() : "";
String message = ruleSummary.length() < 20 ? ruleSummary : ruleSummary.substring(0, 20) + " ... ";
subject += message;
HashMap<String, String> emailContents = new HashMap<String, String>();
emailContents.put("body", sb.toString());
emailContents.put("subject", subject);
return emailContents;
}
Aggregations