CTLE-433: updates to support extensiv integration

This commit is contained in:
Tim Chamberlain
2023-05-17 20:57:03 -05:00
parent 0b996ef008
commit 7e1a7c7fd7
4 changed files with 60 additions and 101 deletions

View File

@ -73,6 +73,7 @@ import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
@ -103,6 +104,11 @@ public class BaseAPIActionUtil
public enum UpdateHttpMethod
{PUT, POST}
/*******************************************************************************
**
*******************************************************************************/
@ -321,8 +327,9 @@ public class BaseAPIActionUtil
{
try
{
String url = buildTableUrl(table);
HttpPut request = new HttpPut(url);
String paramString = buildQueryStringForUpdate(table, recordList);
String url = buildTableUrl(table) + paramString;
HttpEntityEnclosingRequestBase request = getUpdateMethod().equals(UpdateHttpMethod.PUT) ? new HttpPut(url) : new HttpPost(url);
request.setEntity(recordsToEntity(table, recordList));
QHttpResponse response = makeRequest(table, request);
@ -537,13 +544,23 @@ public class BaseAPIActionUtil
/*******************************************************************************
** method to build up a query string for updates based on a given QFilter object
**
*******************************************************************************/
protected String buildQueryStringForUpdate(QTableMetaData table, List<QRecord> recordList) throws QException
{
return ("");
}
/*******************************************************************************
** method to build up a query string based on a given QFilter object
**
*******************************************************************************/
protected String buildQueryStringForGet(QQueryFilter filter, Integer limit, Integer skip, Map<String, QFieldMetaData> fields) throws QException
{
// todo: reasonable default action
return ("");
}
@ -1148,4 +1165,14 @@ public class BaseAPIActionUtil
{
return (20);
}
/*******************************************************************************
**
*******************************************************************************/
protected UpdateHttpMethod getUpdateMethod()
{
return (UpdateHttpMethod.PUT);
}
}