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;
}
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;
}
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;
}
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;
}
}
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;
}
Aggregations