@Override public void onSuccess(UserVerifierDto key) { String jsonConfig = key.getJsonConfiguration(); JSONObject json; //Some verifiers (ex:Trustful) has no jsonConfiguration field if (jsonConfig != null && !jsonConfig.isEmpty()) { json = (JSONObject) JSONParser.parseLenient(jsonConfig); } else { json = new JSONObject(); } json.put("pluginTypeName", new JSONString(key.getPluginTypeName())); json.put("pluginClassName", new JSONString(key.getPluginClassName())); ServletHelper.downloadJsonFile(json.toString(), key.getPluginTypeName() + ".json"); } };
@Override public void onSuccess(LogAppenderDto key) { JSONObject json = (JSONObject) JSONParser.parseLenient(key.getJsonConfiguration()); json.put("minLogSchemaVersion", new JSONNumber(key.getMinLogSchemaVersion())); json.put("maxLogSchemaVersion", new JSONNumber(key.getMaxLogSchemaVersion())); json.put("pluginTypeName", new JSONString(key.getPluginTypeName())); json.put("pluginClassName", new JSONString(key.getPluginClassName())); JSONArray headersStructure = new JSONArray(); for (LogHeaderStructureDto header : key.getHeaderStructure()) { headersStructure.set(headersStructure.size(), new JSONString(header.getValue())); } json.put("headerStructure", headersStructure); ServletHelper.downloadJsonFile(json.toString(), key.getPluginTypeName() + ".json"); } };
@Override public JSONValue serialize(final String value) { if (value == null) { return JSONNull.getInstance(); } return new JSONString(value); }
public JSONObject toJsonObjectInt(boolean copyJsons) { JSONObject result = new JSONObject(); JSONValue stateOut = (this.state == null) ? JSONNull.getInstance() : new JSONString(this.state.name()); result.put("state", stateOut); JSONValue outputOut = (this.output == null) ? JSONNull.getInstance() : new JSONString(this.output); result.put("output", outputOut); return result; }
public JSONArray getJson() { JSONArray json = new JSONArray(); json.set( 0, new JSONString( service ) ); json.set( 1, new JSONString( interfaceChecksum ) ); return json; }
public void addCell( String columnName, String value ) { JSONObject cell = new JSONObject(); cell.put( "column", new JSONString( columnName ) ); cell.put( "value", new JSONString( value ) ); row.set( row.size(), cell ); }
private static JSONObject logRecordAsJsonObject(LogRecord lr) { JSONObject obj = new JSONObject(); obj.put("level", getJsonString(lr.getLevel().toString())); obj.put("loggerName", getJsonString(lr.getLoggerName())); obj.put("msg", getJsonString(lr.getMessage())); obj.put("timestamp", new JSONString("" + lr.getMillis())); obj.put("thrown", throwableAsJsonObject(lr.getThrown())); return obj; }
public JSONArray getJson() { JSONArray json = new JSONArray(); json.set( 0, new JSONString( service ) ); json.set( 1, new JSONString( interfaceChecksum ) ); return json; }
private static JSONValue getAsJSONString(String id) { if (id == null) { return JSONNull.getInstance(); } return new JSONString(id); }
public void addCell( String columnName, String value ) { JSONObject cell = new JSONObject(); cell.put( "column", new JSONString( columnName ) ); cell.put( "value", new JSONString( value ) ); row.set( row.size(), cell ); }
public static JSONValue Field( String fieldName, String operator, JSONValue value ) { JSONObject obj = new JSONObject(); obj.put( "field", new JSONString( fieldName ) ); obj.put( "op", new JSONString( operator ) ); obj.put( "value", value ); return obj; }
public JSONArray getJson() { JSONArray obj = new JSONArray(); obj.set( 0, new JSONString( method ) ); obj.set( 1, params ); return obj; }
@Override public JSONValue serialize(final T value) { if (value == null) { return JSONNull.getInstance(); } return new JSONString(value.toString()); }
public JSONObject toJsonObjectInt(boolean copyJsons) { JSONObject result = new JSONObject(); JSONObject schemasOut = new JSONObject(); this.ensureSchemas(); for (java.util.Map.Entry<String, java.lang.String> entry0 : this.schemas.entrySet()) { java.lang.String schemas_ = entry0.getValue(); JSONValue schemasOut_ = (schemas_ == null) ? JSONNull.getInstance() : new JSONString(schemas_); schemasOut.put(entry0.getKey(), schemasOut_); } result.put("schemas", schemasOut); return result; }
public static JSONValue PointingTable( String pointingTableName, JSONValue subSearch ) { JSONObject obj = new JSONObject(); obj.put( "op", new JSONString( "<-" ) ); obj.put( "pointing_table", new JSONString( pointingTableName ) ); obj.put( "sub", subSearch ); return obj; } }
public JSONArray getJson() { JSONArray obj = new JSONArray(); obj.set( 0, new JSONString( method ) ); obj.set( 1, params ); return obj; }
@Override public JSONValue serialize(final Character value) { if (value == null) { return JSONNull.getInstance(); } return new JSONString(value.toString()); }
public JSONObject toJsonObjectInt(boolean copyJsons) { JSONObject result = new JSONObject(); JSONValue versionOut = (this.version == null) ? JSONNull.getInstance() : new JSONString(this.version); result.put("version", versionOut); JSONValue repositoryOut = (this.repository == null) ? JSONNull.getInstance() : new JSONString(this.repository); result.put("repository", repositoryOut); JSONObject propertiesOut = new JSONObject(); this.ensureProperties(); for (java.util.Map.Entry<String, java.lang.String> entry0 : this.properties.entrySet()) { java.lang.String properties_ = entry0.getValue(); JSONValue propertiesOut_ = (properties_ == null) ? JSONNull.getInstance() : new JSONString(properties_); propertiesOut.put(entry0.getKey(), propertiesOut_); } result.put("properties", propertiesOut); JSONValue artifactIdOut = (this.artifactId == null) ? JSONNull.getInstance() : new JSONString(this.artifactId); result.put("artifactId", artifactIdOut); JSONValue groupIdOut = (this.groupId == null) ? JSONNull.getInstance() : new JSONString(this.groupId); result.put("groupId", groupIdOut); return result; }
@Override public JSONValue getValue() { JSONObject obj = new JSONObject(); obj.put( "op", new JSONString( "->" ) ); obj.put( "field", new JSONString( pointingField ) ); if( pointedTable != null ) obj.put( "pointed_table", new JSONString( pointedTable ) ); if( pointedField != null ) obj.put( "pointed_field", new JSONString( pointedField ) ); obj.put( "sub", inst.getValue() ); return obj; }
/** * Convert a list of strings to JSON * * @param yamlStringList the List of Strings you want to convert to JSON * @return JSONArray of yamlPreferences */ private JSONArray prefListToJsonArray(List<String> yamlStringList) { JSONArray yamlPreferenceJsonArr = new JSONArray(); for (int arrNum = 0; arrNum < yamlStringList.size(); arrNum++) { yamlPreferenceJsonArr.set(arrNum, new JSONString(yamlStringList.get(arrNum))); } return yamlPreferenceJsonArr; }