本文整理汇总了Java中org.kie.api.command.KieCommands.newBatchExecution方法的典型用法代码示例。如果您正苦于以下问题:Java KieCommands.newBatchExecution方法的具体用法?Java KieCommands.newBatchExecution怎么用?Java KieCommands.newBatchExecution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kie.api.command.KieCommands
的用法示例。
在下文中一共展示了KieCommands.newBatchExecution方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeCommands
import org.kie.api.command.KieCommands; //导入方法依赖的package包/类
@Test
public void executeCommands() {
System.out.println("== Sending commands to the server ==");
RuleServicesClient rulesClient = kieServicesClient
.getServicesClient(RuleServicesClient.class);
KieCommands commandsFactory = KieServices.Factory.get().getCommands();
Command<?> insert = commandsFactory.newInsert("Some String OBJ");
Command<?> fireAllRules = commandsFactory.newFireAllRules();
Command<?> batchCommand = commandsFactory.newBatchExecution(Arrays
.asList(insert, fireAllRules));
ServiceResponse<ExecutionResults> executeResponse = rulesClient
.executeCommandsWithResults(RULES_CONTAINER, batchCommand);
if (executeResponse.getType() == ResponseType.SUCCESS) {
System.out.println("Commands executed with success! Response: ");
System.out.println(executeResponse.getResult());
} else {
System.out.println("Error executing rules. Message: ");
System.out.println(executeResponse.getMsg());
}
}
示例2: executeCommands
import org.kie.api.command.KieCommands; //导入方法依赖的package包/类
@Test
public void executeCommands() {
System.out.println("== Sending commands to the server ==");
RuleServicesClient rulesClient = kieServicesClient
.getServicesClient(RuleServicesClient.class);
KieCommands commandsFactory = KieServices.Factory.get().getCommands();
Command<?> insert = commandsFactory.newInsert("Some String OBJ");
Command<?> fireAllRules = commandsFactory.newFireAllRules();
Command<?> batchCommand = commandsFactory.newBatchExecution(Arrays
.asList(insert, fireAllRules));
ServiceResponse<ExecutionResults> executeResponse = rulesClient.executeCommandsWithResults(RULES_CONTAINER, batchCommand);
if (executeResponse.getType() == ResponseType.SUCCESS) {
System.out.println("Commands executed with success! Response: ");
System.out.println(executeResponse.getResult());
} else {
System.out.println("Error executing rules. Message: ");
System.out.println(executeResponse.getMsg());
}
}
示例3: createRandomCommand
import org.kie.api.command.KieCommands; //导入方法依赖的package包/类
public BatchExecutionCommand createRandomCommand() {
Person person = new Person();
String name = NAMES[random.nextInt(NAMES.length)];
person.setName(name);
List<Command<?>> cmds = new ArrayList<Command<?>>();
KieCommands commands = KieServices.Factory.get().getCommands();
cmds.add(commands.newInsert(person));
cmds.add(commands.newFireAllRules());
cmds.add(commands.newQuery("greetings", "get greeting"));
BatchExecutionCommand command = commands.newBatchExecution(cmds, "HelloRulesSession");
return command;
}
示例4: executeCommands
import org.kie.api.command.KieCommands; //导入方法依赖的package包/类
@Test
public void executeCommands() {
System.out.println("== Sending commands to the server ==");
RuleServicesClient rulesClient = kieServicesClient
.getServicesClient(RuleServicesClient.class);
KieCommands commandsFactory = KieServices.Factory.get().getCommands();
Command<?> insert = commandsFactory.newInsert("Some String OBJ");
Command<?> fireAllRules = commandsFactory.newFireAllRules();
Command<?> batchCommand = commandsFactory.newBatchExecution(Arrays
.asList(insert, fireAllRules));
ServiceResponse<String> executeResponse = rulesClient.executeCommands(RULES_CONTAINER, batchCommand);
if (executeResponse.getType() == ResponseType.SUCCESS) {
System.out.println("Commands executed with success! Response: ");
System.out.println(executeResponse.getResult());
} else {
System.out.println("Error executing rules. Message: ");
System.out.println(executeResponse.getMsg());
}
}
示例5: insertAndFireAll
import org.kie.api.command.KieCommands; //导入方法依赖的package包/类
public void insertAndFireAll(Exchange exchange) {
final Message in = exchange.getIn();
final Object body = in.getBody();
final KieCommands kieCommands = KieServices.Factory.get().getCommands();
final List<Command> commands = new ArrayList<Command>();
// since KIE commands are JAXB-annotated, the body has to be JAXB annotated class as well
commands.add(kieCommands.newInsert(body, "person"));
commands.add(kieCommands.newFireAllRules());
BatchExecutionCommand command = kieCommands.newBatchExecution(commands);
in.setBody(command);
}