@Test public void testFormulaFieldBinding() throws Exception { final ConditionCol52 ageEqualToFormulaCondition = new ConditionCol52(); ageEqualToFormulaCondition.setConstraintValueType(BaseSingleFieldConstraint.TYPE_RET_VALUE); ageEqualToFormulaCondition.setHeader("age equals to"); ageEqualToFormulaCondition.setFactField("age"); ageEqualToFormulaCondition.setOperator("=="); ageEqualToFormulaCondition.setBinding("$age"); pattern.setChildColumns(Arrays.asList(ageEqualToFormulaCondition)); model.setConditionPatterns(Arrays.asList(pattern)); addRow(1, "1 + 1"); model.setData(data); final String source = service.getSource(path, model); assertTrue(source.contains("$p : Person( $age : age == ( 1 + 1 ) )")); }
@Override public String getSource(final Path path, final GuidedDecisionTable52 model) throws SourceGenerationFailedException { try { final String dslr = GuidedDTDRLPersistence.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } }
GuidedDecisionTableSourceService extends BaseSourceService<GuidedDecisionTable52> { @Override public String getSource(final Path path, final GuidedDecisionTable52 model) throws SourceGenerationFailedException { try { final String dslr = GuidedDTDRLPersistence.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } } }
GuidedDecisionTableSourceService extends BaseSourceService<GuidedDecisionTable52> { @Override public String getSource(final Path path, final GuidedDecisionTable52 model) throws SourceGenerationFailedException { try { final String dslr = GuidedDTDRLPersistence.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } } @Inject  GuidedDecisionTableSourceService(final GuidedDTableResourceTypeDefinition resourceType,
                                            final GuidedDecisionTableEditorService guidedDecisionTableEditorService,
                                            final @Named("ioStrategy") IOService ioService,
                                            final FileDiscoveryService fileDiscoveryService,
                                            final KieModuleService moduleService); }
GuidedDecisionTableSourceService extends BaseSourceService<GuidedDecisionTable52> { @Override public String getSource(final Path path, final GuidedDecisionTable52 model) throws SourceGenerationFailedException { try { final String dslr = GuidedDTDRLPersistence.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } } @Inject  GuidedDecisionTableSourceService(final GuidedDTableResourceTypeDefinition resourceType,
                                            final GuidedDecisionTableEditorService guidedDecisionTableEditorService,
                                            final @Named("ioStrategy") IOService ioService,
                                            final FileDiscoveryService fileDiscoveryService,
                                            final KieModuleService moduleService); @Override String getPattern(); @Override String getSource(final Path path,
                            final GuidedDecisionTable52 model); @Override String getSource(final Path path); }
GuidedDecisionTableSourceService extends BaseSourceService<GuidedDecisionTable52> { @Override public String getSource(final Path path, final GuidedDecisionTable52 model) throws SourceGenerationFailedException { try { final String dslr = GuidedDTDRLPersistence.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } } @Inject  GuidedDecisionTableSourceService(final GuidedDTableResourceTypeDefinition resourceType,
                                            final GuidedDecisionTableEditorService guidedDecisionTableEditorService,
                                            final @Named("ioStrategy") IOService ioService,
                                            final FileDiscoveryService fileDiscoveryService,
                                            final KieModuleService moduleService); @Override String getPattern(); @Override String getSource(final Path path,
                            final GuidedDecisionTable52 model); @Override String getSource(final Path path);  }