use of org.akaza.openclinica.bean.submit.ItemFormMetadataBean in project OpenClinica by OpenClinica.
the class ItemFormMetadataDAO method getEntityFromHashMap.
/*
* (non-Javadoc)
*
* @see org.akaza.openclinica.dao.core.DAOInterface#getEntityFromHashMap(java.util.HashMap)
*/
public Object getEntityFromHashMap(HashMap hm) {
ItemFormMetadataBean answer = new ItemFormMetadataBean();
answer.setId(getIntFromRow(hm, "item_form_metadata_id"));
answer.setItemId(getIntFromRow(hm, "item_id"));
answer.setCrfVersionId(getIntFromRow(hm, "crf_version_id"));
answer.setHeader(getStringFromRow(hm, "header"));
answer.setSubHeader(getStringFromRow(hm, "subheader"));
answer.setParentId(getIntFromRow(hm, "parent_id"));
answer.setParentLabel(getStringFromRow(hm, "parent_label"));
answer.setColumnNumber(getIntFromRow(hm, "column_number"));
answer.setPageNumberLabel(getStringFromRow(hm, "page_number_label"));
answer.setQuestionNumberLabel(getStringFromRow(hm, "question_number_label"));
answer.setLeftItemText(getStringFromRow(hm, "left_item_text"));
answer.setRightItemText(getStringFromRow(hm, "right_item_text"));
answer.setSectionId(getIntFromRow(hm, "section_id"));
answer.setDescisionConditionId(getIntFromRow(hm, "decision_condition_id"));
answer.setResponseSetId(getIntFromRow(hm, "response_set_id"));
answer.setRegexp(getStringFromRow(hm, "regexp"));
answer.setRegexpErrorMsg(getStringFromRow(hm, "regexp_error_msg"));
answer.setOrdinal(getIntFromRow(hm, "ordinal"));
answer.setRequired(getBooleanFromRow(hm, "required"));
// YW 08-02-2007, default_value column has been added
answer.setDefaultValue(getStringFromRow(hm, "default_value"));
answer.setResponseLayout(getStringFromRow(hm, "response_layout"));
answer.setWidthDecimal(getStringFromRow(hm, "width_decimal"));
// answer.setShowItem(((Boolean) hm.get("show_item")).booleanValue());
answer.setShowItem(getBooleanFromRow(hm, "show_item"));
// System.out.println("found show item: " + getBooleanFromRow(hm, "show_item"));
// now get the response set
ResponseSetBean rsb = new ResponseSetBean();
rsb.setId(getIntFromRow(hm, "response_set_id"));
rsb.setLabel(getStringFromRow(hm, "label"));
rsb.setResponseTypeId(getIntFromRow(hm, "response_type_id"));
String optionsText = getStringFromRow(hm, "options_text");
String optionsValues = getStringFromRow(hm, "options_values");
rsb.setOptions(optionsText, optionsValues);
answer.setResponseSet(rsb);
return answer;
}
use of org.akaza.openclinica.bean.submit.ItemFormMetadataBean in project OpenClinica by OpenClinica.
the class ItemFormMetadataDAO method findAllItemsRequiredAndShownByCrfVersionId.
public ArrayList<ItemFormMetadataBean> findAllItemsRequiredAndShownByCrfVersionId(int crfVersionId) {
ArrayList<ItemFormMetadataBean> answer = new ArrayList<ItemFormMetadataBean>();
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
variables.put(new Integer(1), new Integer(crfVersionId));
String sql = digester.getQuery("findAllItemsRequiredAndShownByCrfVersionId");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
ItemFormMetadataBean ifmb = (ItemFormMetadataBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(ifmb);
}
return answer;
}
use of org.akaza.openclinica.bean.submit.ItemFormMetadataBean in project OpenClinica by OpenClinica.
the class ItemFormMetadataDAO method findAll.
/*
* (non-Javadoc)
*
* @see org.akaza.openclinica.dao.core.DAOInterface#findAll()
*/
public Collection<ItemFormMetadataBean> findAll() throws OpenClinicaException {
ArrayList<ItemFormMetadataBean> answer = new ArrayList<ItemFormMetadataBean>();
this.setTypesExpected();
String sql = digester.getQuery("findAll");
ArrayList alist = this.select(sql);
Iterator it = alist.iterator();
while (it.hasNext()) {
ItemFormMetadataBean ifmb = (ItemFormMetadataBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(ifmb);
}
return answer;
}
use of org.akaza.openclinica.bean.submit.ItemFormMetadataBean in project OpenClinica by OpenClinica.
the class ItemFormMetadataDAO method findAllByCRFVersionId.
public ArrayList<ItemFormMetadataBean> findAllByCRFVersionId(int crfVersionId) throws OpenClinicaException {
ArrayList<ItemFormMetadataBean> answer = new ArrayList<ItemFormMetadataBean>();
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
variables.put(new Integer(1), new Integer(crfVersionId));
String sql = digester.getQuery("findAllByCRFVersionId");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
ItemFormMetadataBean ifmb = (ItemFormMetadataBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(ifmb);
}
return answer;
}
use of org.akaza.openclinica.bean.submit.ItemFormMetadataBean in project OpenClinica by OpenClinica.
the class ExpressionService method deContextualizeExpression.
@SuppressWarnings("unchecked")
private String deContextualizeExpression(int j, String ruleExpression, String ruleSetTargetExpression) {
String ruleSetExpression = ruleSetTargetExpression;
String[] splitRuleSetExpression = ruleSetExpression.split(ESCAPED_SEPERATOR);
String buildExpression = "";
ItemBean item = null;
String groupOidWithoutOrdinal = "";
String groupOidFromItem = "";
String repeatOrdinal = "";
if (j == 3) {
item = getItemFromExpression(ruleExpression);
int indexOfOpenBrack = splitRuleSetExpression[2].indexOf("[");
if (indexOfOpenBrack != -1) {
groupOidWithoutOrdinal = splitRuleSetExpression[2].substring(0, indexOfOpenBrack);
} else {
groupOidWithoutOrdinal = splitRuleSetExpression[2];
}
ArrayList<ItemGroupBean> igBean = (ArrayList<ItemGroupBean>) getItemGroupDao().findGroupsByItemID(item.getId());
groupOidFromItem = igBean.get(0).getOid();
}
for (int i = 0; i < j; i++) {
if (j == 3 && i == 2 && !groupOidFromItem.equalsIgnoreCase(groupOidWithoutOrdinal)) {
ArrayList<ItemFormMetadataBean> itemFormMetadataBeans = getItemFormMetadataDao().findAllByItemId(item.getId());
List<ItemGroupMetadataBean> itemGroupMetadataBeans = getItemGroupMetadataDao().findByCrfVersion(itemFormMetadataBeans.get(0).getCrfVersionId());
if (!itemGroupMetadataBeans.get(0).isRepeatingGroup()) {
repeatOrdinal = "[1]";
}
buildExpression = buildExpression + groupOidFromItem + repeatOrdinal + SEPERATOR;
} else {
buildExpression = buildExpression + splitRuleSetExpression[i] + SEPERATOR;
}
}
return buildExpression + ruleExpression;
}
Aggregations