Search in sources :

Example 61 with ItemFormMetadataBean

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

Example 62 with ItemFormMetadataBean

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

Example 63 with ItemFormMetadataBean

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

Example 64 with ItemFormMetadataBean

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

Example 65 with ItemFormMetadataBean

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

Aggregations

ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)93 ArrayList (java.util.ArrayList)58 HashMap (java.util.HashMap)36 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)36 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)28 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)26 ItemFormMetadataDAO (org.akaza.openclinica.dao.submit.ItemFormMetadataDAO)25 DynamicsItemFormMetadataBean (org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean)25 Iterator (java.util.Iterator)21 ItemDAO (org.akaza.openclinica.dao.submit.ItemDAO)18 ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)16 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)16 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)14 ItemGroupMetadataBean (org.akaza.openclinica.bean.submit.ItemGroupMetadataBean)13 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)12 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)12 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)9 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)9 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)8 ResponseSetBean (org.akaza.openclinica.bean.submit.ResponseSetBean)8