本文整理了Java中org.kie.api.definition.rule.Rule.getMetaData
方法的一些代码示例,展示了Rule.getMetaData
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rule.getMetaData
方法的具体详情如下:
包路径:org.kie.api.definition.rule.Rule
类名称:Rule
方法名:getMetaData
[英]Returns an immutable Map<String key, Object value> of all meta data attributes associated with this rule object.
[中]返回与此规则对象关联的所有元数据属性的不可变映射<String key,Object value>。
代码示例来源:origin: org.drools/knowledge-api
public Map<String, Object> getMetaData() {
return delegate.getMetaData();
}
代码示例来源:origin: deepu105/drools-demo
@Override
public void afterMatchFired(AfterMatchFiredEvent event) {
Rule rule = event.getMatch().getRule();
String ruleName = rule.getName();
Map<String, Object> ruleMetaDataMap = rule.getMetaData();
activationList.add(new Activation(ruleName));
StringBuilder sb = new StringBuilder("Rule fired: " + ruleName);
if (ruleMetaDataMap.size() > 0) {
sb.append("\n With [" + ruleMetaDataMap.size() + "] meta-data:");
for (String key : ruleMetaDataMap.keySet()) {
sb.append("\n key=" + key + ", value="
+ ruleMetaDataMap.get(key));
}
}
log.debug(sb.toString());
}
代码示例来源:origin: gratiartis/qzr
@Override
public void afterMatchFired(AfterMatchFiredEvent event) {
Rule rule = event.getMatch().getRule();
String ruleName = rule.getName();
Map<String, Object> ruleMetaDataMap = rule.getMetaData();
addActivation(new Activation(ruleName));
StringBuilder sb = new StringBuilder("Rule fired: " + ruleName);
if (ruleMetaDataMap.size() > 0) {
sb.append("\n With [" + ruleMetaDataMap.size() + "] meta-data:");
for (String key : ruleMetaDataMap.keySet()) {
sb.append("\n key=" + key + ", value="
+ ruleMetaDataMap.get(key));
}
}
log.debug(sb.toString());
}
代码示例来源:origin: stackoverflow.com
Map<String, Object> ruleMetaDataMap = rule.getMetaData();
代码示例来源:origin: org.drools/drools-reteoo
@Test
public void testRuleMetaAttributes() throws Exception {
String drl = "";
drl += "package test\n";
drl += "rule \"test meta attributes\"\n";
drl += " @id(1234 ) @author( john_doe ) @text(\"It's an escaped\\\" string\" )\n";
drl += "when\n";
drl += "then\n";
drl += " // some comment\n";
drl += "end\n";
KnowledgeBase kbase = loadKnowledgeBaseFromString( drl );
Rule rule = kbase.getRule( "test", "test meta attributes" );
assertNotNull( rule );
assertThat( (Integer) rule.getMetaData().get( "id" ),
is( 1234 ) );
assertThat( (String) rule.getMetaData().get( "author" ),
is( "john_doe" ) );
assertThat( (String) rule.getMetaData().get( "text" ),
is( "It's an escaped\" string" ) );
}
代码示例来源:origin: org.drools/drools-pmml
public void checkGeneratedRules( String pack ) {
for ( Rule r : getKbase().getKiePackage( pack ).getRules() ) {
assertTrue( r.getMetaData().containsKey( "Generated" ) );
}
}
代码示例来源:origin: org.drools/kie-pmml
public void checkGeneratedRules(String pack) {
for (Rule r : getKbase().getKiePackage(pack).getRules()) {
assertTrue(r.getMetaData().containsKey("Generated"));
}
}
代码示例来源:origin: org.drools/drools-reteoo
rule.getMetaData().get( "author" ) );
Assert.assertEquals( "Hello World!",
rule.getMetaData().get( "output" ) );
Assert.assertEquals( 20,
((Number)rule.getMetaData().get( "value" )).intValue() );
Assert.assertEquals( "Hello World!",
rule.getMetaData().get( "alt" ) );
代码示例来源:origin: org.drools/drools-reteoo
@Test
public void testRuleAnnotation2() {
String drl = "package org.drools.compiler.integrationtests\n" +
"import " + Person.class.getCanonicalName() + "; \n" +
"rule X\n" +
" @alt(\" \\\"<- these are supposed to be the only quotes ->\\\" \")\n" +
"when\n"+
" Person()\n" +
"then\n" +
"end";
KieBaseConfiguration conf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
conf.setOption( EventProcessingOption.STREAM );
conf.setOption( MBeansOption.ENABLED );
KnowledgeBase kbase = loadKnowledgeBase( "kb1",
drl,
conf );
Rule rule = kbase.getRule( "org.drools.compiler.integrationtests",
"X" );
Assert.assertEquals( " \"<- these are supposed to be the only quotes ->\" ",
rule.getMetaData().get( "alt" ) );
}
内容来源于网络,如有侵权,请联系作者删除!