Search in sources :

Example 1 with DynamicsItemFormMetadataBean

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;
}
Also used : Query(org.hibernate.Query) DynamicsItemFormMetadataBean(org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean) ArrayList(java.util.ArrayList)

Example 2 with DynamicsItemFormMetadataBean

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;
}
Also used : Query(org.hibernate.Query) DynamicsItemFormMetadataBean(org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean) ArrayList(java.util.ArrayList)

Example 3 with DynamicsItemFormMetadataBean

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

Example 4 with DynamicsItemFormMetadataBean

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

Example 5 with DynamicsItemFormMetadataBean

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);
                        }
                    }
                }
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) ItemGroupMetadataBean(org.akaza.openclinica.bean.submit.ItemGroupMetadataBean) DynamicsItemGroupMetadataBean(org.akaza.openclinica.domain.crfdata.DynamicsItemGroupMetadataBean) SectionBean(org.akaza.openclinica.bean.submit.SectionBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) DynamicsItemFormMetadataBean(org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean) DynamicsItemGroupMetadataBean(org.akaza.openclinica.domain.crfdata.DynamicsItemGroupMetadataBean) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean) DisplayItemGroupBean(org.akaza.openclinica.bean.submit.DisplayItemGroupBean) PropertyBean(org.akaza.openclinica.domain.rule.action.PropertyBean) DynamicsItemFormMetadataBean(org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean) ItemFormMetadataBean(org.akaza.openclinica.bean.submit.ItemFormMetadataBean)

Aggregations

DynamicsItemFormMetadataBean (org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean)17 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)14 ArrayList (java.util.ArrayList)7 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)6 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)5 ItemGroupMetadataBean (org.akaza.openclinica.bean.submit.ItemGroupMetadataBean)4 PropertyBean (org.akaza.openclinica.domain.rule.action.PropertyBean)4 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)3 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)3 ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)3 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)3 DynamicsItemGroupMetadataBean (org.akaza.openclinica.domain.crfdata.DynamicsItemGroupMetadataBean)3 Query (org.hibernate.Query)3 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)2 HashMap (java.util.HashMap)1 HttpSession (javax.servlet.http.HttpSession)1 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)1 FormDiscrepancyNotes (org.akaza.openclinica.control.form.FormDiscrepancyNotes)1 DiscrepancyNoteDAO (org.akaza.openclinica.dao.managestudy.DiscrepancyNoteDAO)1 ItemDAO (org.akaza.openclinica.dao.submit.ItemDAO)1