All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ibizsys.model.engine.cloud.service.client.CloudPortalClient Maven / Gradle / Ivy

The newest version!
package net.ibizsys.model.engine.cloud.service.client;

import java.util.LinkedHashMap;
import java.util.Map;

import net.ibizsys.model.engine.IPSModelEngine;
import net.ibizsys.model.engine.cloud.util.domain.PortalAsyncAction;
import net.ibizsys.model.engine.plugin.PSModelEngineAddinException;
import net.ibizsys.model.engine.service.client.WebClient;

public class CloudPortalClient extends CloudClientBase> implements ICloudPortalClient {

	/*
	 * @RequestMapping(method = RequestMethod.POST, value = "/portal/asyncaction")
	PortalAsyncAction createAsyncAction(@RequestBody PortalAsyncAction action);

	
	@RequestMapping(method = RequestMethod.POST, value = "/portal/asyncaction/{id}/execute")
	PortalAsyncAction executeAsyncAction(@PathVariable("id") String id, @RequestBody PortalAsyncAction action);

	
	@RequestMapping(method = RequestMethod.POST, value = "/portal/asyncaction/{id}/error")
	PortalAsyncAction errorAsyncAction(@PathVariable("id") String id, @RequestBody PortalAsyncAction action);
	
	
	@RequestMapping(method = RequestMethod.POST, value = "/portal/asyncaction/{id}/finish")
	PortalAsyncAction finishAsyncAction(@PathVariable("id") String id, @RequestBody PortalAsyncAction action);
	
	
	@RequestMapping(method = RequestMethod.GET, value = "/portal/asyncaction/{id}")
	PortalAsyncAction getAsyncAction(@PathVariable("id") String id);
	 */
	
	
	

	@Override
	public PortalAsyncAction createAsyncAction(PortalAsyncAction action) {
		try {
			Map uriParams = new LinkedHashMap<>();
			return WebClient.getMapper().convertValue(this.getWebClient(false).post("/portal/asyncaction", uriParams, action).getBody(), PortalAsyncAction.class);
		}
		catch (Throwable ex) {
			throw new PSModelEngineAddinException(this, String.format("建立异步作业发生异常,%1$s", ex.getMessage()), ex);
		}
	}

	@Override
	public PortalAsyncAction executeAsyncAction(String id, PortalAsyncAction action) {
		try {
			Map uriParams = new LinkedHashMap<>();
			uriParams.put("id", id);
			return WebClient.getMapper().convertValue(this.getWebClient(false).post("/portal/asyncaction/{id}/execute", uriParams, action).getBody(), PortalAsyncAction.class);
		}
		catch (Throwable ex) {
			throw new PSModelEngineAddinException(this, String.format("执行异步作业发生异常,%1$s", ex.getMessage()), ex);
		}
	}

	@Override
	public PortalAsyncAction errorAsyncAction(String id, PortalAsyncAction action) {
		try {
			Map uriParams = new LinkedHashMap<>();
			uriParams.put("id", id);
			return WebClient.getMapper().convertValue(this.getWebClient(false).post("/portal/asyncaction/{id}/error", uriParams, action).getBody(), PortalAsyncAction.class);
		}
		catch (Throwable ex) {
			throw new PSModelEngineAddinException(this, String.format("标记异步作业错误发生异常,%1$s", ex.getMessage()), ex);
		}
	}

	@Override
	public PortalAsyncAction finishAsyncAction(String id, PortalAsyncAction action) {
		try {
			Map uriParams = new LinkedHashMap<>();
			uriParams.put("id", id);
			return WebClient.getMapper().convertValue(this.getWebClient(false).post("/portal/asyncaction/{id}/finish", uriParams, action).getBody(), PortalAsyncAction.class);
		}
		catch (Throwable ex) {
			throw new PSModelEngineAddinException(this, String.format("标记异步作业完成发生异常,%1$s", ex.getMessage()), ex);
		}
	}

	@Override
	public PortalAsyncAction getAsyncAction(String id) {
		try {
			Map uriParams = new LinkedHashMap<>();
			uriParams.put("id", id);
			return WebClient.getMapper().convertValue(this.getWebClient(false).get("/portal/asyncaction/{id}", uriParams).getBody(), PortalAsyncAction.class);
		}
		catch (Throwable ex) {
			throw new PSModelEngineAddinException(this, String.format("获取异步作业发生异常,%1$s", ex.getMessage()), ex);
		}
	}

	@Override
	public String getName() {
		return "CloudPortal客户端";
	}

	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy