Skip to content

Commit 3f28b63

Browse files
fix4
1 parent ea4bd9b commit 3f28b63

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/main/java/io/cdap/plugin/servicenow/apiclient/ServiceNowTableAPIClientImpl.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,18 @@ private Schema prepareSchemaWithMetadataAPI(RestAPIResponse restAPIResponse, Lis
392392
}
393393

394394
/**
395-
* Get the total number of records in the table
395+
* Gets the total number of records in the table based on the provided date range.
396396
*
397-
* @param tableName ServiceNow table name for which record count is fetched.
398-
* @return the table record count
399-
* @throws ServiceNowAPIException
397+
* @param tableName ServiceNow table name for which record count is fetched
398+
* @param startDate Start date to use for filtering records
399+
* @param endDate End date to use for filtering records
400+
* @return The total number of records
401+
* @throws ServiceNowAPIException If an error occurs while fetching the record count
400402
*/
401-
public int getTableRecordCount(String tableName, @Nullable String startdate, @Nullable String enddate)
403+
public int getTableRecordCount(String tableName, @Nullable String startDate, @Nullable String endDate)
402404
throws ServiceNowAPIException {
403-
String filterQuery = Util.generateDateRangeQuery(startdate, enddate);
404-
return getTableRecordCount(tableName, getAccessToken(), filterQuery, startdate, enddate);
405+
String filterQuery = Util.generateDateRangeQuery(startDate, endDate);
406+
return getTableRecordCountUsingFilterQuery(tableName, getAccessToken(), filterQuery);
405407
}
406408

407409
/**
@@ -412,8 +414,8 @@ public int getTableRecordCount(String tableName, @Nullable String startdate, @Nu
412414
* @return the table record count
413415
* @throws ServiceNowAPIException
414416
*/
415-
public int getTableRecordCount(String tableName, String accessToken,
416-
String filterQuery, @Nullable String startdate, @Nullable String enddate)
417+
public int getTableRecordCountUsingFilterQuery(String tableName, String accessToken,
418+
@Nullable String filterQuery)
417419
throws ServiceNowAPIException {
418420
ServiceNowTableAPIRequestBuilder requestBuilder = new ServiceNowTableAPIRequestBuilder(
419421
this.conf.getRestApiEndpoint(), tableName, false, schemaType)

0 commit comments

Comments
 (0)