Skip to content

Commit 73323e0

Browse files
committed
Refactor AI data service row limit handling and fetchSize validation
1 parent ceb6a3d commit 73323e0

1 file changed

Lines changed: 2 additions & 24 deletions

File tree

knowage-core/src/main/java/it/eng/spagobi/api/common/AbstractDataSetResource.java

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -349,36 +349,14 @@ public String getDataStore(String label, String parameters, Map<String, Object>
349349

350350
public String getDataStoreAI(String label, String parameters, Map<String, Object> drivers, String selections,
351351
String likeSelections, Integer maxRowCount, String aggregations, String summaryRow, int offset, int fetchSize,
352-
Boolean isNearRealtime, String options, Set<String> indexes, String widgetName) {
352+
Boolean isNearRealtime, String options, Set<String> indexes) {
353353
LOGGER.debug("IN");
354354
DatasetManagementAPI datasetManagementAPI = getDatasetManagementAPI();
355355
Monitor totalTiming = MonitorFactory.start("Knowage.AbstractDataSetResource.getDataStore");
356356
try {
357357
Monitor timing = MonitorFactory.start("Knowage.AbstractDataSetResource.getDataStore:validateParams");
358358

359-
int maxResults = Integer
360-
.parseInt(SingletonConfig.getInstance().getConfigValue("SPAGOBI.API.DATASET.MAX_ROWS_NUMBER"));
361-
362-
LOGGER.debug("Offset {}, fetch size {}, max results {}", offset, fetchSize, maxResults);
363-
364-
365-
if (maxRowCount == null) {
366-
maxRowCount = maxResults;
367-
}
368-
369-
if (maxResults <= 0) {
370-
throw new SpagoBIRuntimeException(
371-
"SPAGOBI.API.DATASET.MAX_ROWS_NUMBER value cannot be a non-positive integer");
372-
}
373-
374-
if (fetchSize > maxResults) {
375-
throw new IllegalArgumentException(
376-
"The page requested is too big. Max page size is equals to [" + maxResults + "]");
377-
}
378-
if (maxRowCount > maxResults) {
379-
throw new IllegalArgumentException(
380-
"The requested number of rows is too big [ " + maxRowCount + " ]. The limit is [ " + maxResults + " ]");
381-
}
359+
LOGGER.debug("Offset {}, fetch size {}, max results {}", offset, fetchSize, maxRowCount);
382360

383361
IDataSetDAO dataSetDao = DAOFactory.getDataSetDAO();
384362
dataSetDao.setUserProfile(getUserProfile());

0 commit comments

Comments
 (0)