Search in sources :

Example 1 with SectionBean

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;
}
Also used : SectionDetails(org.akaza.openclinica.bean.odmbeans.SectionDetails) SectionBean(org.akaza.openclinica.bean.submit.SectionBean) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) SectionDAO(org.akaza.openclinica.dao.submit.SectionDAO)

Example 2 with SectionBean

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;
}
Also used : SectionBean(org.akaza.openclinica.bean.submit.SectionBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 3 with SectionBean

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;
}
Also used : SectionBean(org.akaza.openclinica.bean.submit.SectionBean)

Example 4 with SectionBean

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;
}
Also used : SectionBean(org.akaza.openclinica.bean.submit.SectionBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 5 with SectionBean

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() + "&sectionId=" + 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;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) SectionBean(org.akaza.openclinica.bean.submit.SectionBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) ResourceBundle(java.util.ResourceBundle) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean)

Aggregations

SectionBean (org.akaza.openclinica.bean.submit.SectionBean)63 ArrayList (java.util.ArrayList)49 SectionDAO (org.akaza.openclinica.dao.submit.SectionDAO)35 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)33 HashMap (java.util.HashMap)28 DisplaySectionBean (org.akaza.openclinica.bean.submit.DisplaySectionBean)28 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)22 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)20 ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)20 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)19 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)17 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)17 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)16 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)15 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)15 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)15 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)15 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)14 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)14 ItemDAO (org.akaza.openclinica.dao.submit.ItemDAO)14