Search in sources :

Example 61 with RuleSetBean

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

the class RuleSetService method getGroupOrdinalPlusItemOids.

/*
     * (non-Javadoc)
     * @see org.akaza.openclinica.service.rule.RuleSetServiceInterface#getGroupOrdinalPlusItemOids(java.util.List)
     */
public List<String> getGroupOrdinalPlusItemOids(List<RuleSetBean> ruleSets) {
    List<String> groupOrdinalPlusItemOid = new ArrayList<String>();
    for (RuleSetBean ruleSetBean : ruleSets) {
        String text = getExpressionService().getGroupOrdninalConcatWithItemOid(ruleSetBean.getTarget().getValue());
        groupOrdinalPlusItemOid.add(text);
        logger.debug("ruleSet id {} groupOrdinalPlusItemOid : {}", ruleSetBean.getId(), text);
    }
    return groupOrdinalPlusItemOid;
}
Also used : ArrayList(java.util.ArrayList) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Example 62 with RuleSetBean

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

the class RuleSetService method getRuleSetsByStudy.

/*
     * Used to Manage RuleSets ,Hence will return all RuleSets whether removed or not
     */
/*
     * (non-Javadoc)
     * @see org.akaza.openclinica.service.rule.RuleSetServiceInterface#getRuleSetsByStudy(org.akaza.openclinica.bean.managestudy.StudyBean)
     */
public List<RuleSetBean> getRuleSetsByStudy(StudyBean study) {
    logger.debug(" Study Id {} ", study.getId());
    List<RuleSetBean> ruleSets = getRuleSetDao().findAllByStudy(study);
    for (RuleSetBean ruleSetBean : ruleSets) {
        getObjects(ruleSetBean);
    }
    logger.info("getRuleSetsByStudy() : ruleSets Size : {}", ruleSets.size());
    return ruleSets;
// return eagerFetchRuleSet(ruleSets);
}
Also used : RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Example 63 with RuleSetBean

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

the class RuleSetService method filterRuleSetsByStudyEventOrdinal.

/*
     * (non-Javadoc)
     * @see org.akaza.openclinica.service.rule.RuleSetServiceInterface#filterRuleSetsByStudyEventOrdinal(java.util.List,
     * org.akaza.openclinica.bean.managestudy.StudyEventBean)
     */
public List<RuleSetBean> filterRuleSetsByStudyEventOrdinal(List<RuleSetBean> ruleSets, StudyEventBean studyEvent, CRFVersionBean crfVersion, StudyEventDefinitionBean studyEventDefinition) {
    ArrayList<RuleSetBean> validRuleSets = new ArrayList<RuleSetBean>();
    for (RuleSetBean ruleSetBean : ruleSets) {
        if (!getExpressionService().isExpressionPartial(ruleSetBean.getTarget().getValue())) {
            String studyEventDefinitionOrdinal = getExpressionService().getStudyEventDefinitionOrdninalCurated(ruleSetBean.getTarget().getValue());
            if (studyEventDefinitionOrdinal.equals("")) {
                ruleSetBean.addExpression(replaceSEDOrdinal(ruleSetBean.getTarget(), studyEvent));
                validRuleSets.add(ruleSetBean);
            }
            String compareOrdinal = Integer.toString(studyEvent.getSampleOrdinal());
            if (studyEventDefinitionOrdinal.equals(compareOrdinal)) {
                ruleSetBean.addExpression(replaceSEDOrdinal(ruleSetBean.getTarget(), studyEvent));
                validRuleSets.add(ruleSetBean);
            }
        /* if (studyEventDefinitionOrdinal.equals(String.valueOf(studyEvent.getSampleOrdinal()))) {
                    ruleSetBean.addExpression(replaceSEDOrdinal(ruleSetBean.getTarget(), studyEvent));
                    validRuleSets.add(ruleSetBean);
                }
                */
        } else {
            String expression = getExpressionService().constructFullExpressionIfPartialProvided(ruleSetBean.getTarget().getValue(), crfVersion, studyEventDefinition);
            ruleSetBean.addExpression(replaceSEDOrdinal(ruleSetBean.getTarget(), studyEvent, expression));
            validRuleSets.add(ruleSetBean);
        }
    }
    logger.debug("Size of RuleSets post filterRuleSetsByStudyEventOrdinal() {} ", validRuleSets.size());
    return validRuleSets;
}
Also used : ArrayList(java.util.ArrayList) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Example 64 with RuleSetBean

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

the class RulesPostImportContainerService method addNewRuleSetBeanInList.

private void addNewRuleSetBeanInList(String target, String destination, List<RuleSetBean> eventActionsRuleSetBean) {
    ExpressionBean expression = new ExpressionBean();
    expression.setValue(target);
    RuleSetBean ruleSetBean = new RuleSetBean();
    ruleSetBean.setOriginalTarget(expression);
    EventActionBean eventActionBean = new EventActionBean();
    eventActionBean.setOc_oid_reference(destination);
    List<RuleActionBean> listRuleActionBean = new ArrayList<RuleActionBean>();
    listRuleActionBean.add(eventActionBean);
    RuleSetRuleBean ruleSetRuleBean = new RuleSetRuleBean();
    ruleSetRuleBean.setActions(listRuleActionBean);
    ruleSetBean.addRuleSetRule(ruleSetRuleBean);
    eventActionsRuleSetBean.add(ruleSetBean);
}
Also used : EventActionBean(org.akaza.openclinica.domain.rule.action.EventActionBean) RuleActionBean(org.akaza.openclinica.domain.rule.action.RuleActionBean) RuleSetRuleBean(org.akaza.openclinica.domain.rule.RuleSetRuleBean) ArrayList(java.util.ArrayList) ExpressionBean(org.akaza.openclinica.domain.rule.expression.ExpressionBean) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Example 65 with RuleSetBean

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

the class RulesPostImportContainerService method runValidationInList.

public void runValidationInList(String target, String destination, AuditableBeanWrapper<RuleSetBean> ruleSetBeanWrapper, List<RuleSetBean> eventActionsRuleSetBean) {
    // eventActionsRuleSetBean is the list of all events from rule set table
    Boolean isDestinationATarget = false;
    RuleSetBean isDestination = null;
    for (RuleSetBean ruleSetBean : eventActionsRuleSetBean) {
        if (isDestinationAndTargetMatch(parseTarget(ruleSetBean.getOriginalTarget().getValue()), parseDestination(destination)) || isDestinationAndTargetAcceptable(parseTarget(ruleSetBean.getOriginalTarget().getValue()), parseDestination(destination))) {
            isDestinationATarget = true;
            isDestination = ruleSetBean;
            break;
        }
    }
    if (isDestinationATarget == true && isDestination != null) {
        List<RuleActionBean> ruleActions = getAllRuleActions(isDestination);
        for (RuleActionBean ruleActionBean : ruleActions) {
            if (ruleActionBean.getActionType().getCode() == 6) {
                if (isDestinationAndTargetMatch(parseTarget(target), parseDestination(((EventActionBean) ruleActionBean).getOc_oid_reference() + ".STARTDATE"))) {
                    ruleSetBeanWrapper.error(createError("OCRERR_0042"));
                    break;
                }
                if (isDestinationAndTargetAcceptable(parseTarget(target), parseDestination(((EventActionBean) ruleActionBean).getOc_oid_reference()))) {
                    ruleSetBeanWrapper.error(createError("OCRERR_0043"));
                    break;
                }
                runValidationInList(target, ((EventActionBean) ruleActionBean).getOc_oid_reference(), ruleSetBeanWrapper, eventActionsRuleSetBean);
            }
        }
    } else {
        addNewRuleSetBeanInList(target, destination, eventActionsRuleSetBean);
    }
}
Also used : RuleActionBean(org.akaza.openclinica.domain.rule.action.RuleActionBean) EventActionBean(org.akaza.openclinica.domain.rule.action.EventActionBean) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Aggregations

RuleSetBean (org.akaza.openclinica.domain.rule.RuleSetBean)67 ArrayList (java.util.ArrayList)28 RuleSetRuleBean (org.akaza.openclinica.domain.rule.RuleSetRuleBean)26 ExpressionBean (org.akaza.openclinica.domain.rule.expression.ExpressionBean)19 RuleBean (org.akaza.openclinica.domain.rule.RuleBean)15 HashMap (java.util.HashMap)13 ExpressionObjectWrapper (org.akaza.openclinica.domain.rule.expression.ExpressionObjectWrapper)11 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)9 RuleActionBean (org.akaza.openclinica.domain.rule.action.RuleActionBean)9 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)8 OpenClinicaSystemException (org.akaza.openclinica.exception.OpenClinicaSystemException)7 Map (java.util.Map)6 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)6 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)6 OpenClinicaExpressionParser (org.akaza.openclinica.logic.expressionTree.OpenClinicaExpressionParser)6 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)5 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)5 RulesPostImportContainer (org.akaza.openclinica.domain.rule.RulesPostImportContainer)5 RuleActionRunLogBean (org.akaza.openclinica.domain.rule.action.RuleActionRunLogBean)5 Locale (java.util.Locale)4