| | |
| | | import com.smtaiserver.smtaiserver.javaai.jsonflow.core.SMTJsonFlowNodeOnlyOutput;
|
| | | import com.smtaiserver.smtaiserver.javaai.jsonflow.core.SMTJsonFlowScriptJet;
|
| | | import com.smtservlet.util.Json;
|
| | | import com.smtservlet.util.SMTHttpClient;
|
| | | import com.smtservlet.util.SMTJsonWriter;
|
| | | import com.smtservlet.util.SMTStatic;
|
| | |
|
| | |
| | | _execArg._jsonArgs.set(key, value);
|
| | | }
|
| | |
|
| | | public String getGlobalConfig(String key) throws Exception
|
| | | {
|
| | | Object value = SMTAIServerApp.getApp().getGlobalConfig(key, null);
|
| | | if(value == null)
|
| | | return null;
|
| | | |
| | | return SMTStatic.toString(value);
|
| | | }
|
| | | |
| | | public Object queryWeb(NativeObject nvConfig) throws Exception
|
| | | {
|
| | | String url = (String) SMTAIServerApp.getJSValue(nvConfig, "url");
|
| | | String method = (String) SMTAIServerApp.getJSValue(nvConfig, "method", "GET");
|
| | | String resultType = (String) SMTAIServerApp.getJSValue(nvConfig, "result_type", "String");
|
| | | |
| | | String result;
|
| | | if("GET".equalsIgnoreCase(method))
|
| | | {
|
| | | List<String> listArgs = new ArrayList<>();
|
| | | NativeObject nvArgs = (NativeObject) SMTAIServerApp.getJSValue(nvConfig, "args", null);
|
| | | |
| | | if(nvArgs != null)
|
| | | {
|
| | | for(Entry<Object, Object> entry : nvArgs.entrySet())
|
| | | {
|
| | | listArgs.add(SMTStatic.toString(entry.getKey()));
|
| | | listArgs.add(SMTStatic.toString(SMTAIServerApp.unwrapObject(entry.getValue())));
|
| | | }
|
| | | }
|
| | | |
| | | SMTHttpClient web = new SMTHttpClient();
|
| | | result = web.getHttpString(url, listArgs.toArray(new String[1]), null);
|
| | | }
|
| | | else
|
| | | {
|
| | | throw new Exception("unknow web method : " + method);
|
| | | }
|
| | | |
| | | if("String".equalsIgnoreCase(resultType))
|
| | | {
|
| | | return result;
|
| | | }
|
| | | else if("Json".equalsIgnoreCase(resultType))
|
| | | {
|
| | | return SMTAIServerApp.convJsonToJS(Json.read(result));
|
| | | }
|
| | | else
|
| | | {
|
| | | throw new Exception("unknow result type : " + resultType);
|
| | | }
|
| | | }
|
| | | |
| | | public NativeArray getMapLayerList() throws Exception
|
| | | {
|
| | | List<SMTGisMapLayerDef> list = new ArrayList<>();
|