|
@@ -0,0 +1,27 @@
|
|
|
+package com.sagacloud.route.processors;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.sagacloud.cache.ProPasCache;
|
|
|
+import com.sagacloud.route.InitEnvRoute;
|
|
|
+import com.sagacloud.utils.Const;
|
|
|
+import org.apache.camel.Exchange;
|
|
|
+import org.apache.camel.Processor;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by Xiaoyu on 2018/7/12
|
|
|
+ */
|
|
|
+public class GetPropByPjProcessor implements Processor {
|
|
|
+ @Override
|
|
|
+ public void process(Exchange exchange) throws Exception {
|
|
|
+ String jsonStr = exchange.getIn().getBody(String.class);
|
|
|
+ JSONObject json = JSONObject.parseObject(jsonStr);
|
|
|
+ String projectId = json.getString(Const.HEADER_PROJECT);
|
|
|
+ String secret = ProPasCache.getPjSecret(projectId);
|
|
|
+ JSONObject queryJson = JSONObject.parseObject("{\"criteria\":{\"family\":[]}}");
|
|
|
+
|
|
|
+ exchange.getIn().setBody(queryJson.toString());
|
|
|
+ exchange.getIn().setHeader(Exchange.HTTP_URI, Const.dataPlatform+"/property/relation_query?method=POST");
|
|
|
+ exchange.getIn().setHeader(Exchange.HTTP_QUERY,Const.HEADER_PROJECT + "=" + projectId + "&"+ Const.HEADER_SECRET+ "="+ secret);
|
|
|
+
|
|
|
+ }
|
|
|
+}
|