Search in sources :

Example 1 with PropertyBean

use of org.akaza.openclinica.domain.rule.action.PropertyBean in project OpenClinica by OpenClinica.

the class MessageContainer method add.

public void add(String groupOrdinalPLusItemOid, RuleActionBean ruleActionBean) {
    // System.out.println("just added error : " + ruleActionBean.getSummary());
    if (ruleActionBean instanceof ShowActionBean) {
        String groupOidOrdinal = groupOrdinalPLusItemOid;
        List<PropertyBean> properties = ((ShowActionBean) ruleActionBean).getProperties();
        for (PropertyBean propertyBean : properties) {
            String propertyOid = propertyBean.getOid();
            addInternal(propertyOid.contains(".") ? propertyOid : groupOidOrdinal + "." + propertyOid, ruleActionBean.getSummary(), MessageType.WARNING);
        //addInternal(propertyBean.getOid(), ruleActionBean.getSummary(), MessageType.WARNING);
        //System.out.println("just added warning : " + ruleActionBean.getSummary());
        }
    } else {
        addInternal(groupOrdinalPLusItemOid, ruleActionBean.getSummary(), MessageType.ERROR);
    //System.out.println("just added error : " + ruleActionBean.getSummary());
    }
}
Also used : ShowActionBean(org.akaza.openclinica.domain.rule.action.ShowActionBean) PropertyBean(org.akaza.openclinica.domain.rule.action.PropertyBean)

Example 2 with PropertyBean

use of org.akaza.openclinica.domain.rule.action.PropertyBean in project OpenClinica by OpenClinica.

the class BeanPropertyService method runAction.

/**
     * Complete adding to this Service to evaluate Event action
     * @param ruleActionBean
     * @param eow
     * @param isTransaction 
     */
public void runAction(RuleActionBean ruleActionBean, ExpressionBeanObjectWrapper eow, Integer userId, Boolean isTransaction) {
    boolean statusMatch = false;
    OpenClinicaExpressionParser oep = new OpenClinicaExpressionParser(eow);
    ExpressionBeanService ebs = new ExpressionBeanService(eow);
    StudyEvent studyEvent = ebs.getStudyEventFromOID(((EventActionBean) ruleActionBean).getOc_oid_reference());
    RuleActionRunBean runOnStatuses = ruleActionBean.getRuleActionRun();
    if (studyEvent != null) {
        switch(SubjectEventStatus.getByCode(studyEvent.getSubjectEventStatusId())) {
            case NOT_SCHEDULED:
                if (runOnStatuses.getNot_started())
                    statusMatch = true;
                break;
            case SCHEDULED:
                if (runOnStatuses.getScheduled())
                    statusMatch = true;
                break;
            case DATA_ENTRY_STARTED:
                if (runOnStatuses.getData_entry_started())
                    statusMatch = true;
                break;
            case COMPLETED:
                if (runOnStatuses.getComplete())
                    statusMatch = true;
                break;
            case SKIPPED:
                if (runOnStatuses.getSkipped())
                    statusMatch = true;
                break;
            case STOPPED:
                if (runOnStatuses.getStopped())
                    statusMatch = true;
                break;
            case SIGNED:
            case LOCKED:
            default:
                statusMatch = false;
                break;
        }
    } else //Special case if destination study event doesn't exist yet, ie not scheduled.
    {
        if (runOnStatuses.getNot_started())
            statusMatch = true;
    }
    if (statusMatch) {
        for (PropertyBean propertyBean : ((EventActionBean) ruleActionBean).getProperties()) {
            // This will execute the contents of <ValueExpression>SS.ENROLLMENT_DATE + 2</ValueExpression>
            LOGGER.debug("Values:expression??::" + propertyBean.getValueExpression().getValue());
            Object result = oep.parseAndEvaluateExpression(propertyBean.getValueExpression().getValue());
            executeAction(result, propertyBean, eow, (EventActionBean) ruleActionBean, userId, isTransaction);
        }
    }
}
Also used : OpenClinicaExpressionParser(org.akaza.openclinica.logic.expressionTree.OpenClinicaExpressionParser) ExpressionBeanService(org.akaza.openclinica.service.rule.expression.ExpressionBeanService) EventActionBean(org.akaza.openclinica.domain.rule.action.EventActionBean) RuleActionRunBean(org.akaza.openclinica.domain.rule.action.RuleActionRunBean) StudyEvent(org.akaza.openclinica.domain.datamap.StudyEvent) PropertyBean(org.akaza.openclinica.domain.rule.action.PropertyBean)

Example 3 with PropertyBean

use of org.akaza.openclinica.domain.rule.action.PropertyBean 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)

Example 4 with PropertyBean

use of org.akaza.openclinica.domain.rule.action.PropertyBean in project OpenClinica by OpenClinica.

the class DynamicsMetadataService method hideNew.

public void hideNew(Integer itemDataId, List<PropertyBean> properties, UserAccountBean ub, RuleSetBean ruleSet) {
    ItemDataBean itemDataBeanA = (ItemDataBean) getItemDataDAO().findByPK(itemDataId);
    EventCRFBean eventCrfBeanA = (EventCRFBean) getEventCRFDAO().findByPK(itemDataBeanA.getEventCRFId());
    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) {
            String expression = getExpressionService().constructFullExpressionIfPartialProvided(propertyBean.getOid(), ruleSet.getTarget().getValue());
            ItemBean itemBeanB = getExpressionService().getItemBeanFromExpression(expression);
            ItemGroupBean itemGroupBeanB = getExpressionService().getItemGroupExpression(expression);
            EventCRFBean eventCrfBeanB = eventCrfBeanA;
            ItemGroupMetadataBean itemGroupMetadataBeanB = (ItemGroupMetadataBean) getItemGroupMetadataDAO().findByItemAndCrfVersion(itemBeanB.getId(), eventCrfBeanB.getCRFVersionId());
            Boolean isGroupBRepeating = isGroupRepeating(itemGroupMetadataBeanB);
            String itemGroupBOrdinal = getExpressionService().getGroupOrdninalCurated(expression);
            List<ItemDataBean> itemDataBeans = new ArrayList<ItemDataBean>();
            // If A and B are both non repeating groups
            if (!isGroupARepeating && !isGroupBRepeating) {
                ItemDataBean oidBasedItemData = oneToOne(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, 1);
                itemDataBeans.add(oidBasedItemData);
            }
            // If A is not repeating group & B is a repeating group with no index selected
            if (!isGroupARepeating && isGroupBRepeating && itemGroupBOrdinal.equals("")) {
                List<ItemDataBean> oidBasedItemDatas = oneToMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub);
                itemDataBeans.addAll(oidBasedItemDatas);
            }
            // If A is not repeating group & B is a repeating group with index selected
            if (!isGroupARepeating && isGroupBRepeating && !itemGroupBOrdinal.equals("")) {
                ItemDataBean oidBasedItemData = oneToIndexedMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, Integer.valueOf(itemGroupBOrdinal));
                itemDataBeans.add(oidBasedItemData);
            }
            // If A is repeating group with index & B is a repeating group with index selected
            if (isGroupARepeating && isGroupBRepeating && !itemGroupBOrdinal.equals("")) {
                ItemDataBean oidBasedItemData = oneToIndexedMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, Integer.valueOf(itemGroupBOrdinal));
                itemDataBeans.add(oidBasedItemData);
            }
            // If A is repeating group with index & B is a repeating group with no index selected
            if (isGroupARepeating && isGroupBRepeating && itemGroupBOrdinal.equals("")) {
                ItemDataBean oidBasedItemData = oneToIndexedMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, Integer.valueOf(itemGroupAOrdinal));
                itemDataBeans.add(oidBasedItemData);
            }
            for (ItemDataBean oidBasedItemData : itemDataBeans) {
                ItemFormMetadataBean itemFormMetadataBean = getItemFormMetadataDAO().findByItemIdAndCRFVersionId(itemOrItemGroup.getItemBean().getId(), eventCrfBeanA.getCRFVersionId());
                DynamicsItemFormMetadataBean dynamicsMetadataBean = getDynamicsItemFormMetadataBean(itemFormMetadataBean, eventCrfBeanA, oidBasedItemData);
                if (dynamicsMetadataBean == null && oidBasedItemData.getValue().equals("")) {
                    hideNewItem(itemFormMetadataBean, eventCrfBeanA, oidBasedItemData);
                } else if (dynamicsMetadataBean != null && dynamicsMetadataBean.isShowItem() && oidBasedItemData.getValue().equals("")) {
                    // tbh #5287: add an additional check here to see if it should be hidden
                    dynamicsMetadataBean.setShowItem(false);
                    getDynamicsItemFormMetadataDao().saveOrUpdate(dynamicsMetadataBean);
                }
            }
        } else // OID is a group
        {
            // ItemGroupBean itemGroupBean = itemOrItemGroup.getItemGroupBean();
            // below taken from showNew and reversed, tbh 07/2010
            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) {
                            hideGroup(itemGroupMetadataBean, eventCrfBeanA);
                        } else if (dynamicsGroupBean != null && !dynamicsGroupBean.isShowGroup()) {
                            dynamicsGroupBean.setShowGroup(false);
                            getDynamicsItemGroupMetadataDao().saveOrUpdate(dynamicsGroupBean);
                        // TODO is below required in hide?
                        } else if (eventCrfBeanA.getStage().equals(DataEntryStage.DOUBLE_DATA_ENTRY)) {
                            //setVersion(1); // version 1 = passed DDE
                            dynamicsGroupBean.setPassedDde(1);
                            getDynamicsItemGroupMetadataDao().saveOrUpdate(dynamicsGroupBean);
                        }
                    }
                }
            }
        }
    }
// tbh #5287: reset the check to make sure items that have been shown are not re-hidden
// resetItemCounter();
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) DisplayItemBean(org.akaza.openclinica.bean.submit.DisplayItemBean) ArrayList(java.util.ArrayList) 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)

Example 5 with PropertyBean

use of org.akaza.openclinica.domain.rule.action.PropertyBean in project OpenClinica by OpenClinica.

the class DynamicsMetadataService method insert.

private void insert(Integer itemDataId, List<PropertyBean> properties, UserAccountBean ub, RuleSetBean ruleSet, Status itemDataStatus, List<StratificationFactorBean> stratificationFactorBeans) {
    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 expression = getExpressionService().constructFullExpressionIfPartialProvided(propertyBean.getOid(), ruleSet.getTarget().getValue());
        ItemBean itemBeanB = getExpressionService().getItemBeanFromExpression(expression);
        ItemGroupBean itemGroupBeanB = getExpressionService().getItemGroupExpression(expression);
        ItemGroupMetadataBean itemGroupMetadataBeanB = null;
        Boolean isGroupBRepeating = null;
        String itemGroupBOrdinal = null;
        EventCRFBean eventCrfBeanB = null;
        Boolean isItemInSameForm = getItemFormMetadataDAO().findByItemIdAndCRFVersionId(itemBeanB.getId(), eventCrfBeanA.getCRFVersionId()).getId() != 0 ? true : false;
        // Item Does not below to same form
        if (!isItemInSameForm) {
            List<EventCRFBean> eventCrfs = getEventCRFDAO().findAllByStudyEventAndCrfOrCrfVersionOid(studyEventBeanA, getExpressionService().getCrfOid(expression));
            if (eventCrfs.size() == 0) {
                CRFVersionBean crfVersion = getExpressionService().getCRFVersionFromExpression(expression);
                CRFBean crf = getExpressionService().getCRFFromExpression(expression);
                int crfVersionId = 0;
                EventDefinitionCRFBean eventDefinitionCRFBean = getEventDefinitionCRfDAO().findByStudyEventDefinitionIdAndCRFId(studyEventBeanA.getStudyEventDefinitionId(), crf.getId());
                if (eventDefinitionCRFBean.getId() != 0) {
                    crfVersionId = crfVersion != null ? crfVersion.getId() : eventDefinitionCRFBean.getDefaultVersionId();
                }
                // Create new event crf
                eventCrfBeanB = eventCrfBeanA.copy();
                eventCrfBeanB.setStatus(Status.AVAILABLE);
                eventCrfBeanB.setId(0);
                eventCrfBeanB.setCRFVersionId(crfVersionId);
                eventCrfBeanB = (EventCRFBean) getEventCRFDAO().create(eventCrfBeanB);
            } else {
                eventCrfBeanB = eventCrfs.get(0);
            }
        }
        if (isItemInSameForm) {
            eventCrfBeanB = eventCrfBeanA;
        }
        itemGroupMetadataBeanB = (ItemGroupMetadataBean) getItemGroupMetadataDAO().findByItemAndCrfVersion(itemBeanB.getId(), eventCrfBeanB.getCRFVersionId());
        isGroupBRepeating = isGroupRepeating(itemGroupMetadataBeanB);
        itemGroupBOrdinal = getExpressionService().getGroupOrdninalCurated(expression);
        // If A and B are both non repeating groups
        if (!isGroupARepeating && !isGroupBRepeating) {
            ItemDataBean oidBasedItemData = oneToOne(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, 1);
            oidBasedItemData.setValue(getValue(propertyBean, ruleSet, eventCrfBeanA, stratificationFactorBeans));
            if (itemDataStatus != null)
                oidBasedItemData.setStatus(itemDataStatus);
            getItemDataDAO().updateValue(oidBasedItemData, getDateFormat(propertyBean));
        }
        // If A is not repeating group & B is a repeating group with no index selected
        if (!isGroupARepeating && isGroupBRepeating && itemGroupBOrdinal.equals("")) {
            List<ItemDataBean> oidBasedItemDatas = oneToMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub);
            for (ItemDataBean oidBasedItemData : oidBasedItemDatas) {
                oidBasedItemData.setValue(getValue(propertyBean, ruleSet, eventCrfBeanA, stratificationFactorBeans));
                if (itemDataStatus != null)
                    oidBasedItemData.setStatus(itemDataStatus);
                getItemDataDAO().updateValue(oidBasedItemData, getDateFormat(propertyBean));
            }
        }
        // If A is not repeating group & B is a repeating group with index selected
        if (!isGroupARepeating && isGroupBRepeating && !itemGroupBOrdinal.equals("")) {
            ItemDataBean oidBasedItemData = oneToIndexedMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, Integer.valueOf(itemGroupBOrdinal));
            oidBasedItemData.setValue(getValue(propertyBean, ruleSet, eventCrfBeanA, stratificationFactorBeans));
            if (itemDataStatus != null)
                oidBasedItemData.setStatus(itemDataStatus);
            getItemDataDAO().updateValue(oidBasedItemData, getDateFormat(propertyBean));
        }
        // If A is repeating/ non repeating group & B is a repeating group with index selected as END
        if (isGroupBRepeating && itemGroupBOrdinal.equals("END")) {
            ItemDataBean oidBasedItemData = oneToEndMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub);
            oidBasedItemData.setValue(getValue(propertyBean, ruleSet, eventCrfBeanA, stratificationFactorBeans));
            if (itemDataStatus != null)
                oidBasedItemData.setStatus(itemDataStatus);
            getItemDataDAO().updateValue(oidBasedItemData, getDateFormat(propertyBean));
        }
        // If A is repeating group with index & B is a repeating group with index selected
        if (isGroupARepeating && isGroupBRepeating && !itemGroupBOrdinal.equals("") && !itemGroupBOrdinal.equals("END")) {
            ItemDataBean oidBasedItemData = oneToIndexedMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, Integer.valueOf(itemGroupBOrdinal));
            oidBasedItemData.setValue(getValue(propertyBean, ruleSet, eventCrfBeanA, stratificationFactorBeans));
            if (itemDataStatus != null)
                oidBasedItemData.setStatus(itemDataStatus);
            getItemDataDAO().updateValue(oidBasedItemData, getDateFormat(propertyBean));
        }
        // If A is repeating group with index & B is a repeating group with no index selected
        if (isGroupARepeating && isGroupBRepeating && itemGroupBOrdinal.equals("")) {
            ItemDataBean oidBasedItemData = oneToIndexedMany(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, Integer.valueOf(itemGroupAOrdinal));
            oidBasedItemData.setValue(getValue(propertyBean, ruleSet, eventCrfBeanA, stratificationFactorBeans));
            if (itemDataStatus != null)
                oidBasedItemData.setStatus(itemDataStatus);
            getItemDataDAO().updateValue(oidBasedItemData, getDateFormat(propertyBean));
        }
    //            // If A is repeating group with index & B is none-repeating group
    //            if (isGroupARepeating && !isGroupBRepeating ) {
    //                ItemDataBean oidBasedItemData =
    //                        oneToOne(itemDataBeanA, eventCrfBeanA, itemGroupMetadataBeanA, itemBeanB, itemGroupMetadataBeanB, eventCrfBeanB, ub, 1);
    //
    //                oidBasedItemData.setValue(getValue(propertyBean, ruleSet, eventCrfBeanA));
    //                getItemDataDAO().updateValue(oidBasedItemData, "yyyy-MM-dd");
    //            }
    }
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) DisplayItemBean(org.akaza.openclinica.bean.submit.DisplayItemBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) ItemGroupMetadataBean(org.akaza.openclinica.bean.submit.ItemGroupMetadataBean) DynamicsItemGroupMetadataBean(org.akaza.openclinica.domain.crfdata.DynamicsItemGroupMetadataBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) ItemDataBean(org.akaza.openclinica.bean.submit.ItemDataBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean) DisplayItemGroupBean(org.akaza.openclinica.bean.submit.DisplayItemGroupBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) PropertyBean(org.akaza.openclinica.domain.rule.action.PropertyBean)

Aggregations

PropertyBean (org.akaza.openclinica.domain.rule.action.PropertyBean)13 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)5 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)5 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)4 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)4 ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)4 ItemGroupMetadataBean (org.akaza.openclinica.bean.submit.ItemGroupMetadataBean)4 DynamicsItemFormMetadataBean (org.akaza.openclinica.domain.crfdata.DynamicsItemFormMetadataBean)4 DynamicsItemGroupMetadataBean (org.akaza.openclinica.domain.crfdata.DynamicsItemGroupMetadataBean)4 EventActionBean (org.akaza.openclinica.domain.rule.action.EventActionBean)4 ArrayList (java.util.ArrayList)3 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)3 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)3 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)3 InsertActionBean (org.akaza.openclinica.domain.rule.action.InsertActionBean)3 ShowActionBean (org.akaza.openclinica.domain.rule.action.ShowActionBean)3 ExpressionBean (org.akaza.openclinica.domain.rule.expression.ExpressionBean)3 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)2 DiscrepancyNoteActionBean (org.akaza.openclinica.domain.rule.action.DiscrepancyNoteActionBean)2 HideActionBean (org.akaza.openclinica.domain.rule.action.HideActionBean)2