FINERACT-2214: Remove pretty print parameter from api and serialization;
This commit is contained in:
committed by
Adam Saghy
parent
34cdf4d01f
commit
a0ffaa1c0b
+7
-11
@@ -89,8 +89,7 @@ public class DatatablesApiResource {
|
||||
|
||||
final List<DatatableData> result = this.readWriteNonCoreDataService.retrieveDatatableNames(apptable);
|
||||
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serializePretty(prettyPrint, result);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -201,9 +200,7 @@ public class DatatablesApiResource {
|
||||
@Context final UriInfo uriInfo) {
|
||||
|
||||
final DatatableData result = this.readWriteNonCoreDataService.retrieveDatatable(datatable);
|
||||
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serializePretty(prettyPrint, result);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -222,7 +219,7 @@ public class DatatablesApiResource {
|
||||
final List<JsonObject> result = this.readWriteNonCoreDataService.queryDataTable(datatable, columnFilter, valueFilter,
|
||||
resultColumns);
|
||||
|
||||
return this.toApiJsonSerializer.serializePretty(ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()), result);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -235,7 +232,7 @@ public class DatatablesApiResource {
|
||||
public String advancedQuery(@PathParam("datatable") @Parameter(description = "datatable") final String datatable,
|
||||
PagedLocalRequest<AdvancedQueryData> queryRequest, @Context final UriInfo uriInfo) {
|
||||
final Page<JsonObject> result = this.readWriteNonCoreDataService.queryDataTableAdvanced(datatable, queryRequest);
|
||||
return this.toApiJsonSerializer.serializePretty(ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()), result);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -263,8 +260,8 @@ public class DatatablesApiResource {
|
||||
String json = "";
|
||||
final boolean genericResultSet = ApiParameterHelper.genericResultSet(uriInfo.getQueryParameters());
|
||||
if (genericResultSet) {
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
json = this.toApiJsonSerializer.serializePretty(prettyPrint, results);
|
||||
|
||||
json = toApiJsonSerializer.serialize(results);
|
||||
} else {
|
||||
json = this.genericDataService.generateJsonFromGenericResultsetData(results);
|
||||
}
|
||||
@@ -288,8 +285,7 @@ public class DatatablesApiResource {
|
||||
|
||||
String json = "";
|
||||
if (genericResultSet) {
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
json = this.toApiJsonSerializer.serializePretty(prettyPrint, results);
|
||||
json = toApiJsonSerializer.serialize(results);
|
||||
} else {
|
||||
json = this.genericDataService.generateJsonFromGenericResultsetData(results);
|
||||
}
|
||||
|
||||
+2
-5
@@ -42,7 +42,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
@@ -81,8 +80,7 @@ public class EntityDatatableChecksApiResource {
|
||||
final Page<EntityDataTableChecksData> result = this.readEntityDatatableChecksService.retrieveAll(searchParameters, status, entity,
|
||||
productId);
|
||||
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serializePretty(prettyPrint, result);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -97,8 +95,7 @@ public class EntityDatatableChecksApiResource {
|
||||
|
||||
final EntityDataTableChecksTemplateData result = this.readEntityDatatableChecksService.retrieveTemplate();
|
||||
|
||||
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serializePretty(prettyPrint, result);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+2
-4
@@ -46,19 +46,17 @@ public class JsonDatatableReportExportService implements DatatableReportExportSe
|
||||
|
||||
final GenericResultsetData result = this.readExtraDataAndReportingService.retrieveGenericResultset(reportName, parameterTypeValue,
|
||||
reportParams, isSelfServiceUserReport);
|
||||
DatatableExportTargetParameter exportMode = DatatableExportTargetParameter.resolverExportTarget(queryParams);
|
||||
boolean prettyPrint = exportMode == DatatableExportTargetParameter.PRETTY_JSON;
|
||||
String json;
|
||||
final boolean genericResultSetIsPassed = ApiParameterHelper.genericResultSetPassed(queryParams);
|
||||
final boolean genericResultSet = ApiParameterHelper.genericResultSet(queryParams);
|
||||
if (genericResultSetIsPassed) {
|
||||
if (genericResultSet) {
|
||||
json = this.toApiJsonSerializer.serializePretty(prettyPrint, result);
|
||||
json = this.toApiJsonSerializer.serialize(result);
|
||||
} else {
|
||||
json = this.genericDataService.generateJsonFromGenericResultsetData(result);
|
||||
}
|
||||
} else {
|
||||
json = this.toApiJsonSerializer.serializePretty(prettyPrint, result);
|
||||
json = this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
return new ResponseHolder(Response.Status.OK).entity(json).contentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
|
||||
+1
-2
@@ -47,7 +47,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException;
|
||||
@@ -171,7 +170,7 @@ public class SavingsAccountTransactionsApiResource {
|
||||
public String advancedQuery(@PathParam("savingsId") @Parameter(description = "savingsId") final Long savingsId,
|
||||
PagedLocalRequest<AdvancedQueryRequest> queryRequest, @Context final UriInfo uriInfo) {
|
||||
final Page<JsonObject> result = transactionsSearchService.queryAdvanced(savingsId, queryRequest);
|
||||
return this.toApiJsonSerializer.serializePretty(ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()), result);
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+2
-5
@@ -26,7 +26,6 @@ import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||
import org.apache.fineract.infrastructure.core.serialization.CommandProcessingResultJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson;
|
||||
import org.apache.fineract.infrastructure.core.serialization.GoogleGsonSerializerHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -35,8 +34,7 @@ public class BusinessDataSerialized {
|
||||
@Test
|
||||
public void serializeBusinessDateData() {
|
||||
DefaultToApiJsonSerializer<BusinessDateData> jsonSerializer = new DefaultToApiJsonSerializer<>(
|
||||
new ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson(),
|
||||
new ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson(), new CommandProcessingResultJsonSerializer(),
|
||||
new ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson(), new CommandProcessingResultJsonSerializer(),
|
||||
new GoogleGsonSerializerHelper());
|
||||
|
||||
LocalDate now = LocalDate.now(ZoneId.systemDefault());
|
||||
@@ -49,8 +47,7 @@ public class BusinessDataSerialized {
|
||||
@Test
|
||||
public void serializeBusinessDateData_COB() {
|
||||
DefaultToApiJsonSerializer<BusinessDateData> jsonSerializer = new DefaultToApiJsonSerializer<>(
|
||||
new ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson(),
|
||||
new ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson(), new CommandProcessingResultJsonSerializer(),
|
||||
new ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson(), new CommandProcessingResultJsonSerializer(),
|
||||
new GoogleGsonSerializerHelper());
|
||||
|
||||
LocalDate now = LocalDate.now(ZoneId.systemDefault());
|
||||
|
||||
Reference in New Issue
Block a user