本文整理汇总了Java中org.kie.api.builder.Results类的典型用法代码示例。如果您正苦于以下问题:Java Results类的具体用法?Java Results怎么用?Java Results使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Results类属于org.kie.api.builder包,在下文中一共展示了Results类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: logResults
import org.kie.api.builder.Results; //导入依赖的package包/类
public static void logResults(Results results) {
for (Message result : results.getMessages()) {
switch (result.getLevel()) {
case ERROR:
LOGGER.error(result.toString());
break;
case WARNING:
LOGGER.warn(result.toString());
break;
case INFO:
LOGGER.info(result.toString());
break;
default:
LOGGER.warn(result.toString());
}
}
}
开发者ID:redhat-italy,项目名称:hacep,代码行数:18,代码来源:KieSessionUtils.java
示例2: updateToVersion
import org.kie.api.builder.Results; //导入依赖的package包/类
public boolean updateToVersion(String version) {
checkStatus();
if (StringUtils.isEmpty(version)) {
throw new IllegalArgumentException("Update to version cannot accept an empty version");
}
ReleaseId releaseId = kieServices.newReleaseId(
rulesConfiguration.getGroupId(),
rulesConfiguration.getArtifactId(),
version);
Results results = kieContainer.updateToVersion(releaseId);
this.releaseId = kieContainer.getReleaseId();
KieSessionUtils.logResults(results);
if (results.hasMessages(Message.Level.ERROR)) {
LOGGER.error("Update to version {} aborted due to errors", version);
return false;
}
LOGGER.info("Update to version {} completed", version);
return true;
}
开发者ID:redhat-italy,项目名称:hacep,代码行数:20,代码来源:RulesManager.java
示例3: setup
import org.kie.api.builder.Results; //导入依赖的package包/类
@Before
public void setup() {
KieServices kieServices = KieServices.Factory.get();
KieContainer kContainer = kieServices.getKieClasspathContainer();
Results verifyResults = kContainer.verify();
for (Message m : verifyResults.getMessages()) {
LOG.debug("Kie container message: {}", m);
}
KieBase kieBase = kContainer.getKieBase();
LOG.debug("Created kieBase");
for ( KiePackage kp : kieBase.getKiePackages() ) {
for (Rule rule : kp.getRules()) {
LOG.debug("kp " + kp + " rule " + rule.getName());
}
}
session = kieBase.newKieSession();
LOG.info(session.getGlobals().toString());
Logger kieLogger = LoggerFactory.getLogger(this.getClass());
// session.setGlobal("logger",kieLogger);
}
开发者ID:sabre1041,项目名称:iot-ocp,代码行数:25,代码来源:BaseTest.java
示例4: buildSession
import org.kie.api.builder.Results; //导入依赖的package包/类
/**
* Load all .drl files
*
* if a rule does not compile an exception will be thrown indicating the problem
*
* @param path
* @return - session containing all loaded rules
* @throws Exception
*/
public KieSession buildSession() throws Exception {
kieServices = KieServices.Factory.get();
KieRepository kr = kieServices.getRepository();
kfs = kieServices.newKieFileSystem();
if(rules != null){
loadFromList();
}
else{
loadFromFiles();
}
kieBuilder = kieServices.newKieBuilder( kfs ).buildAll();
Results results = kieBuilder.getResults();
if( results.hasMessages( Message.Level.ERROR ) ){
System.out.println( results.getMessages() );
throw new IllegalStateException( results.getMessages() + "" );
}
kieContainer =
kieServices.newKieContainer( kr.getDefaultReleaseId() );
ksession = kieContainer.newKieSession();
ksession.addEventListener(new RuleTracker());
return ksession;
}
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:32,代码来源:Rules.java
示例5: drlSyntaxTest
import org.kie.api.builder.Results; //导入依赖的package包/类
@Test
public void drlSyntaxTest()
{
String str = "";
str += "package org.kie.test\n";
str += "global java.util.List list\n";
str += "rule rule1\n";
str += "when\n";
str += " Integer(intValue > 0)\n";
str += "then\n";
str += " list.add( 1 );\n";
str += "end\n";
str += "\n";
Map<String,String> drls = new HashMap<String,String>();
drls.put("rule1", str);
KieHelper kieHelper = new KieHelper();
for (String ruleId : drls.keySet()) {
kieHelper.addContent(drls.get(ruleId), ResourceType.DRL);
}
Results results = kieHelper.verify();
for (Message message : results.getMessages()) {
log.error(">> Message ({}): {}", message.getLevel(), message.getText());
}
if (results.hasMessages(Message.Level.ERROR)) {
throw new IllegalStateException("There are errors in the KB.");
}
KieSession ksession = kieHelper.build().newKieSession();
}
开发者ID:genny-project,项目名称:rulesservice,代码行数:33,代码来源:KieTest.java
示例6: readFilenamesFromDirectory
import org.kie.api.builder.Results; //导入依赖的package包/类
private Boolean readFilenamesFromDirectory(String rootFilePath) {
Boolean compileOk = true;
final File folder = new File(rootFilePath);
final File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
System.out.println("File " + listOfFiles[i].getName());
try {
String ruleText = getFileAsText(listOfFiles[i]);
KieHelper kieHelper = new KieHelper();
kieHelper.addContent(ruleText, ResourceType.DRL);
Results results = kieHelper.verify();
for (Message message : results.getMessages()) {
log.error(">> Message ({}): {}", message.getLevel(), message.getText());
compileOk = false;
assertTrue("Drools Compile Error in "+listOfFiles[i].getName(),false);
}
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (listOfFiles[i].isDirectory()) {
System.out.println("Directory " + listOfFiles[i].getName());
readFilenamesFromDirectory(rootFilePath+"/"+listOfFiles[i].getName());
}
}
return compileOk;
}
开发者ID:genny-project,项目名称:rulesservice,代码行数:32,代码来源:RuleTest.java
示例7: assertBuildResults
import org.kie.api.builder.Results; //导入依赖的package包/类
private void assertBuildResults(Results results) {
if (results.hasMessages(Message.Level.WARNING, Message.Level.ERROR)) {
List<Message> messages = results.getMessages(Message.Level.WARNING, Message.Level.ERROR);
for (Message message : messages) {
System.out.printf("[%s] - %s[%s,%s]: %s", message.getLevel(), message.getPath(), message.getLine(), message.getColumn(), message.getText());
}
throw new IllegalStateException("Compilation errors were found. Check the logs.");
}
}
开发者ID:Salaboy,项目名称:drools-workshop,代码行数:11,代码来源:PhreakInspector.java
示例8: hasErrors
import org.kie.api.builder.Results; //导入依赖的package包/类
public static void hasErrors(Results results) {
if (results.hasMessages(Message.Level.ERROR)) {
throw new RuntimeException("Build errors\n" + results.toString());
}
}
开发者ID:redhat-italy,项目名称:hacep,代码行数:6,代码来源:KieAPITestUtils.java
示例9: verify
import org.kie.api.builder.Results; //导入依赖的package包/类
@Override
public Results verify() {
return kieContainer.verify();
}
开发者ID:deepu105,项目名称:drools-demo,代码行数:5,代码来源:DefaultKieContainerBean.java
示例10: updateToVersion
import org.kie.api.builder.Results; //导入依赖的package包/类
@Override
public Results updateToVersion(ReleaseId version) {
return kieContainer.updateToVersion(version);
}
开发者ID:deepu105,项目名称:drools-demo,代码行数:5,代码来源:DefaultKieContainerBean.java
注:本文中的org.kie.api.builder.Results类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论