@Test public void fieldConstraintWithActionBRLFragmentFieldWithoutTemplateKey() { final GuidedDecisionTable52 dt1 = new GuidedDecisionTable52(); final BRLActionColumn brl = new BRLActionColumn(); final ActionInsertFact aif = new ActionInsertFact(); aif.setFactType("Fact"); aif.addFieldValue(new ActionFieldValue() {{ setField("field"); setValue("10"); setNature(FieldNatureType.TYPE_LITERAL); }}); brl.setDefinition(new ArrayList<IAction>() {{ add(aif); }}); brl.getChildColumns().add(new BRLActionVariableColumn("", DataType.TYPE_BOOLEAN)); dt1.getActionCols().add(brl); final GuidedDecisionTable52 dt2 = new GuidedDecisionTable52(); final Pattern52 p2 = new Pattern52(); p2.setBoundName("$f"); p2.setFactType("Fact"); final ConditionCol52 p2c1 = new ConditionCol52(); p2c1.setFactField("field"); p2.getChildColumns().add(p2c1); dt2.getConditions().add(p2); manager.link(dt1, dt2, (s, t) -> { assertEquals(3, s); assertEquals(3, t); }); }
@Override public void link(final GuidedDecisionTable52 model, final GuidedDecisionTable52 otherModel, final LinkFoundCallback callback) { if (model == null) { return; } if (otherModel == null) { return; } if (callback == null) { return; } final BRLRuleModel helper = new BRLRuleModel(model); for (CompositeColumn<? extends BaseColumn> otherDecisionTableConditions : otherModel.getConditions()) { if (otherDecisionTableConditions instanceof Pattern52) { final Pattern52 otherDecisionTablePattern = (Pattern52) otherDecisionTableConditions; for (ConditionCol52 otherDecisionTableCondition : otherDecisionTablePattern.getChildColumns()) { final String factType = otherDecisionTablePattern.getFactType(); final String fieldName = otherDecisionTableCondition.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(otherDecisionTableCondition); callback.link(sourceColumnIndex, targetColumnIndex); } } } else if (otherDecisionTableConditions instanceof BRLConditionColumn) { final BRLConditionColumn fragment = (BRLConditionColumn) otherDecisionTableConditions; for (BRLConditionVariableColumn var : fragment.getChildColumns()) { final String factType = var.getFactType(); final String fieldName = var.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(var); callback.link(sourceColumnIndex, targetColumnIndex); } } } } }
DefaultGuidedDecisionTableLinkManager implements GuidedDecisionTableLinkManager { @Override public void link(final GuidedDecisionTable52 model, final GuidedDecisionTable52 otherModel, final LinkFoundCallback callback) { if (model == null) { return; } if (otherModel == null) { return; } if (callback == null) { return; } final BRLRuleModel helper = new BRLRuleModel(model); for (CompositeColumn<? extends BaseColumn> otherDecisionTableConditions : otherModel.getConditions()) { if (otherDecisionTableConditions instanceof Pattern52) { final Pattern52 otherDecisionTablePattern = (Pattern52) otherDecisionTableConditions; for (ConditionCol52 otherDecisionTableCondition : otherDecisionTablePattern.getChildColumns()) { final String factType = otherDecisionTablePattern.getFactType(); final String fieldName = otherDecisionTableCondition.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(otherDecisionTableCondition); callback.link(sourceColumnIndex, targetColumnIndex); } } } else if (otherDecisionTableConditions instanceof BRLConditionColumn) { final BRLConditionColumn fragment = (BRLConditionColumn) otherDecisionTableConditions; for (BRLConditionVariableColumn var : fragment.getChildColumns()) { final String factType = var.getFactType(); final String fieldName = var.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(var); callback.link(sourceColumnIndex, targetColumnIndex); } } } } } }
DefaultGuidedDecisionTableLinkManager implements GuidedDecisionTableLinkManager { @Override public void link(final GuidedDecisionTable52 model, final GuidedDecisionTable52 otherModel, final LinkFoundCallback callback) { if (model == null) { return; } if (otherModel == null) { return; } if (callback == null) { return; } final BRLRuleModel helper = new BRLRuleModel(model); for (CompositeColumn<? extends BaseColumn> otherDecisionTableConditions : otherModel.getConditions()) { if (otherDecisionTableConditions instanceof Pattern52) { final Pattern52 otherDecisionTablePattern = (Pattern52) otherDecisionTableConditions; for (ConditionCol52 otherDecisionTableCondition : otherDecisionTablePattern.getChildColumns()) { final String factType = otherDecisionTablePattern.getFactType(); final String fieldName = otherDecisionTableCondition.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(otherDecisionTableCondition); callback.link(sourceColumnIndex, targetColumnIndex); } } } else if (otherDecisionTableConditions instanceof BRLConditionColumn) { final BRLConditionColumn fragment = (BRLConditionColumn) otherDecisionTableConditions; for (BRLConditionVariableColumn var : fragment.getChildColumns()) { final String factType = var.getFactType(); final String fieldName = var.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(var); callback.link(sourceColumnIndex, targetColumnIndex); } } } } }  }
DefaultGuidedDecisionTableLinkManager implements GuidedDecisionTableLinkManager { @Override public void link(final GuidedDecisionTable52 model, final GuidedDecisionTable52 otherModel, final LinkFoundCallback callback) { if (model == null) { return; } if (otherModel == null) { return; } if (callback == null) { return; } final BRLRuleModel helper = new BRLRuleModel(model); for (CompositeColumn<? extends BaseColumn> otherDecisionTableConditions : otherModel.getConditions()) { if (otherDecisionTableConditions instanceof Pattern52) { final Pattern52 otherDecisionTablePattern = (Pattern52) otherDecisionTableConditions; for (ConditionCol52 otherDecisionTableCondition : otherDecisionTablePattern.getChildColumns()) { final String factType = otherDecisionTablePattern.getFactType(); final String fieldName = otherDecisionTableCondition.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(otherDecisionTableCondition); callback.link(sourceColumnIndex, targetColumnIndex); } } } else if (otherDecisionTableConditions instanceof BRLConditionColumn) { final BRLConditionColumn fragment = (BRLConditionColumn) otherDecisionTableConditions; for (BRLConditionVariableColumn var : fragment.getChildColumns()) { final String factType = var.getFactType(); final String fieldName = var.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(var); callback.link(sourceColumnIndex, targetColumnIndex); } } } } }  @Override void link(final GuidedDecisionTable52 model,
                     final GuidedDecisionTable52 otherModel,
                     final LinkFoundCallback callback); }
DefaultGuidedDecisionTableLinkManager implements GuidedDecisionTableLinkManager { @Override public void link(final GuidedDecisionTable52 model, final GuidedDecisionTable52 otherModel, final LinkFoundCallback callback) { if (model == null) { return; } if (otherModel == null) { return; } if (callback == null) { return; } final BRLRuleModel helper = new BRLRuleModel(model); for (CompositeColumn<? extends BaseColumn> otherDecisionTableConditions : otherModel.getConditions()) { if (otherDecisionTableConditions instanceof Pattern52) { final Pattern52 otherDecisionTablePattern = (Pattern52) otherDecisionTableConditions; for (ConditionCol52 otherDecisionTableCondition : otherDecisionTablePattern.getChildColumns()) { final String factType = otherDecisionTablePattern.getFactType(); final String fieldName = otherDecisionTableCondition.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(otherDecisionTableCondition); callback.link(sourceColumnIndex, targetColumnIndex); } } } else if (otherDecisionTableConditions instanceof BRLConditionColumn) { final BRLConditionColumn fragment = (BRLConditionColumn) otherDecisionTableConditions; for (BRLConditionVariableColumn var : fragment.getChildColumns()) { final String factType = var.getFactType(); final String fieldName = var.getFactField(); final ActionCol52 linkedActionColumn = getLinkedActionColumn(factType, fieldName, model, helper); if (linkedActionColumn != null) { final int sourceColumnIndex = model.getExpandedColumns().indexOf(linkedActionColumn); final int targetColumnIndex = otherModel.getExpandedColumns().indexOf(var); callback.link(sourceColumnIndex, targetColumnIndex); } } } } }  @Override void link(final GuidedDecisionTable52 model,
                     final GuidedDecisionTable52 otherModel,
                     final LinkFoundCallback callback);  }