Search in sources :

Example 6 with ItemFormMetadataBean

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

the class ItemFormMetadataDAO method update.

/*
     * (non-Javadoc)
     *
     * @see org.akaza.openclinica.dao.core.DAOInterface#update(org.akaza.openclinica.bean.core.EntityBean)
     */
public EntityBean update(EntityBean eb) throws OpenClinicaException {
    ItemFormMetadataBean ifmb = (ItemFormMetadataBean) eb;
    HashMap<Integer, Comparable> variables = new HashMap<Integer, Comparable>();
    int ind = 0;
    variables.put(new Integer(ind), new Integer(ifmb.getItemId()));
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getCrfVersionId()));
    ind++;
    variables.put(new Integer(ind), ifmb.getHeader());
    ind++;
    variables.put(new Integer(ind), ifmb.getSubHeader());
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getParentId()));
    ind++;
    variables.put(new Integer(ind), ifmb.getParentLabel());
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getColumnNumber()));
    ind++;
    variables.put(new Integer(ind), ifmb.getPageNumberLabel());
    ind++;
    variables.put(new Integer(ind), ifmb.getQuestionNumberLabel());
    ind++;
    variables.put(new Integer(ind), ifmb.getLeftItemText());
    ind++;
    variables.put(new Integer(ind), ifmb.getRightItemText());
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getSectionId()));
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getDescisionConditionId()));
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getResponseSetId()));
    ind++;
    variables.put(new Integer(ind), ifmb.getRegexp());
    ind++;
    variables.put(new Integer(ind), ifmb.getRegexpErrorMsg());
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getOrdinal()));
    ind++;
    variables.put(new Integer(ind), new Boolean(ifmb.isRequired()));
    ind++;
    variables.put(new Integer(ind), new Integer(ifmb.getId()));
    ind++;
    variables.put(new Integer(ind), ifmb.getDefaultValue());
    ind++;
    variables.put(new Integer(ind), ifmb.getResponseLayout());
    ind++;
    variables.put(new Integer(ind), ifmb.getWidthDecimal());
    ind++;
    variables.put(new Integer(ind), new Boolean(ifmb.isShowItem()));
    ind++;
    variables.put(new Integer(ind), ifmb.getId());
    execute("update", variables);
    if (!isQuerySuccessful()) {
        ifmb.setId(0);
        ifmb.setActive(false);
    }
    return ifmb;
}
Also used : HashMap(java.util.HashMap) ItemFormMetadataBean(org.akaza.openclinica.bean.submit.ItemFormMetadataBean)

Example 7 with ItemFormMetadataBean

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

the class ItemFormMetadataDAO method findAllByItemIdAndHasValidations.

public ArrayList<ItemFormMetadataBean> findAllByItemIdAndHasValidations(int itemId) {
    // TODO place holder for returning here, tbh
    ArrayList<ItemFormMetadataBean> answer = new ArrayList<ItemFormMetadataBean>();
    this.setTypesExpected();
    // BWP: changed from 25 to 26 when added response_layout?
    // YW: now added width_decimal
    // version name
    this.setTypeExpected(28, TypeNames.STRING);
    // add more here for display, tbh 082007
    // group_label
    this.setTypeExpected(29, TypeNames.STRING);
    // repeat_max
    this.setTypeExpected(30, TypeNames.INT);
    // section_name
    this.setTypeExpected(31, TypeNames.STRING);
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), new Integer(itemId));
    String sql = digester.getQuery("findAllByItemIdAndHasValidations");
    // logger.info("<<<found SQL: "+sql);
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        HashMap hm = (HashMap) it.next();
        ItemFormMetadataBean ifmb = (ItemFormMetadataBean) this.getEntityFromHashMap(hm);
        String versionName = (String) hm.get("cvname");
        String groupLabel = (String) hm.get("group_label");
        String sectionName = (String) hm.get("section_name");
        int repeatMax = new Integer((Integer) hm.get("repeat_max")).intValue();
        ifmb.setCrfVersionName(versionName);
        ifmb.setGroupLabel(groupLabel);
        // logger.info(">>>added group name: "+groupLabel);
        ifmb.setSectionName(sectionName);
        // logger.info("<<<added section name: "+sectionName);
        ifmb.setRepeatMax(repeatMax);
        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 8 with ItemFormMetadataBean

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

the class ItemFormMetadataDAO method findAllByCRFVersionIdAndSectionId.

public ArrayList<ItemFormMetadataBean> findAllByCRFVersionIdAndSectionId(int crfVersionId, int sectionId) 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));
    variables.put(new Integer(2), new Integer(sectionId));
    String sql = digester.getQuery("findAllByCRFVersionIdAndSectionId");
    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 9 with ItemFormMetadataBean

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

the class ItemFormMetadataDAO method findByItemIdAndCRFVersionIdNotInIGM.

// YW 8-22-2007
public ItemFormMetadataBean findByItemIdAndCRFVersionIdNotInIGM(int itemId, int crfVersionId) {
    this.setTypesExpected();
    HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
    variables.put(new Integer(1), new Integer(itemId));
    variables.put(new Integer(2), new Integer(crfVersionId));
    EntityBean eb = this.executeFindByPKQuery("findByItemIdAndCRFVersionIdNotInIGM", variables);
    if (!eb.isActive()) {
        return new ItemFormMetadataBean();
    } else {
        return (ItemFormMetadataBean) eb;
    }
}
Also used : HashMap(java.util.HashMap) EntityBean(org.akaza.openclinica.bean.core.EntityBean) ItemFormMetadataBean(org.akaza.openclinica.bean.submit.ItemFormMetadataBean)

Example 10 with ItemFormMetadataBean

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

the class ItemFormMetadataDAO method findByPK.

/*
     * (non-Javadoc)
     *
     * @see org.akaza.openclinica.dao.core.DAOInterface#findByPK(int)
     */
public EntityBean findByPK(int id) throws OpenClinicaException {
    ItemFormMetadataBean ifmb = new ItemFormMetadataBean();
    this.setTypesExpected();
    // TODO place holder to return here, tbh
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), new Integer(id));
    String sql = digester.getQuery("findByPK");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        ifmb = (ItemFormMetadataBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return ifmb;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ItemFormMetadataBean(org.akaza.openclinica.bean.submit.ItemFormMetadataBean)

Aggregations

ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)93 ArrayList (java.util.ArrayList)57 HashMap (java.util.HashMap)36 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)36 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)29 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 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)14 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)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)10 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)9 ResponseSetBean (org.akaza.openclinica.bean.submit.ResponseSetBean)9 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)9