private void saveSemanticTypesInformation(Worksheet worksheet, Workspace workspace , Collection<SemanticType> semanticTypes) throws JSONException { JSONArray typesArray = new JSONArray(); // Add the vworksheet information JSONObject vwIDJObj = new JSONObject(); vwIDJObj.put(ClientJsonKeys.name.name(), ParameterType.worksheetId.name()); vwIDJObj.put(ClientJsonKeys.type.name(), ParameterType.worksheetId.name()); vwIDJObj.put(ClientJsonKeys.value.name(), worksheetId); typesArray.put(vwIDJObj); for (SemanticType type: semanticTypes) { // Add the hNode information JSONObject hNodeJObj = new JSONObject(); hNodeJObj.put(ClientJsonKeys.name.name(), ParameterType.hNodeId.name()); hNodeJObj.put(ClientJsonKeys.type.name(), ParameterType.hNodeId.name()); hNodeJObj.put(ClientJsonKeys.value.name(), type.getHNodeId()); typesArray.put(hNodeJObj); // Add the semantic type information JSONObject typeJObj = new JSONObject(); typeJObj.put(ClientJsonKeys.name.name(), ClientJsonKeys.SemanticType.name()); typeJObj.put(ClientJsonKeys.type.name(), ParameterType.other.name()); typeJObj.put(ClientJsonKeys.value.name(), type.getJSONArrayRepresentation()); typesArray.put(typeJObj); } setInputParameterJson(typesArray.toString()); }
public static JSONObject createJsonObject(String name, Object value, ParameterType type) throws JSONException { JSONObject obj = new JSONObject(); obj.put(ClientJsonKeys.name.name(), name); obj.put(ClientJsonKeys.value.name(), value); obj.put(ClientJsonKeys.type.name(), type.toString()); return obj; } }
JSONObject t = new JSONObject(); t.put("name", "worksheetId"); t.put("type", HistoryJsonUtil.ParameterType.worksheetId.name()); t.put("value", worksheetId); inputJSON.put(t); t = new JSONObject(); t.put("name", "initialEdges"); t.put("type", HistoryJsonUtil.ParameterType.other.name()); t.put("value", initialEdges); inputJSON.put(t); t = new JSONObject(); t.put("name", "newEdges"); t.put("type", HistoryJsonUtil.ParameterType.other.name()); t.put("value", newEdges); inputJSON.put(t);
obj.put(ClientJsonKeys.name.name(), "inputColumns"); obj.put(ClientJsonKeys.value.name(), inputArray.toString()); obj.put(ClientJsonKeys.type.name(), ParameterType.hNodeIdList.name()); inputArr.put(obj); obj.put(ClientJsonKeys.name.name(), "outputColumns"); obj.put(ClientJsonKeys.value.name(), outputArray.toString()); obj.put(ClientJsonKeys.type.name(), ParameterType.hNodeIdList.name()); inputArr.put(obj);
private void saveSemanticTypesInformation(Worksheet worksheet, Workspace workspace , Collection<SemanticType> semanticTypes) throws JSONException { JSONArray typesArray = new JSONArray(); // Add the vworksheet information JSONObject vwIDJObj = new JSONObject(); vwIDJObj.put(ClientJsonKeys.name.name(), ParameterType.worksheetId.name()); vwIDJObj.put(ClientJsonKeys.type.name(), ParameterType.worksheetId.name()); vwIDJObj.put(ClientJsonKeys.value.name(), worksheetId); typesArray.put(vwIDJObj); for (SemanticType type: semanticTypes) { // Add the hNode information JSONObject hNodeJObj = new JSONObject(); hNodeJObj.put(ClientJsonKeys.name.name(), ParameterType.hNodeId.name()); hNodeJObj.put(ClientJsonKeys.type.name(), ParameterType.hNodeId.name()); hNodeJObj.put(ClientJsonKeys.value.name(), type.getHNodeId()); typesArray.put(hNodeJObj); // Add the semantic type information JSONObject typeJObj = new JSONObject(); typeJObj.put(ClientJsonKeys.name.name(), ClientJsonKeys.SemanticType.name()); typeJObj.put(ClientJsonKeys.type.name(), ParameterType.other.name()); typeJObj.put(ClientJsonKeys.value.name(), type.getJSONArrayRepresentation()); typesArray.put(typeJObj); } setInputParameterJson(typesArray.toString(4)); }
public static ParameterType getParameterType(JSONObject json) throws JSONException { return ParameterType.valueOf(json.getString(ClientJsonKeys.type.name())); }