Skip to content

Commit ceb6a3d

Browse files
committed
Move AI data service to AIResource
1 parent 6ab2fcf commit ceb6a3d

1 file changed

Lines changed: 0 additions & 80 deletions

File tree

knowage-core/src/main/java/it/eng/spagobi/api/v2/DataSetResource.java

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -783,86 +783,6 @@ public String getDataStorePostWithJsonInBody(@PathParam("label") String label, S
783783
}
784784
}
785785

786-
@POST
787-
@Path("/{label}/AIData")
788-
@Produces(MediaType.APPLICATION_JSON)
789-
@UserConstraint(functionalities = { CommunityFunctionalityConstants.SELF_SERVICE_DATASET_MANAGEMENT })
790-
public String getAIDataStorePostWithJsonInBody(@PathParam("label") String label, String body,
791-
@QueryParam("widgetName") String widgetName, @QueryParam("maxRows") Integer maxRows) {
792-
try {
793-
Monitor timing = MonitorFactory.start("Knowage.DataSetResource.getDataStorePostWithJsonInBody:parseInputs");
794-
795-
String parameters = null;
796-
Map<String, Object> driversRuntimeMap = null;
797-
String selections = null;
798-
String likeSelections = null;
799-
String aggregations = null;
800-
String summaryRow = null;
801-
String options = null;
802-
JSONArray jsonIndexes = null;
803-
Integer maxRowCount = maxRows;
804-
int fetchSize = 5000;
805-
boolean isNearRealtime = true;
806-
int offset = 0;
807-
808-
if (StringUtils.isNotEmpty(body)) {
809-
JSONObject jsonBody = new JSONObject(body);
810-
811-
JSONObject jsonParameters = jsonBody.optJSONObject("parameters");
812-
parameters = jsonParameters != null ? jsonParameters.toString() : null;
813-
814-
JSONObject jsonDrivers = jsonBody.optJSONObject("drivers");
815-
driversRuntimeMap = DataSetUtilities.getDriversMap(jsonDrivers);
816-
817-
JSONObject jsonSelections = jsonBody.optJSONObject("selections");
818-
selections = jsonSelections != null ? jsonSelections.toString() : null;
819-
820-
JSONObject jsonLikeSelections = jsonBody.optJSONObject("likeSelections");
821-
likeSelections = jsonLikeSelections != null ? jsonLikeSelections.toString() : null;
822-
823-
JSONObject jsonAggregations = jsonBody.optJSONObject("aggregations");
824-
aggregations = jsonAggregations != null ? jsonAggregations.toString() : null;
825-
826-
JSONObject jsonSummaryRow = jsonBody.optJSONObject("summaryRow");
827-
if (jsonSummaryRow != null) {
828-
summaryRow = jsonSummaryRow != null ? jsonSummaryRow.toString() : null;
829-
} else {
830-
JSONArray jsonSummaryRowArray = jsonBody.optJSONArray("summaryRow");
831-
summaryRow = jsonSummaryRowArray != null ? jsonSummaryRowArray.toString() : null;
832-
}
833-
834-
JSONObject jsonOptions = jsonBody.optJSONObject("options");
835-
options = jsonOptions != null ? jsonOptions.toString() : null;
836-
837-
jsonIndexes = jsonBody.optJSONArray("indexes");
838-
}
839-
840-
Set<String> columns = null;
841-
842-
if (jsonIndexes != null && jsonIndexes.length() > 0) {
843-
columns = new HashSet<>();
844-
845-
for (int k = 0; k < jsonIndexes.length(); k++) {
846-
JSONArray columnsArrayTemp = jsonIndexes.getJSONObject(k).getJSONArray("fields");
847-
848-
JSONObject columnsArray = columnsArrayTemp.getJSONObject(0);
849-
850-
if (columnsArray.getString("store").equals(label)) {
851-
columns.add(columnsArray.getString("column"));
852-
}
853-
}
854-
}
855-
timing.stop();
856-
return getDataStoreAI(label, parameters, driversRuntimeMap, selections, likeSelections, maxRowCount,
857-
aggregations, summaryRow, offset, fetchSize, isNearRealtime, options, columns, widgetName);
858-
} catch (CatalogFunctionException e) {
859-
throw e;
860-
} catch (Exception e) {
861-
logger.error("Error loading dataset data from " + label, e);
862-
throw new SpagoBIRuntimeException(e.getMessage(), e);
863-
}
864-
}
865-
866786

867787
@POST
868788
@Path("/{label}/preview")

0 commit comments

Comments
 (0)