@Test public void testLoadModifyScoreAction() throws Exception { final Path path = getPath("modifyScore.rdrl"); final String ruleFileContent = getFileContent("modifyScore.rdrl"); doReturn(ruleFileContent).when(ioService).readAllString(any()); final RuleModel model = service.load(path); Assertions.assertThat(model.rhs).hasSize(1); final FreeFormLine action = (FreeFormLine) model.rhs[0]; Assertions.assertThat(action.getText()).isEqualTo(MODIFY_SCORE_ACTION); }
@Override public RuleModel load(final Path path) { try { final String drl = ioService.readAllString(Paths.convert(path)); final List<String> globals = utilities.loadGlobalsForPackage(path); final PackageDataModelOracle oracle = dataModelService.getDataModel(path); RuleModel ruleModel = null; if (dslrResourceType.accept(path)) { final String[] dsls = utilities.loadDslsForPackage(path); ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshalUsingDSL(drl, globals, oracle, persistenceExtensions, dsls); } else { ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshal(drl, globals, oracle, persistenceExtensions); } return ruleModel; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }
GuidedRuleEditorServiceImpl extends KieService<GuidedEditorContent> implements GuidedRuleEditorService { @Override public RuleModel load(final Path path) { try { final String drl = ioService.readAllString(Paths.convert(path)); final List<String> globals = utilities.loadGlobalsForPackage(path); final PackageDataModelOracle oracle = dataModelService.getDataModel(path); RuleModel ruleModel = null; if (dslrResourceType.accept(path)) { final String[] dsls = utilities.loadDslsForPackage(path); ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshalUsingDSL(drl, globals, oracle, persistenceExtensions, dsls); } else { ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshal(drl, globals, oracle, persistenceExtensions); } return ruleModel; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } }
GuidedRuleEditorServiceImpl extends KieService<GuidedEditorContent> implements GuidedRuleEditorService { @Override public RuleModel load(final Path path) { try { final String drl = ioService.readAllString(Paths.convert(path)); final List<String> globals = utilities.loadGlobalsForPackage(path); final PackageDataModelOracle oracle = dataModelService.getDataModel(path); RuleModel ruleModel = null; if (dslrResourceType.accept(path)) { final String[] dsls = utilities.loadDslsForPackage(path); ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshalUsingDSL(drl, globals, oracle, persistenceExtensions, dsls); } else { ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshal(drl, globals, oracle, persistenceExtensions); } return ruleModel; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } GuidedRuleEditorServiceImpl(); @Inject  GuidedRuleEditorServiceImpl(final SessionInfo sessionInfo,
                                       final Instance<RuleModelIActionPersistenceExtension> persistenceExtensionInstance); }
GuidedRuleEditorServiceImpl extends KieService<GuidedEditorContent> implements GuidedRuleEditorService { @Override public RuleModel load(final Path path) { try { final String drl = ioService.readAllString(Paths.convert(path)); final List<String> globals = utilities.loadGlobalsForPackage(path); final PackageDataModelOracle oracle = dataModelService.getDataModel(path); RuleModel ruleModel = null; if (dslrResourceType.accept(path)) { final String[] dsls = utilities.loadDslsForPackage(path); ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshalUsingDSL(drl, globals, oracle, persistenceExtensions, dsls); } else { ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshal(drl, globals, oracle, persistenceExtensions); } return ruleModel; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } GuidedRuleEditorServiceImpl(); @Inject  GuidedRuleEditorServiceImpl(final SessionInfo sessionInfo,
                                       final Instance<RuleModelIActionPersistenceExtension> persistenceExtensionInstance); @PostConstruct void init(); @Override Path create(final Path context,
                       final String fileName,
                       final RuleModel model,
                       final String comment); @Override RuleModel load(final Path path); @Override GuidedEditorContent loadContent(final Path path); @Override Path save(final Path resource,
                     final RuleModel model,
                     final Metadata metadata,
                     final String comment); @Override void delete(final Path path,
                       final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final Path targetDirectory,
                     final String comment); @Override String toSource(final Path path,
                           final RuleModel model); @Override List<ValidationMessage> validate(final Path path,
                                            final RuleModel content); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final RuleModel content,
                              final String comment); }
GuidedRuleEditorServiceImpl extends KieService<GuidedEditorContent> implements GuidedRuleEditorService { @Override public RuleModel load(final Path path) { try { final String drl = ioService.readAllString(Paths.convert(path)); final List<String> globals = utilities.loadGlobalsForPackage(path); final PackageDataModelOracle oracle = dataModelService.getDataModel(path); RuleModel ruleModel = null; if (dslrResourceType.accept(path)) { final String[] dsls = utilities.loadDslsForPackage(path); ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshalUsingDSL(drl, globals, oracle, persistenceExtensions, dsls); } else { ruleModel = RuleModelDRLPersistenceImpl.getInstance().unmarshal(drl, globals, oracle, persistenceExtensions); } return ruleModel; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } GuidedRuleEditorServiceImpl(); @Inject  GuidedRuleEditorServiceImpl(final SessionInfo sessionInfo,
                                       final Instance<RuleModelIActionPersistenceExtension> persistenceExtensionInstance); @PostConstruct void init(); @Override Path create(final Path context,
                       final String fileName,
                       final RuleModel model,
                       final String comment); @Override RuleModel load(final Path path); @Override GuidedEditorContent loadContent(final Path path); @Override Path save(final Path resource,
                     final RuleModel model,
                     final Metadata metadata,
                     final String comment); @Override void delete(final Path path,
                       final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final Path targetDirectory,
                     final String comment); @Override String toSource(final Path path,
                           final RuleModel model); @Override List<ValidationMessage> validate(final Path path,
                                            final RuleModel content); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final Metadata metadata,
                              final RuleModel content,
                              final String comment);  }