Change to use getTableWrapperObjectName in places it was intended (e.g., within JSON objects), instead of getTablePath(meant for URLs)

This commit is contained in:
2023-04-12 11:20:12 -05:00
parent d009169770
commit 8f6e4144d2

View File

@ -447,11 +447,11 @@ public class BaseAPIActionUtil
} }
else else
{ {
String tablePath = getBackendDetails(table).getTablePath(); String wrapperObjectName = getBackendDetails(table).getTableWrapperObjectName();
jsonObject = JsonUtils.toJSONObject(resultString); jsonObject = JsonUtils.toJSONObject(resultString);
if(jsonObject.has(tablePath)) if(jsonObject.has(wrapperObjectName))
{ {
Object o = jsonObject.get(tablePath); Object o = jsonObject.get(wrapperObjectName);
if(o instanceof JSONArray jsonArray) if(o instanceof JSONArray jsonArray)
{ {
resultList = jsonArray; resultList = jsonArray;
@ -463,7 +463,7 @@ public class BaseAPIActionUtil
} }
else else
{ {
throw (new QException("Unrecognized object until tablePath: " + o)); throw (new QException("Unrecognized object until wrapperObjectName: " + o));
} }
} }
} }
@ -731,11 +731,11 @@ public class BaseAPIActionUtil
JSONObject body = recordToJsonObject(table, record); JSONObject body = recordToJsonObject(table, record);
String json = body.toString(); String json = body.toString();
String tablePath = getBackendDetails(table).getTablePath(); String wrapperObjectName = getBackendDetails(table).getTableWrapperObjectName();
if(tablePath != null) if(wrapperObjectName != null)
{ {
body = new JSONObject(); body = new JSONObject();
body.put(tablePath, new JSONObject(json)); body.put(wrapperObjectName, new JSONObject(json));
json = body.toString(); json = body.toString();
} }
return (new StringEntity(json)); return (new StringEntity(json));
@ -759,12 +759,12 @@ public class BaseAPIActionUtil
entityListJson.put(entityListJson.length(), recordToJsonObject(table, record)); entityListJson.put(entityListJson.length(), recordToJsonObject(table, record));
} }
String json = entityListJson.toString(); String json = entityListJson.toString();
String tablePath = getBackendDetails(table).getTablePath(); String wrapperObjectName = getBackendDetails(table).getTableWrapperObjectName();
if(tablePath != null) if(wrapperObjectName != null)
{ {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put(tablePath, new JSONArray(json)); body.put(wrapperObjectName, new JSONArray(json));
json = body.toString(); json = body.toString();
} }
return (new StringEntity(json)); return (new StringEntity(json));
@ -848,7 +848,7 @@ public class BaseAPIActionUtil
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
protected QHttpResponse makeRequest(QTableMetaData table, HttpRequestBase request) throws QException public QHttpResponse makeRequest(QTableMetaData table, HttpRequestBase request) throws QException
{ {
int sleepMillis = getInitialRateLimitBackoffMillis(); int sleepMillis = getInitialRateLimitBackoffMillis();
int rateLimitsCaught = 0; int rateLimitsCaught = 0;