当前位置: 首页>>代码示例>>Java>>正文


Java ServiceResponse.getType方法代码示例

本文整理汇总了Java中org.kie.server.api.model.ServiceResponse.getType方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceResponse.getType方法的具体用法?Java ServiceResponse.getType怎么用?Java ServiceResponse.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kie.server.api.model.ServiceResponse的用法示例。


在下文中一共展示了ServiceResponse.getType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getModels

import org.kie.server.api.model.ServiceResponse; //导入方法依赖的package包/类
@GET
@Path(KieMLConstants.URI_GET_MODELS)
public Response getModels(@PathParam(CONTAINER_ID) String containerId) {
	Response response;
	try {
		ServiceResponse<ModelList> result = kieMLServicesBase.getModels(containerId);
		if (result.getType() == ServiceResponse.ResponseType.SUCCESS) {
			response = Response.ok(result).build();
		} else {
			response = Response.status(Status.NOT_FOUND).build();
		}
	} catch (Exception e) {
		logger.warn("Unexpected error retrieving Model List. Message: '{}'", e.getMessage(), e);
		response = Response.serverError().type("text/plain").entity("Error retrieving model list: " + e.getMessage()).build();
	}
	return response;
}
 
开发者ID:jesuino,项目名称:kie-ml,代码行数:18,代码来源:KieMLResource.java

示例2: getModel

import org.kie.server.api.model.ServiceResponse; //导入方法依赖的package包/类
@GET
@Path(KieMLConstants.URI_GET_MODEL)
public Response getModel(@PathParam(CONTAINER_ID) String containerId, @PathParam(KieMLConstants.PARAM_MODEL_ID) String modelId) {
	Response response;
	try {
		ServiceResponse<Model> result = kieMLServicesBase.getModel(containerId, modelId);
		if (result.getType() == ServiceResponse.ResponseType.SUCCESS) {
			response=  Response.ok(result).build();
		} else {
			response = Response.status(Status.NOT_FOUND).build();
		}
	} catch (Exception e) {
		logger.warn("Unexpected error Model. Message: '{}'", e.getMessage(), e);
		response = Response.serverError().type("text/plain").entity("Unexpected error Model: " + e.getMessage()).build();
	}
	return response;
}
 
开发者ID:jesuino,项目名称:kie-ml,代码行数:18,代码来源:KieMLResource.java

示例3: executeCommands

import org.kie.server.api.model.ServiceResponse; //导入方法依赖的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

示例4: executeCommands

import org.kie.server.api.model.ServiceResponse; //导入方法依赖的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

示例5: listCapabilities

import org.kie.server.api.model.ServiceResponse; //导入方法依赖的package包/类
@Test
public void listCapabilities() {
	ServiceResponse<KieServerInfo> r = kieServicesClient.getServerInfo();
	r.getType();
	KieServerInfo serverInfo = kieServicesClient.getServerInfo()
			.getResult();
	System.out.println("== Server capabilities: ==");
	for (String capability : serverInfo.getCapabilities()) {
		System.out.print(" " + capability);
	}
	System.out.println();
}
 
开发者ID:jesuino,项目名称:bpms6-examples,代码行数:13,代码来源:DecisionServerTest.java

示例6: disposeAndCreateContainer

import org.kie.server.api.model.ServiceResponse; //导入方法依赖的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

示例7: executeCommands

import org.kie.server.api.model.ServiceResponse; //导入方法依赖的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


注:本文中的org.kie.server.api.model.ServiceResponse.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。