Search in sources :

Example 11 with ItemGroupBean

use of org.akaza.openclinica.bean.submit.ItemGroupBean in project OpenClinica by OpenClinica.

the class ItemGroupDAO method findAllByOid.

public List<ItemGroupBean> findAllByOid(String oid) {
    // ItemGroupBean itemGroup = new ItemGroupBean();
    this.unsetTypeExpected();
    setTypesExpected();
    HashMap<Integer, String> variables = new HashMap<Integer, String>();
    variables.put(new Integer(1), oid);
    String sql = digester.getQuery("findGroupByOid");
    ArrayList rows = this.select(sql, variables);
    // return rows;
    List<ItemGroupBean> beanList = new ArrayList<ItemGroupBean>();
    ItemGroupBean bean;
    for (Object map : rows) {
        bean = (ItemGroupBean) this.getEntityFromHashMap((HashMap) map);
        beanList.add(bean);
    }
    return beanList;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean)

Example 12 with ItemGroupBean

use of org.akaza.openclinica.bean.submit.ItemGroupBean in project OpenClinica by OpenClinica.

the class ItemGroupDAO method findAll.

public Collection findAll() {
    this.setTypesExpected();
    List listofMaps = this.select(digester.getQuery("findAll"));
    List<ItemGroupBean> beanList = new ArrayList<ItemGroupBean>();
    ItemGroupBean bean;
    for (Object map : listofMaps) {
        bean = (ItemGroupBean) this.getEntityFromHashMap((HashMap) map);
        beanList.add(bean);
    }
    return beanList;
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean)

Example 13 with ItemGroupBean

use of org.akaza.openclinica.bean.submit.ItemGroupBean in project OpenClinica by OpenClinica.

the class ItemGroupDAO method findGroupByLayoutId.

public List<ItemGroupBean> findGroupByLayoutId(int formLayoutId) {
    this.unsetTypeExpected();
    setTypesExpected();
    HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
    variables.put(new Integer(1), new Integer(formLayoutId));
    List listofMaps = this.select(digester.getQuery("findGroupByLayoutId"), variables);
    List<ItemGroupBean> beanList = new ArrayList<ItemGroupBean>();
    ItemGroupBean bean;
    for (Object map : listofMaps) {
        bean = (ItemGroupBean) this.getEntityFromHashMap((HashMap) map);
        beanList.add(bean);
    }
    return beanList;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean)

Example 14 with ItemGroupBean

use of org.akaza.openclinica.bean.submit.ItemGroupBean in project OpenClinica by OpenClinica.

the class Key method populateForCrfBasedRulesView.

/**
     * Organize objects in a certain way so that we can show to Users on UI.
     * step1 : Get StudyEvent , eventCrf , crfVersion from studyEventId.
     * 
     * @param crfViewSpecificOrderedObjects
     * @param ruleSet
     * @param rule
     * @return
     */
private HashMap<RuleBulkExecuteContainer, HashMap<RuleBulkExecuteContainerTwo, Set<String>>> populateForCrfBasedRulesView(HashMap<RuleBulkExecuteContainer, HashMap<RuleBulkExecuteContainerTwo, Set<String>>> crfViewSpecificOrderedObjects, RuleSetBean ruleSet, RuleBean rule, String result, StudyBean currentStudy, List<RuleActionBean> actions) {
    // step1
    StudyEventBean studyEvent = (StudyEventBean) getStudyEventDao().findByPK(Integer.valueOf(getExpressionService().getStudyEventDefenitionOrdninalCurated(ruleSet.getTarget().getValue())));
    EventCRFBean eventCrf = (EventCRFBean) getEventCrfDao().findAllByStudyEventAndCrfOrCrfVersionOid(studyEvent, getExpressionService().getCrfOid(ruleSet.getTarget().getValue())).get(0);
    CRFVersionBean crfVersion = (CRFVersionBean) getCrfVersionDao().findByPK(eventCrf.getCRFVersionId());
    RuleBulkExecuteContainer key = new RuleBulkExecuteContainer(crfVersion.getName(), rule, result, actions);
    String key2String = getExpressionService().getCustomExpressionUsedToCreateView(ruleSet.getTarget().getValue(), studyEvent.getSampleOrdinal());
    String studyEventDefinitionName = getExpressionService().getStudyEventDefinitionFromExpression(ruleSet.getTarget().getValue(), currentStudy).getName();
    studyEventDefinitionName += " [" + studyEvent.getSampleOrdinal() + "]";
    // String itemGroupName = getExpressionService().getItemGroupNameAndOrdinal(ruleSet.getTarget().getValue());
    // String itemName = getExpressionService().getItemGroupExpression(ruleSet.getTarget().getValue()).getName();
    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();
    RuleBulkExecuteContainerTwo key2 = new RuleBulkExecuteContainerTwo(key2String, studyEvent, studyEventDefinitionName, itemGroupName, itemName);
    StudySubjectBean studySubject = (StudySubjectBean) getStudySubjectDao().findByPK(studyEvent.getStudySubjectId());
    if (crfViewSpecificOrderedObjects.containsKey(key)) {
        HashMap<RuleBulkExecuteContainerTwo, Set<String>> k = crfViewSpecificOrderedObjects.get(key);
        if (k.containsKey(key2)) {
            k.get(key2).add(String.valueOf(studySubject.getLabel()));
        } else {
            HashSet<String> values = new HashSet<String>();
            values.add(String.valueOf(studySubject.getLabel()));
            k.put(key2, values);
        }
    } else {
        HashMap<RuleBulkExecuteContainerTwo, Set<String>> k = new HashMap<RuleBulkExecuteContainerTwo, Set<String>>();
        HashSet<String> values = new HashSet<String>();
        values.add(String.valueOf(studySubject.getLabel()));
        k.put(key2, values);
        crfViewSpecificOrderedObjects.put(key, k);
    }
    return crfViewSpecificOrderedObjects;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) RuleBulkExecuteContainerTwo(org.akaza.openclinica.domain.rule.RuleBulkExecuteContainerTwo) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) RuleBulkExecuteContainer(org.akaza.openclinica.domain.rule.RuleBulkExecuteContainer) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean) HashSet(java.util.HashSet)

Example 15 with ItemGroupBean

use of org.akaza.openclinica.bean.submit.ItemGroupBean 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

ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)71 ArrayList (java.util.ArrayList)45 HashMap (java.util.HashMap)34 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)26 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)25 ItemGroupDAO (org.akaza.openclinica.dao.submit.ItemGroupDAO)23 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)20 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)18 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)17 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)16 ItemGroupMetadataBean (org.akaza.openclinica.bean.submit.ItemGroupMetadataBean)16 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)15 DisplaySectionBean (org.akaza.openclinica.bean.submit.DisplaySectionBean)14 ItemDAO (org.akaza.openclinica.dao.submit.ItemDAO)14 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)13 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)12 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)12 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)11 SectionDAO (org.akaza.openclinica.dao.submit.SectionDAO)11 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)10