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;
}
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);
}
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;
}
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);
}
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);
}
}
Aggregations