當前位置: 首頁>>代碼示例>>Java>>正文


Java ResponseType類代碼示例

本文整理匯總了Java中org.kie.server.api.model.ServiceResponse.ResponseType的典型用法代碼示例。如果您正苦於以下問題:Java ResponseType類的具體用法?Java ResponseType怎麽用?Java ResponseType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ResponseType類屬於org.kie.server.api.model.ServiceResponse包,在下文中一共展示了ResponseType類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: executeCommands

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的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());
	}
}
 
開發者ID:jesuino,項目名稱:bpms6-examples,代碼行數:21,代碼來源:DecisionServerJMSTest.java

示例2: executeCommands

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的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());
	}
}
 
開發者ID:jesuino,項目名稱:bpms6-examples,代碼行數:20,代碼來源:DecisionServerTest.java

示例3: listContainers

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的package包/類
public ServiceResponse<KieContainerResourceList> listContainers() {
	List<KieContainerResource> containersList = containers.keySet().stream()
					.map(context::getContainer)
					.map(KieContainerInstance::getResource)
					.collect(Collectors.toList());
	KieContainerResourceList list = new KieContainerResourceList(containersList);
	return new ServiceResponse<KieContainerResourceList>(ResponseType.SUCCESS, "Containers using KieML extension", list);
}
 
開發者ID:jesuino,項目名稱:kie-ml,代碼行數:9,代碼來源:KieMLServicesBase.java

示例4: execute

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的package包/類
public Object execute(Command command, String containerId) {
	BatchExecutionHelperProviderImpl batchExecutionHelperProviderImpl = new BatchExecutionHelperProviderImpl();
	XStream xstream = batchExecutionHelperProviderImpl
			.newXStreamMarshaller();
	String payload = xstream.toXML(command);
	LOG.debug("payload=" + payload);
	ServiceResponse<String> serviceResponse = kieServicesClient
			.executeCommands(containerId, payload);
	if (serviceResponse.getType().equals(ResponseType.FAILURE)) {
		throw new RuntimeException(serviceResponse.getMsg());
	}
	String response = serviceResponse.getResult();
	LOG.debug("response=" + response);
	return xstream.fromXML(response);
}
 
開發者ID:anurag-saran,項目名稱:drools-usage-patterns,代碼行數:16,代碼來源:RemoteCommandExecutor.java

示例5: disposeAndCreateContainer

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的package包/類
@Test
public void disposeAndCreateContainer() {
	System.out.println("== Disposing and creating containers ==");
	List<KieContainerResource> kieContainers = kieServicesClient
			.listContainers().getResult().getContainers();
	if (kieContainers.size() == 0) {
		System.out.println("No containers available...");
		return;
	}
	KieContainerResource container = kieContainers.get(0);
	String containerId = container.getContainerId();
	ServiceResponse<Void> responseDispose = kieServicesClient
			.disposeContainer(containerId);
	if (responseDispose.getType() == ResponseType.FAILURE) {
		System.out
				.println("Error disposing " + containerId + ". Message: ");
		System.out.println(responseDispose.getMsg());
		return;
	}
	System.out.println("Success Disposing container " + containerId);
	System.out.println("Trying to recreate the container...");
	ServiceResponse<KieContainerResource> createResponse = kieServicesClient
			.createContainer(containerId, container);
	if (createResponse.getType() == ResponseType.FAILURE) {
		System.out.println("Error creating " + containerId + ". Message: ");
		System.out.println(responseDispose.getMsg());
		return;
	}
	System.out.println("Container recreated with success!");
}
 
開發者ID:jesuino,項目名稱:bpms6-examples,代碼行數:31,代碼來源:DecisionServerTest.java

示例6: executeCommands

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的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());
	}
}
 
開發者ID:jesuino,項目名稱:bpms6-examples,代碼行數:20,代碼來源:DecisionServerTest.java

示例7: getModels

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的package包/類
public ServiceResponse<ModelList> getModels(String containerId) {
	checkContainer(containerId);
	return new ServiceResponse<ModelList>(ResponseType.SUCCESS, "Model List",
			containers.get(containerId).modelsList());
}
 
開發者ID:jesuino,項目名稱:kie-ml,代碼行數:6,代碼來源:KieMLServicesBase.java

示例8: getModel

import org.kie.server.api.model.ServiceResponse.ResponseType; //導入依賴的package包/類
public ServiceResponse<Model> getModel(String containerId, String modelId) {
	checkContainer(containerId);
	return containers.get(containerId).modelsList().getModels().stream().filter(m -> m.getId().equals(modelId))
			.map(m -> new ServiceResponse<Model>(ResponseType.SUCCESS, "Found model", m)).findFirst()
			.orElse(new ServiceResponse<Model>(ResponseType.FAILURE, "Model Not found: " + modelId));
}
 
開發者ID:jesuino,項目名稱:kie-ml,代碼行數:7,代碼來源:KieMLServicesBase.java


注:本文中的org.kie.server.api.model.ServiceResponse.ResponseType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。