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