public String resource_to_string ( base_resource resources [ ] , String id , options option , Boolean warning , String onerror ) { String objecttype = resources [ 0 ] . get_object_type ( ) ; String request = "{" ; if ( ( option != null && option . get_action ( ) != null ) || ( warning != null && warning == true ) || ( ! onerror . equals ( "" ) ) ) { request = request + "\"params\":{" ; if ( option != null ) { if ( option . get_action ( ) != null ) { request = request + "\"action\":\"" + option . get_action ( ) + "\"," ; } } if ( warning != null && warning == true ) { request = request + "\"warning\":\"yes\"," ; } if ( ( ! onerror . equals ( "" ) ) ) { request = request + "\"onerror\":\"" + onerror + "\"" ; } request = request + "}," ; } String sessionid = id ; if ( sessionid != null ) request = request + "\"sessionid\":\"" + sessionid + "\"," ; request = request + "\"" + objecttype + "\":[" ; for ( int i = 0 ; i < resources . length ; i ++ ) { String str = this . resource_to_string ( resources [ i ] ) ; request = request + str + "," ; } request = request + "]}" ; return request ; }
Converts netscaler resources to Json string .