@Override public String getSource(final Path path, final RuleModel model) throws SourceGenerationFailedException { try { return new StringBuilder().append(RuleModelDRLPersistenceImpl.getInstance().marshal(model)).toString(); } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } }
@Override public String getSource(final Path path, final RuleModel model) throws SourceGenerationFailedException { try { return new StringBuilder().append(RuleModelDRLPersistenceImpl.getInstance().marshal(model)).toString(); } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } }
@Override public String getSource(final Path path, final RuleModel model) throws SourceGenerationFailedException { try { final String dslr = RuleModelDRLPersistenceImpl.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } }
@Override public String getSource(final Path path, final RuleModel model) throws SourceGenerationFailedException { try { final String dslr = RuleModelDRLPersistenceImpl.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } }
private String toSourceUnexpanded(final Path path, final RuleModel content) { //Wrap RuleModel as we need to control whether the DSLs are expanded. Both DRL and DSLR files should not have //DSLs expanded. In the case of DSLRs we need to explicitly control escaping plain-DRL to prevent attempts //by drools to expand it, by forcing the Model->DRL persistence into believing the model has DSLs. final RuleModelWrapper model = new RuleModelWrapper(content, dslrResourceType.accept(path)); final String source = RuleModelDRLPersistenceImpl.getInstance().marshal(model); return source; }
private String toSourceUnexpanded(final Path path, final RuleModel content) { //Wrap RuleModel as we need to control whether the DSLs are expanded. Both DRL and DSLR files should not have //DSLs expanded. In the case of DSLRs we need to explicitly control escaping plain-DRL to prevent attempts //by drools to expand it, by forcing the Model->DRL persistence into believing the model has DSLs. final RuleModelWrapper model = new RuleModelWrapper(content, dslrResourceType.accept(path)); final String source = RuleModelDRLPersistenceImpl.getInstance().marshal(model); return source; }
@Override public String getSource(final Path path, final TemplateModel model) throws SourceGenerationFailedException { try { if (model == null) { return ""; } else { final String dslr = RuleTemplateModelDRLPersistenceImpl.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } }
@Override public String getSource(final Path path, final TemplateModel model) throws SourceGenerationFailedException { try { if (model == null) { return ""; } else { final String dslr = RuleTemplateModelDRLPersistenceImpl.getInstance().marshal(model); final Expander expander = getDSLExpander(path); final String drl = expander.expand(dslr); return drl; } } catch (Exception e) { throw new SourceGenerationFailedException(e.getMessage()); } }
@Override public ResourceConversionResult loadFromInputStream(InputStream is) throws IOException { String xml = new String(IoUtils.readBytesFromInputStream(is), IoUtils.UTF8_CHARSET); TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(xml); String content = RuleTemplateModelDRLPersistenceImpl.getInstance().marshal(model); if (model.hasDSLSentences()) { return new ResourceConversionResult(content, ResourceType.DSLR); } else { return new ResourceConversionResult(content, ResourceType.DRL); } }
private void checkMarshall(String expected, RuleModel m) { String drl = ruleModelPersistence.marshal(m); assertNotNull(drl); if (expected != null) { assertEqualsIgnoreWhitespace(expected, drl); } }
rm); String drl = RuleModelDRLPersistenceImpl.getInstance().marshal(rm); assertTrue(drl.indexOf("age > \"42\"") > 0);
rm); final String actualRuleModelDrl = RuleModelDRLPersistenceImpl.getInstance().marshal(rm);
rm); final String actualRuleModelDrl = RuleModelDRLPersistenceImpl.getInstance().marshal(rm);
RuleModelDRLPersistenceImpl.getInstance().marshal(model), commentedOptionFactory.makeCommentedOption("File [" + source.toURI() + "] copied to [" + destination.toURI() + "]."));
RuleModelDRLPersistenceImpl.getInstance().marshal(model), commentedOptionFactory.makeCommentedOption("File [" + source.toURI() + "] renamed to [" + destination.toURI() + "]."));
RuleModelDRLPersistenceImpl.getInstance().marshal(model), commentedOptionFactory.makeCommentedOption("File [" + source.toURI() + "] copied to [" + destination.toURI() + "]."));
RuleModelDRLPersistenceImpl.getInstance().marshal(model), commentedOptionFactory.makeCommentedOption("File [" + source.toURI() + "] renamed to [" + destination.toURI() + "]."));