use of org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean in project OpenClinica by OpenClinica.
the class DynamicsItemFormMetadataDao method findByItemAndEventCrfShown.
public ArrayList<DynamicsItemFormMetadataBean> findByItemAndEventCrfShown(EventCRFBean eventCrfBean, int itemId) {
String query = "from DynamicsItemFormMetadataBean metadata where " + "metadata.itemId = :item_id and metadata.eventCrfId = :event_crf_id and " + "metadata.showItem = true order by metadata.id desc ";
Query q = getCurrentSession().createQuery(query);
q.setInteger("item_id", itemId);
q.setInteger("event_crf_id", new Integer(eventCrfBean.getId()));
ArrayList<DynamicsItemFormMetadataBean> list = (ArrayList<DynamicsItemFormMetadataBean>) q.list();
return list;
}
use of org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean in project OpenClinica by OpenClinica.
the class DynamicsItemFormMetadataDao method findByMetadataBean.
public DynamicsItemFormMetadataBean findByMetadataBean(ItemFormMetadataBean metadataBean, EventCRFBean eventCrfBean, ItemDataBean itemDataBean) {
String query = "from DynamicsItemFormMetadataBean metadata where " + "metadata.itemId = :item_id and metadata.eventCrfId = :event_crf_id and " + "metadata.itemDataId = :item_data_id order by metadata.id desc ";
Query q = getCurrentSession().createQuery(query);
q.setInteger("item_id", new Integer(metadataBean.getItemId()));
q.setInteger("event_crf_id", new Integer(eventCrfBean.getId()));
q.setInteger("item_data_id", new Integer(itemDataBean.getId()));
ArrayList<DynamicsItemFormMetadataBean> list = (ArrayList<DynamicsItemFormMetadataBean>) q.list();
return list.size() != 0 ? list.get(0) : null;
}
use of org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean in project OpenClinica by OpenClinica.
the class DynamicsMetadataService method hideNewItem.
public boolean hideNewItem(ItemFormMetadataBean metadataBean, EventCRFBean eventCrfBean, ItemDataBean itemDataBean) {
ItemFormMetadataBean itemFormMetadataBean = metadataBean;
DynamicsItemFormMetadataBean dynamicsMetadataBean = new DynamicsItemFormMetadataBean(itemFormMetadataBean, eventCrfBean);
dynamicsMetadataBean.setItemDataId(itemDataBean.getId());
dynamicsMetadataBean.setShowItem(false);
getDynamicsItemFormMetadataDao().saveOrUpdate(dynamicsMetadataBean);
return true;
}
use of org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean in project OpenClinica by OpenClinica.
the class DynamicsMetadataService method getDynamicsItemFormMetadataBean.
/**
*
* TODO: remove the @deprecated call. The reason it is there now is to accommodate the call being made from the DataEntryServlet
*
* @param metadataBean
* @param eventCrfBean
* @param itemDataBean
* @return DynamicsItemFormMetadataBean
*/
private DynamicsItemFormMetadataBean getDynamicsItemFormMetadataBean(ItemFormMetadataBean metadataBean, EventCRFBean eventCrfBean, ItemDataBean itemDataBean) {
ItemFormMetadataBean itemFormMetadataBean = metadataBean;
DynamicsItemFormMetadataBean dynamicsMetadataBean = null;
dynamicsMetadataBean = getDynamicsItemFormMetadataDao().findByMetadataBean(itemFormMetadataBean, eventCrfBean, itemDataBean);
return dynamicsMetadataBean;
}
use of org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean in project OpenClinica by OpenClinica.
the class DynamicsMetadataService method show.
public void show(Integer itemDataId, List<PropertyBean> properties, RuleSetBean ruleSet) {
ItemDataBean itemDataBeanA = (ItemDataBean) getItemDataDAO().findByPK(itemDataId);
EventCRFBean eventCrfBeanA = (EventCRFBean) getEventCRFDAO().findByPK(itemDataBeanA.getEventCRFId());
StudyEventBean studyEventBeanA = (StudyEventBean) getStudyEventDAO().findByPK(eventCrfBeanA.getStudyEventId());
ItemGroupMetadataBean itemGroupMetadataBeanA = (ItemGroupMetadataBean) getItemGroupMetadataDAO().findByItemAndCrfVersion(itemDataBeanA.getItemId(), eventCrfBeanA.getCRFVersionId());
Boolean isGroupARepeating = isGroupRepeating(itemGroupMetadataBeanA);
String itemGroupAOrdinal = getExpressionService().getGroupOrdninalCurated(ruleSet.getTarget().getValue());
for (PropertyBean propertyBean : properties) {
String oid = propertyBean.getOid();
ItemOrItemGroupHolder itemOrItemGroup = getItemOrItemGroup(oid);
// OID is an item
if (itemOrItemGroup.getItemBean() != null) {
ItemDataBean oidBasedItemData = getItemData(itemOrItemGroup.getItemBean(), eventCrfBeanA, itemDataBeanA.getOrdinal());
ItemFormMetadataBean itemFormMetadataBean = getItemFormMetadataDAO().findByItemIdAndCRFVersionId(itemOrItemGroup.getItemBean().getId(), eventCrfBeanA.getCRFVersionId());
DynamicsItemFormMetadataBean dynamicsMetadataBean = getDynamicsItemFormMetadataBean(itemFormMetadataBean, eventCrfBeanA, oidBasedItemData);
if (dynamicsMetadataBean == null) {
showItem(itemFormMetadataBean, eventCrfBeanA, oidBasedItemData);
} else if (dynamicsMetadataBean != null && !dynamicsMetadataBean.isShowItem()) {
dynamicsMetadataBean.setShowItem(true);
getDynamicsItemFormMetadataDao().saveOrUpdate(dynamicsMetadataBean);
}
} else // OID is a group
{
logger.debug("found item group id 1 " + oid);
ItemGroupBean itemGroupBean = itemOrItemGroup.getItemGroupBean();
ArrayList sectionBeans = getSectionDAO().findAllByCRFVersionId(eventCrfBeanA.getCRFVersionId());
for (int i = 0; i < sectionBeans.size(); i++) {
SectionBean sectionBean = (SectionBean) sectionBeans.get(i);
// System.out.println("found section " + sectionBean.getId());
List<ItemGroupMetadataBean> itemGroupMetadataBeans = getItemGroupMetadataDAO().findMetaByGroupAndSection(itemGroupBean.getId(), eventCrfBeanA.getCRFVersionId(), sectionBean.getId());
for (ItemGroupMetadataBean itemGroupMetadataBean : itemGroupMetadataBeans) {
if (itemGroupMetadataBean.getItemGroupId() == itemGroupBean.getId()) {
// System.out.println("found item group id 2 " + oid);
DynamicsItemGroupMetadataBean dynamicsGroupBean = getDynamicsItemGroupMetadataBean(itemGroupMetadataBean, eventCrfBeanA);
if (dynamicsGroupBean == null) {
showGroup(itemGroupMetadataBean, eventCrfBeanA);
} else if (dynamicsGroupBean != null && !dynamicsGroupBean.isShowGroup()) {
dynamicsGroupBean.setShowGroup(true);
getDynamicsItemGroupMetadataDao().saveOrUpdate(dynamicsGroupBean);
}
}
}
}
}
}
}
Aggregations