use of org.akaza.openclinica.bean.submit.ItemGroupMetadataBean in project OpenClinica by OpenClinica.
the class ItemGroupMetadataDAO method create.
public EntityBean create(EntityBean eb) throws OpenClinicaException {
// INSERT INTO item_group_metadata (item_group_id,
// header, subheader,layout,repeat_number,repeat_max,
// repeat_array, row_start_number,crf_version_id,
// item_id, ordinal,borders, show_group)
// VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
ItemGroupMetadataBean igMetaBean = (ItemGroupMetadataBean) eb;
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
int id = getNextPK();
variables.put(1, id);
variables.put(2, igMetaBean.getItemGroupId());
variables.put(3, igMetaBean.getHeader());
variables.put(4, igMetaBean.getSubheader());
variables.put(5, igMetaBean.getLayout());
variables.put(6, igMetaBean.getRepeatNum());
variables.put(7, igMetaBean.getRepeatMax());
variables.put(8, igMetaBean.getRepeatArray());
variables.put(9, igMetaBean.getRowStartNumber());
variables.put(10, igMetaBean.getCrfVersionId());
variables.put(11, igMetaBean.getItemId());
variables.put(12, igMetaBean.getOrdinal());
variables.put(13, igMetaBean.getBorders());
variables.put(14, new Boolean(igMetaBean.isShowGroup()));
this.execute(digester.getQuery("create"), variables);
if (isQuerySuccessful()) {
eb.setId(id);
}
return eb;
}
use of org.akaza.openclinica.bean.submit.ItemGroupMetadataBean in project OpenClinica by OpenClinica.
the class ItemGroupMetadataDAO method findByCrfVersion.
public List<ItemGroupMetadataBean> findByCrfVersion(Integer crfVersionId) {
ItemGroupMetadataBean eb = new ItemGroupMetadataBean();
this.setTypesExpected();
HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
variables.put(1, crfVersionId);
String sql = digester.getQuery("findByCrfVersionId");
ArrayList alist = this.select(sql, variables);
List<ItemGroupMetadataBean> beanList = new ArrayList<ItemGroupMetadataBean>();
ItemGroupMetadataBean bean;
for (Object map : alist) {
bean = (ItemGroupMetadataBean) this.getEntityFromHashMap((HashMap) map);
beanList.add(bean);
}
return beanList;
}
use of org.akaza.openclinica.bean.submit.ItemGroupMetadataBean in project OpenClinica by OpenClinica.
the class ItemGroupMetadataDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
ItemGroupMetadataBean meta = new ItemGroupMetadataBean();
meta.setId((Integer) hm.get("item_group_metadata_id"));
meta.setItemGroupId((Integer) hm.get("item_group_id"));
meta.setHeader((String) hm.get("header"));
meta.setSubheader((String) hm.get("subheader"));
meta.setLayout((String) hm.get("layout"));
meta.setRepeatNum((Integer) hm.get("repeat_number"));
meta.setRepeatMax((Integer) hm.get("repeat_max"));
meta.setRepeatArray((String) hm.get("repeat_array"));
meta.setRowStartNumber((Integer) hm.get("row_start_number"));
meta.setCrfVersionId((Integer) hm.get("crf_version_id"));
meta.setItemId((Integer) hm.get("item_id"));
meta.setOrdinal((Integer) hm.get("ordinal"));
meta.setBorders((Integer) hm.get("borders"));
meta.setShowGroup(((Boolean) hm.get("show_group")).booleanValue());
meta.setRepeatingGroup(((Boolean) hm.get("repeating_group")).booleanValue());
return meta;
}
use of org.akaza.openclinica.bean.submit.ItemGroupMetadataBean in project OpenClinica by OpenClinica.
the class ItemGroupMetadataDAO method findByItemAndCrfVersion.
public EntityBean findByItemAndCrfVersion(Integer itemId, Integer crfVersionId) {
ItemGroupMetadataBean eb = new ItemGroupMetadataBean();
this.setTypesExpected();
HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
variables.put(1, itemId);
variables.put(2, crfVersionId);
String sql = digester.getQuery("findByItemIdAndCrfVersionId");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (ItemGroupMetadataBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
use of org.akaza.openclinica.bean.submit.ItemGroupMetadataBean 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