use of org.drools.compiler.compiler.ResourceConversionResult in project drools by kiegroup.
the class GuidedRuleTemplateProviderImpl method loadFromInputStream.
@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);
}
}
use of org.drools.compiler.compiler.ResourceConversionResult in project drools by kiegroup.
the class KnowledgeBuilderImpl method guidedDecisionTableToPackageDescr.
PackageDescr guidedDecisionTableToPackageDescr(Resource resource) throws DroolsParserException, IOException {
GuidedDecisionTableProvider guidedDecisionTableProvider = GuidedDecisionTableFactory.getGuidedDecisionTableProvider();
ResourceConversionResult conversionResult = guidedDecisionTableProvider.loadFromInputStream(resource.getInputStream());
return conversionResultToPackageDescr(resource, conversionResult);
}
use of org.drools.compiler.compiler.ResourceConversionResult in project drools by kiegroup.
the class KnowledgeBuilderImpl method templateToPackageDescr.
PackageDescr templateToPackageDescr(Resource resource) throws DroolsParserException, IOException {
GuidedRuleTemplateProvider guidedRuleTemplateProvider = GuidedRuleTemplateFactory.getGuidedRuleTemplateProvider();
ResourceConversionResult conversionResult = guidedRuleTemplateProvider.loadFromInputStream(resource.getInputStream());
return conversionResultToPackageDescr(resource, conversionResult);
}
use of org.drools.compiler.compiler.ResourceConversionResult in project drools by kiegroup.
the class GuidedDecisionTableProviderImpl method loadFromInputStream.
@Override
public ResourceConversionResult loadFromInputStream(InputStream is) throws IOException {
String xml = new String(IoUtils.readBytesFromInputStream(is), IoUtils.UTF8_CHARSET);
GuidedDecisionTable52 model = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
String content = GuidedDTDRLPersistence.getInstance().marshal(model);
if (hasDSLSentences(model)) {
return new ResourceConversionResult(content, ResourceType.DSLR);
} else {
return new ResourceConversionResult(content, ResourceType.DRL);
}
}
Aggregations