clean up remainder of serialization code for reports, datatables and groups.2

This commit is contained in:
Keith Woodlock
2012-12-21 11:45:37 +00:00
parent 4e589cfeb8
commit 46c315815d
15 changed files with 188 additions and 311 deletions
@@ -85,7 +85,7 @@ public class CodesApiResource {
@Path("{codeId}") @Path("{codeId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public String retreiveOffice(@PathParam("codeId") final Long codeId, @Context final UriInfo uriInfo) { public String retrieveCode(@PathParam("codeId") final Long codeId, @Context final UriInfo uriInfo) {
final CodeData code = this.readPlatformService.retrieveCode(codeId); final CodeData code = this.readPlatformService.retrieveCode(codeId);
@@ -109,7 +109,7 @@ public class CodesApiResource {
@Path("{codeId}") @Path("{codeId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public String deleteCodeApplication(@PathParam("codeId") final Long codeId) { public String deleteCode(@PathParam("codeId") final Long codeId) {
final EntityIdentifier result = this.commandsSourceWritePlatformService.logCommandSource("DELETE", "CODE", "DELETE", "codes", final EntityIdentifier result = this.commandsSourceWritePlatformService.logCommandSource("DELETE", "CODE", "DELETE", "codes",
codeId, "{}"); codeId, "{}");
@@ -10,4 +10,8 @@ public class CodeNotFoundException extends AbstractPlatformResourceNotFoundExcep
public CodeNotFoundException(final String name) { public CodeNotFoundException(final String name) {
super("error.msg.code.not.found", "Code with name `" + name + "` does not exist", name); super("error.msg.code.not.found", "Code with name `" + name + "` does not exist", name);
} }
public CodeNotFoundException(final Long codeId) {
super("error.msg.code.identifier.not.found", "Code with identifier `" + codeId + "` does not exist", codeId);
}
} }
@@ -5,9 +5,9 @@ import java.sql.SQLException;
import java.util.Collection; import java.util.Collection;
import org.mifosplatform.infrastructure.codes.data.CodeData; import org.mifosplatform.infrastructure.codes.data.CodeData;
import org.mifosplatform.infrastructure.codes.exception.CodeNotFoundException;
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.portfolio.fund.exception.FundNotFoundException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
@@ -38,7 +38,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
final Long id = rs.getLong("id"); final Long id = rs.getLong("id");
final String code_name = rs.getString("code_name"); final String code_name = rs.getString("code_name");
final boolean systemDefined = rs.getBoolean("systemDefined"); final boolean systemDefined = rs.getBoolean("systemDefined");
return new CodeData(id, code_name, systemDefined); return new CodeData(id, code_name, systemDefined);
} }
} }
@@ -54,7 +54,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
} }
@Override @Override
public CodeData retrieveCode(Long codeId) { public CodeData retrieveCode(final Long codeId) {
try { try {
context.authenticatedUser(); context.authenticatedUser();
@@ -63,7 +63,7 @@ public class CodeReadPlatformServiceImpl implements CodeReadPlatformService {
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeId }); return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { codeId });
} catch (EmptyResultDataAccessException e) { } catch (EmptyResultDataAccessException e) {
throw new FundNotFoundException(codeId); throw new CodeNotFoundException(codeId);
} }
} }
} }
@@ -6,13 +6,6 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.mifosplatform.infrastructure.core.serialization.GoogleGsonSerializerHelper; import org.mifosplatform.infrastructure.core.serialization.GoogleGsonSerializerHelper;
import org.mifosplatform.infrastructure.dataqueries.data.DatatableData;
import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData;
import org.mifosplatform.infrastructure.documentmanagement.data.DocumentData;
import org.mifosplatform.infrastructure.security.data.AuthenticatedUserData;
import org.mifosplatform.portfolio.client.data.ClientAccountSummaryCollectionData;
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryCollectionData;
import org.mifosplatform.portfolio.group.data.GroupData;
import org.mifosplatform.portfolio.loanaccount.gaurantor.data.GuarantorData; import org.mifosplatform.portfolio.loanaccount.gaurantor.data.GuarantorData;
import org.mifosplatform.portfolio.savingsaccount.data.SavingAccountData; import org.mifosplatform.portfolio.savingsaccount.data.SavingAccountData;
import org.mifosplatform.portfolio.savingsaccount.data.SavingScheduleData; import org.mifosplatform.portfolio.savingsaccount.data.SavingScheduleData;
@@ -54,23 +47,6 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi
"isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "printFDdetailsLocation", "availableInterest", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "printFDdetailsLocation", "availableInterest",
"interestPostedAmount", "lastInterestPostedDate", "nextInterestPostedDate", "fatherName", "address", "imageKey")); "interestPostedAmount", "lastInterestPostedDate", "nextInterestPostedDate", "fatherName", "address", "imageKey"));
private static final Set<String> DOCUMENT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "parentEntityType",
"parentEntityId", "name", "fileName", "type", "size", "description"));
private static final Set<String> CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("pendingApprovalLoans",
"awaitingDisbursalLoans", "openLoans", "closedLoans", "anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount",
"activeLoanCount", "closedLoanCount", "pendingApprovalDespositAccountsCount", "pendingApprovalDespositAccounts",
"approvedDespositAccountsCount", "approvedDespositAccounts", "withdrawnByClientDespositAccountsCount",
"withdrawnByClientDespositAccounts", "closedDepositAccountsCount", "closedDepositAccounts", "rejectedDepositAccountsCount",
"rejectedDepositAccounts", "preclosedDepositAccountsCount", "preclosedDepositAccounts"));
private static final Set<String> GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("pendingApprovalLoans",
"awaitingDisbursalLoans", "openLoans", "closedLoans", "anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount",
"activeLoanCount", "closedLoanCount"));
private static final Set<String> GROUP_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "officeId", "name", "externalId",
"clientMembers", "allowedClients", "allowedOffices"));
private static final Set<String> SAVINGS_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "status", "externalId", private static final Set<String> SAVINGS_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "status", "externalId",
"clientId", "clientName", "productId", "productName", "productType", "currencyData", "savingsDepostiAmountPerPeriod", "clientId", "clientName", "productId", "productName", "productType", "currencyData", "savingsDepostiAmountPerPeriod",
"savingsFrequencyType", "totalDepositAmount", "reccuringInterestRate", "savingInterestRate", "interestType", "savingsFrequencyType", "totalDepositAmount", "reccuringInterestRate", "savingInterestRate", "interestType",
@@ -94,24 +70,6 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi
this.helper = helper; this.helper = helper;
} }
@Override
public String serializeAuthenticatedUserDataToJson(final boolean prettyPrint, final AuthenticatedUserData authenticatedUserData) {
final Gson gsonDeserializer = helper.createGsonBuilder(prettyPrint);
return helper.serializedJsonFrom(gsonDeserializer, authenticatedUserData);
}
@Override
public String serializeGenericResultsetDataToJson(final boolean prettyPrint, final GenericResultsetData resultsetData) {
final Gson gsonDeserializer = helper.createGsonBuilder(prettyPrint);
return helper.serializedJsonFrom(gsonDeserializer, resultsetData);
}
@Override
public String serializeDatatableDataToJson(final boolean prettyPrint, final Collection<DatatableData> datatables) {
final Gson gsonDeserializer = helper.createGsonBuilder(prettyPrint);
return helper.serializedJsonFrom(gsonDeserializer, datatables.toArray(new DatatableData[datatables.size()]));
}
@Override @Override
public String serializeSavingProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters, public String serializeSavingProductDataToJson(final boolean prettyPrint, final Set<String> responseParameters,
final Collection<SavingProductData> products) { final Collection<SavingProductData> products) {
@@ -160,51 +118,6 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi
return helper.serializedJsonFrom(gsonDeserializer, account); return helper.serializedJsonFrom(gsonDeserializer, account);
} }
@Override
public String serializeClientAccountSummaryCollectionDataToJson(final boolean prettyPrint, final Set<String> responseParameters,
final ClientAccountSummaryCollectionData clientAccount) {
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(CLIENT_ACCOUNTS_DATA_PARAMETERS,
prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, clientAccount);
}
@Override
public String serializeGroupAccountSummaryCollectionDataToJson(final boolean prettyPrint, final Set<String> responseParameters,
final GroupAccountSummaryCollectionData groupAccount) {
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(GROUP_ACCOUNTS_DATA_PARAMETERS,
prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, groupAccount);
}
@Override
public String serializeGroupDataToJson(final boolean prettyPrint, final Set<String> responseParameters,
final Collection<GroupData> groups) {
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(GROUP_DATA_PARAMETERS,
prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, groups.toArray(new GroupData[groups.size()]));
}
@Override
public String serializeGroupDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final GroupData group) {
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(GROUP_DATA_PARAMETERS,
prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, group);
}
@Override
public String serializeDocumentDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<DocumentData> documentDatas) {
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(DOCUMENT_DATA_PARAMETERS,
prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, documentDatas.toArray(new DocumentData[documentDatas.size()]));
}
@Override
public String serializeDocumentDataToJson(boolean prettyPrint, Set<String> responseParameters, DocumentData documentData) {
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(DOCUMENT_DATA_PARAMETERS,
prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, documentData);
}
@Override @Override
public String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, SavingAccountData account) { public String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, SavingAccountData account) {
final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_ACCOUNTS_DATA_PARAMETERS, final Gson gsonDeserializer = helper.createGsonBuilderWithParameterExclusionSerializationStrategy(SAVINGS_ACCOUNTS_DATA_PARAMETERS,
@@ -234,5 +147,4 @@ public class GoogleGsonPortfolioApiJsonSerializerService implements PortfolioApi
prettyPrint, responseParameters); prettyPrint, responseParameters);
return helper.serializedJsonFrom(gsonDeserializer, savingScheduleData); return helper.serializedJsonFrom(gsonDeserializer, savingScheduleData);
} }
} }
@@ -1,6 +1,5 @@
package org.mifosplatform.infrastructure.core.api; package org.mifosplatform.infrastructure.core.api;
import org.mifosplatform.portfolio.client.command.NoteCommand;
import org.mifosplatform.portfolio.client.data.ClientData; import org.mifosplatform.portfolio.client.data.ClientData;
import org.mifosplatform.portfolio.group.command.GroupCommand; import org.mifosplatform.portfolio.group.command.GroupCommand;
import org.mifosplatform.portfolio.loanaccount.gaurantor.command.GuarantorCommand; import org.mifosplatform.portfolio.loanaccount.gaurantor.command.GuarantorCommand;
@@ -23,8 +22,6 @@ public interface PortfolioApiDataConversionService {
GroupCommand convertJsonToGroupCommand(Long resourceIdentifier, String json); GroupCommand convertJsonToGroupCommand(Long resourceIdentifier, String json);
NoteCommand convertJsonToNoteCommand(Long resourceIdentifier, Long clientId, String json);
DepositAccountCommand convertJsonToDepositAccountCommand(Long resourceIdentifier, String json); DepositAccountCommand convertJsonToDepositAccountCommand(Long resourceIdentifier, String json);
DepositStateTransitionCommand convertJsonToDepositStateTransitionCommand(Long resourceIdentifier, String json); DepositStateTransitionCommand convertJsonToDepositStateTransitionCommand(Long resourceIdentifier, String json);
@@ -22,7 +22,6 @@ import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException; import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException; import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException;
import org.mifosplatform.portfolio.client.command.ClientCommand; import org.mifosplatform.portfolio.client.command.ClientCommand;
import org.mifosplatform.portfolio.client.command.NoteCommand;
import org.mifosplatform.portfolio.client.data.ClientData; import org.mifosplatform.portfolio.client.data.ClientData;
import org.mifosplatform.portfolio.client.serialization.ClientCommandFromApiJsonDeserializer; import org.mifosplatform.portfolio.client.serialization.ClientCommandFromApiJsonDeserializer;
import org.mifosplatform.portfolio.group.command.GroupCommand; import org.mifosplatform.portfolio.group.command.GroupCommand;
@@ -109,24 +108,6 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
return new GroupCommand(modifiedParameters, resourceIdentifier, externalId, name, officeId, clientMembers); return new GroupCommand(modifiedParameters, resourceIdentifier, externalId, name, officeId, clientMembers);
} }
@Override
public NoteCommand convertJsonToNoteCommand(final Long noteId, final Long clientId, final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
Set<String> supportedParams = new HashSet<String>(Arrays.asList("note"));
checkForUnsupportedParameters(requestMap, supportedParams);
Set<String> modifiedParameters = new HashSet<String>();
String note = extractStringParameter("note", requestMap, modifiedParameters);
return new NoteCommand(noteId, clientId, note);
}
private void checkForUnsupportedParameters(Map<String, ?> requestMap, Set<String> supportedParams) { private void checkForUnsupportedParameters(Map<String, ?> requestMap, Set<String> supportedParams) {
List<String> unsupportedParameterList = new ArrayList<String>(); List<String> unsupportedParameterList = new ArrayList<String>();
for (String providedParameter : requestMap.keySet()) { for (String providedParameter : requestMap.keySet()) {
@@ -3,13 +3,6 @@ package org.mifosplatform.infrastructure.core.api;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
import org.mifosplatform.infrastructure.dataqueries.data.DatatableData;
import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData;
import org.mifosplatform.infrastructure.documentmanagement.data.DocumentData;
import org.mifosplatform.infrastructure.security.data.AuthenticatedUserData;
import org.mifosplatform.portfolio.client.data.ClientAccountSummaryCollectionData;
import org.mifosplatform.portfolio.group.data.GroupAccountSummaryCollectionData;
import org.mifosplatform.portfolio.group.data.GroupData;
import org.mifosplatform.portfolio.loanaccount.gaurantor.data.GuarantorData; import org.mifosplatform.portfolio.loanaccount.gaurantor.data.GuarantorData;
import org.mifosplatform.portfolio.savingsaccount.data.SavingAccountData; import org.mifosplatform.portfolio.savingsaccount.data.SavingAccountData;
import org.mifosplatform.portfolio.savingsaccount.data.SavingScheduleData; import org.mifosplatform.portfolio.savingsaccount.data.SavingScheduleData;
@@ -19,12 +12,6 @@ import org.mifosplatform.portfolio.savingsdepositproduct.data.DepositProductData
public interface PortfolioApiJsonSerializerService { public interface PortfolioApiJsonSerializerService {
String serializeAuthenticatedUserDataToJson(boolean prettyPrint, AuthenticatedUserData authenticatedUserData);
String serializeGenericResultsetDataToJson(boolean prettyPrint, GenericResultsetData result);
String serializeDatatableDataToJson(boolean prettyPrint, Collection<DatatableData> result);
String serializeSavingProductDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<SavingProductData> products); String serializeSavingProductDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<SavingProductData> products);
String serializeSavingProductDataToJson(boolean prettyPrint, Set<String> responseParameters, SavingProductData savingProduct); String serializeSavingProductDataToJson(boolean prettyPrint, Set<String> responseParameters, SavingProductData savingProduct);
@@ -37,20 +24,6 @@ public interface PortfolioApiJsonSerializerService {
String serializeDepositAccountDataToJson(boolean prettyPrint, Set<String> responseParameters, DepositAccountData account); String serializeDepositAccountDataToJson(boolean prettyPrint, Set<String> responseParameters, DepositAccountData account);
String serializeClientAccountSummaryCollectionDataToJson(boolean prettyPrint, Set<String> responseParameters,
ClientAccountSummaryCollectionData clientAccount);
String serializeGroupAccountSummaryCollectionDataToJson(boolean prettyPrint, Set<String> responseParameters,
GroupAccountSummaryCollectionData groupAccount);
String serializeGroupDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<GroupData> groups);
String serializeGroupDataToJson(boolean prettyPrint, Set<String> responseParameters, GroupData group);
String serializeDocumentDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<DocumentData> documentDatas);
String serializeDocumentDataToJson(boolean prettyPrint, Set<String> responseParameters, DocumentData documentData);
String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, SavingAccountData account); String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, SavingAccountData account);
String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<SavingAccountData> accounts); String serializeSavingAccountsDataToJson(boolean prettyPrint, Set<String> responseParameters, Collection<SavingAccountData> accounts);
@@ -41,6 +41,18 @@ public final class DefaultToApiJsonSerializer<T> implements ToApiJsonSerializer<
public String serialize(final Object object) { public String serialize(final Object object) {
return this.excludeNothingWithPrettyPrintingOff.serialize(object); return this.excludeNothingWithPrettyPrintingOff.serialize(object);
} }
@Override
public String serializePretty(boolean prettyOn, final Object object) {
String json = "";
if (prettyOn) {
json = this.excludeNothingWithPrettyPrintingOn.serialize(object);
} else {
json = serialize(object);
}
return json;
}
@Override @Override
public String serialize(final ApiRequestJsonSerializationSettings settings, final Collection<T> collection, public String serialize(final ApiRequestJsonSerializationSettings settings, final Collection<T> collection,
@@ -5,11 +5,13 @@ import java.util.Set;
public interface ToApiJsonSerializer<T> { public interface ToApiJsonSerializer<T> {
String serialize(final Object object); String serialize(Object object);
String serializeResult(final Object object); String serializePretty(boolean prettyOn, Object object);
String serializeResult(Object object);
String serialize(final ApiRequestJsonSerializationSettings settings, Collection<T> collection, Set<String> supportedResponseParameters); String serialize(ApiRequestJsonSerializationSettings settings, Collection<T> collection, Set<String> supportedResponseParameters);
String serialize(final ApiRequestJsonSerializationSettings settings, T single, Set<String> supportedResponseParameters); String serialize(ApiRequestJsonSerializationSettings settings, T single, Set<String> supportedResponseParameters);
} }
@@ -24,8 +24,8 @@ import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject; import org.codehaus.jettison.json.JSONObject;
import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.ApiParameterHelper;
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService;
import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.core.data.EntityIdentifier;
import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.dataqueries.data.DatatableData; import org.mifosplatform.infrastructure.dataqueries.data.DatatableData;
import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData;
import org.mifosplatform.infrastructure.dataqueries.service.GenericDataService; import org.mifosplatform.infrastructure.dataqueries.service.GenericDataService;
@@ -45,18 +45,20 @@ import org.springframework.stereotype.Component;
public class DataTableApiResource { public class DataTableApiResource {
private final static Logger logger = LoggerFactory.getLogger(DataTableApiResource.class); private final static Logger logger = LoggerFactory.getLogger(DataTableApiResource.class);
private final PlatformSecurityContext context;
private final GenericDataService genericDataService;
private final ReadWriteNonCoreDataService readWriteNonCoreDataService;
private final ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer;
@Autowired @Autowired
private PlatformSecurityContext context; public DataTableApiResource(final PlatformSecurityContext context, final GenericDataService genericDataService,
final ReadWriteNonCoreDataService readWriteNonCoreDataService, ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer) {
@Autowired this.context = context;
private GenericDataService genericDataService; this.genericDataService = genericDataService;
this.readWriteNonCoreDataService = readWriteNonCoreDataService;
@Autowired this.toApiJsonSerializer = toApiJsonSerializer;
private ReadWriteNonCoreDataService readWriteNonCoreDataService; }
@Autowired
private PortfolioApiJsonSerializerService apiJsonSerializerService;
@GET @GET
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -66,29 +68,29 @@ public class DataTableApiResource {
final List<DatatableData> result = this.readWriteNonCoreDataService.retrieveDatatableNames(apptable); final List<DatatableData> result = this.readWriteNonCoreDataService.retrieveDatatableNames(apptable);
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
return this.apiJsonSerializerService.serializeDatatableDataToJson(prettyPrint, result); return this.toApiJsonSerializer.serializePretty(prettyPrint, result);
} }
@POST @POST
@Path("register/{datatable}/{apptable}") @Path("register/{datatable}/{apptable}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response registerDatatable(@PathParam("datatable") final String datatable, @PathParam("apptable") final String apptable) { public String registerDatatable(@PathParam("datatable") final String datatable, @PathParam("apptable") final String apptable) {
this.readWriteNonCoreDataService.registerDatatable(datatable, apptable); this.readWriteNonCoreDataService.registerDatatable(datatable, apptable);
return Response.ok().entity(EntityIdentifier.empty()).build(); return this.toApiJsonSerializer.serialize(EntityIdentifier.empty());
} }
@POST @POST
@Path("deregister/{datatable}") @Path("deregister/{datatable}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response deregisterDatatable(@PathParam("datatable") final String datatable) { public String deregisterDatatable(@PathParam("datatable") final String datatable) {
this.readWriteNonCoreDataService.deregisterDatatable(datatable); this.readWriteNonCoreDataService.deregisterDatatable(datatable);
return Response.ok().entity(EntityIdentifier.empty()).build(); return this.toApiJsonSerializer.serialize(EntityIdentifier.empty());
} }
@GET @GET
@@ -106,8 +108,8 @@ public class DataTableApiResource {
String json = ""; String json = "";
final boolean genericResultSet = ApiParameterHelper.genericResultSet(uriInfo.getQueryParameters()); final boolean genericResultSet = ApiParameterHelper.genericResultSet(uriInfo.getQueryParameters());
if (genericResultSet) { if (genericResultSet) {
boolean prettyPrints = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
json = this.apiJsonSerializerService.serializeGenericResultsetDataToJson(prettyPrints, results); json = this.toApiJsonSerializer.serializePretty(prettyPrint, results);
} else { } else {
json = this.genericDataService.generateJsonFromGenericResultsetData(results); json = this.genericDataService.generateJsonFromGenericResultsetData(results);
} }
@@ -119,7 +121,7 @@ public class DataTableApiResource {
@Path("{datatable}/{apptableId}") @Path("{datatable}/{apptableId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response newDatatableEntry(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId, public String newDatatableEntry(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId,
final String jsonRequestBody) { final String jsonRequestBody) {
checkUserPermissionForDatatable(datatable, "CREATE"); checkUserPermissionForDatatable(datatable, "CREATE");
@@ -127,17 +129,16 @@ public class DataTableApiResource {
this.readWriteNonCoreDataService.newDatatableEntry(datatable, apptableId, queryParams); this.readWriteNonCoreDataService.newDatatableEntry(datatable, apptableId, queryParams);
EntityIdentifier entityIdentifier = new EntityIdentifier(Long.valueOf(apptableId)); EntityIdentifier entityIdentifier = EntityIdentifier.resourceResult(Long.valueOf(apptableId), null);
return Response.ok().entity(entityIdentifier).build();
return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
@PUT @PUT
@Path("{datatable}/{apptableId}") @Path("{datatable}/{apptableId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response updateDatatableEntryOnetoOne(@PathParam("datatable") final String datatable, public String updateDatatableEntryOnetoOne(@PathParam("datatable") final String datatable,
@PathParam("apptableId") final Long apptableId, final String jsonRequestBody) { @PathParam("apptableId") final Long apptableId, final String jsonRequestBody) {
/* /*
* for updating one to one relationships (where foreign key is the * for updating one to one relationships (where foreign key is the
@@ -148,17 +149,16 @@ public class DataTableApiResource {
this.readWriteNonCoreDataService.updateDatatableEntryOnetoOne(datatable, apptableId, queryParams); this.readWriteNonCoreDataService.updateDatatableEntryOnetoOne(datatable, apptableId, queryParams);
EntityIdentifier entityIdentifier = new EntityIdentifier(Long.valueOf(apptableId)); EntityIdentifier entityIdentifier = EntityIdentifier.resourceResult(Long.valueOf(apptableId), null);
return Response.ok().entity(entityIdentifier).build();
return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
@PUT @PUT
@Path("{datatable}/{apptableId}/{datatableId}") @Path("{datatable}/{apptableId}/{datatableId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response updateDatatableEntryOnetoOne(@PathParam("datatable") final String datatable, public String updateDatatableEntryOnetoOne(@PathParam("datatable") final String datatable,
@PathParam("apptableId") final Long apptableId, @PathParam("datatableId") final Long datatableId, final String jsonRequestBody) { @PathParam("apptableId") final Long apptableId, @PathParam("datatableId") final Long datatableId, final String jsonRequestBody) {
/* /*
* for updating one to many relationships (where foreign key isn't the * for updating one to many relationships (where foreign key isn't the
@@ -169,25 +169,24 @@ public class DataTableApiResource {
this.readWriteNonCoreDataService.updateDatatableEntryOnetoMany(datatable, apptableId, datatableId, queryParams); this.readWriteNonCoreDataService.updateDatatableEntryOnetoMany(datatable, apptableId, datatableId, queryParams);
EntityIdentifier entityIdentifier = new EntityIdentifier(Long.valueOf(apptableId)); EntityIdentifier entityIdentifier = EntityIdentifier.resourceResult(Long.valueOf(apptableId), null);
return Response.ok().entity(entityIdentifier).build();
return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
@DELETE @DELETE
@Path("{datatable}/{apptableId}") @Path("{datatable}/{apptableId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response deleteDatatableEntries(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId) { public String deleteDatatableEntries(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId) {
checkUserPermissionForDatatable(datatable, "DELETE"); checkUserPermissionForDatatable(datatable, "DELETE");
this.readWriteNonCoreDataService.deleteDatatableEntries(datatable, apptableId); this.readWriteNonCoreDataService.deleteDatatableEntries(datatable, apptableId);
EntityIdentifier entityIdentifier = new EntityIdentifier(Long.valueOf(apptableId)); EntityIdentifier entityIdentifier = EntityIdentifier.resourceResult(Long.valueOf(apptableId), null);
return Response.ok().entity(entityIdentifier).build(); return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
@@ -195,20 +194,19 @@ public class DataTableApiResource {
@Path("{datatable}/{apptableId}/{datatableId}") @Path("{datatable}/{apptableId}/{datatableId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response deleteDatatableEntries(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId, public String deleteDatatableEntries(@PathParam("datatable") final String datatable, @PathParam("apptableId") final Long apptableId,
@PathParam("datatableId") final Long datatableId) { @PathParam("datatableId") final Long datatableId) {
checkUserPermissionForDatatable(datatable, "DELETE"); checkUserPermissionForDatatable(datatable, "DELETE");
this.readWriteNonCoreDataService.deleteDatatableEntry(datatable, apptableId, datatableId); this.readWriteNonCoreDataService.deleteDatatableEntry(datatable, apptableId, datatableId);
EntityIdentifier entityIdentifier = new EntityIdentifier(Long.valueOf(apptableId)); EntityIdentifier entityIdentifier = EntityIdentifier.resourceResult(Long.valueOf(apptableId), null);
return Response.ok().entity(entityIdentifier).build();
return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
private Map<String, String> getQueryParamsFromJsonRequestBody(String jsonRequestBody) { private Map<String, String> getQueryParamsFromJsonRequestBody(final String jsonRequestBody) {
Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> queryParams = new HashMap<String, String>();
@@ -234,7 +232,7 @@ public class DataTableApiResource {
} }
private void checkUserPermissionForDatatable(String datatable, String accessType) { private void checkUserPermissionForDatatable(final String datatable, final String accessType) {
AppUser currentUser = context.authenticatedUser(); AppUser currentUser = context.authenticatedUser();
if (currentUser.hasNotPermissionForDatatable(datatable, accessType)) { throw new NoAuthorizationException("Not Authorised to " if (currentUser.hasNotPermissionForDatatable(datatable, accessType)) { throw new NoAuthorizationException("Not Authorised to "
+ accessType + " Data Table: " + datatable); } + accessType + " Data Table: " + datatable); }
@@ -19,7 +19,7 @@ import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.ApiParameterHelper;
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData; import org.mifosplatform.infrastructure.dataqueries.data.GenericResultsetData;
import org.mifosplatform.infrastructure.dataqueries.service.ReadReportingService; import org.mifosplatform.infrastructure.dataqueries.service.ReadReportingService;
import org.mifosplatform.infrastructure.security.exception.NoAuthorizationException; import org.mifosplatform.infrastructure.security.exception.NoAuthorizationException;
@@ -34,14 +34,17 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class ReportsApiResource { public class ReportsApiResource {
@Autowired private final PlatformSecurityContext context;
private PlatformSecurityContext context; private final ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer;
private final ReadReportingService readExtraDataAndReportingService;
@Autowired @Autowired
private ReadReportingService readExtraDataAndReportingService; public ReportsApiResource(final PlatformSecurityContext context, final ReadReportingService readExtraDataAndReportingService,
final ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer) {
@Autowired this.context = context;
private PortfolioApiJsonSerializerService apiJsonSerializerService; this.readExtraDataAndReportingService = readExtraDataAndReportingService;
this.toApiJsonSerializer = toApiJsonSerializer;
}
@GET @GET
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -55,8 +58,7 @@ public class ReportsApiResource {
boolean exportPdf = ApiParameterHelper.exportPdf(uriInfo.getQueryParameters()); boolean exportPdf = ApiParameterHelper.exportPdf(uriInfo.getQueryParameters());
if (exportPdf) if (exportPdf) {
{
String result = this.readExtraDataAndReportingService.retrieveReportPDF(".", ".", extractedQueryParams); String result = this.readExtraDataAndReportingService.retrieveReportPDF(".", ".", extractedQueryParams);
return Response.ok().entity(result).header("Content-Disposition", "attachment;filename=ReportList.pdf").build(); return Response.ok().entity(result).header("Content-Disposition", "attachment;filename=ReportList.pdf").build();
} }
@@ -64,7 +66,7 @@ public class ReportsApiResource {
if (!exportCsv) { if (!exportCsv) {
GenericResultsetData result = this.readExtraDataAndReportingService.retrieveGenericResultset(".", ".", extractedQueryParams); GenericResultsetData result = this.readExtraDataAndReportingService.retrieveGenericResultset(".", ".", extractedQueryParams);
final String json = this.apiJsonSerializerService.serializeGenericResultsetDataToJson(prettyPrint, result); final String json = this.toApiJsonSerializer.serializePretty(prettyPrint, result);
return Response.ok().entity(json).build(); return Response.ok().entity(json).build();
} }
@@ -123,7 +125,7 @@ public class ReportsApiResource {
GenericResultsetData result = this.readExtraDataAndReportingService.retrieveGenericResultset(reportName, parameterTypeValue, GenericResultsetData result = this.readExtraDataAndReportingService.retrieveGenericResultset(reportName, parameterTypeValue,
reportParams); reportParams);
final String json = this.apiJsonSerializerService.serializeGenericResultsetDataToJson(prettyPrint, result); final String json = this.toApiJsonSerializer.serializePretty(prettyPrint, result);
return Response.ok().entity(json).type(MediaType.APPLICATION_JSON).build(); return Response.ok().entity(json).type(MediaType.APPLICATION_JSON).build();
} }
@@ -136,7 +138,7 @@ public class ReportsApiResource {
.header("Content-Disposition", "attachment;filename=" + reportName.replaceAll(" ", "") + ".csv").build(); .header("Content-Disposition", "attachment;filename=" + reportName.replaceAll(" ", "") + ".csv").build();
} }
private void checkUserPermissionForReport(String reportName, boolean parameterType) { private void checkUserPermissionForReport(final String reportName, final boolean parameterType) {
// Anyone can run a 'report' that is simply getting possible parameter // Anyone can run a 'report' that is simply getting possible parameter
// (dropdown listbox) values. // (dropdown listbox) values.
@@ -2,6 +2,7 @@ package org.mifosplatform.infrastructure.documentmanagement.api;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@@ -22,9 +23,10 @@ import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import org.mifosplatform.infrastructure.core.api.ApiConstants; import org.mifosplatform.infrastructure.core.api.ApiConstants;
import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper;
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService;
import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.core.data.EntityIdentifier;
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.core.service.FileUtils; import org.mifosplatform.infrastructure.core.service.FileUtils;
import org.mifosplatform.infrastructure.documentmanagement.command.DocumentCommand; import org.mifosplatform.infrastructure.documentmanagement.command.DocumentCommand;
import org.mifosplatform.infrastructure.documentmanagement.data.DocumentData; import org.mifosplatform.infrastructure.documentmanagement.data.DocumentData;
@@ -44,21 +46,26 @@ import com.sun.jersey.multipart.FormDataParam;
@Scope("singleton") @Scope("singleton")
public class DocumentManagementApiResource { public class DocumentManagementApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "parentEntityType", "parentEntityId",
"name", "fileName", "type", "size", "description"));
private final String SystemEntityType = "DOCUMENT"; private final String SystemEntityType = "DOCUMENT";
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final DocumentReadPlatformService documentReadPlatformService; private final DocumentReadPlatformService documentReadPlatformService;
private final DocumentWritePlatformService documentWritePlatformService; private final DocumentWritePlatformService documentWritePlatformService;
private final PortfolioApiJsonSerializerService apiJsonSerializerService; private final ApiRequestParameterHelper apiRequestParameterHelper;
private final ToApiJsonSerializer<DocumentData> toApiJsonSerializer;
@Autowired @Autowired
public DocumentManagementApiResource(final PlatformSecurityContext context, public DocumentManagementApiResource(final PlatformSecurityContext context,
final DocumentReadPlatformService documentReadPlatformService, final DocumentWritePlatformService documentWritePlatformService, final DocumentReadPlatformService documentReadPlatformService, final DocumentWritePlatformService documentWritePlatformService,
final PortfolioApiJsonSerializerService apiJsonSerializerService) { final ApiRequestParameterHelper apiRequestParameterHelper, final ToApiJsonSerializer<DocumentData> toApiJsonSerializer) {
this.context = context; this.context = context;
this.documentReadPlatformService = documentReadPlatformService; this.documentReadPlatformService = documentReadPlatformService;
this.documentWritePlatformService = documentWritePlatformService; this.documentWritePlatformService = documentWritePlatformService;
this.apiJsonSerializerService = apiJsonSerializerService; this.apiRequestParameterHelper = apiRequestParameterHelper;
this.toApiJsonSerializer = toApiJsonSerializer;
} }
@GET @GET
@@ -69,18 +76,16 @@ public class DocumentManagementApiResource {
context.authenticatedUser().validateHasReadPermission(SystemEntityType); context.authenticatedUser().validateHasReadPermission(SystemEntityType);
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
final Collection<DocumentData> documentDatas = this.documentReadPlatformService.retrieveAllDocuments(entityType, entityId); final Collection<DocumentData> documentDatas = this.documentReadPlatformService.retrieveAllDocuments(entityType, entityId);
return this.apiJsonSerializerService.serializeDocumentDataToJson(prettyPrint, responseParameters, documentDatas); final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, documentDatas, RESPONSE_DATA_PARAMETERS);
} }
@POST @POST
@Consumes({ MediaType.MULTIPART_FORM_DATA }) @Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response createDocument(@PathParam("entityType") String entityType, @PathParam("entityId") Long entityId, public String createDocument(@PathParam("entityType") String entityType, @PathParam("entityId") Long entityId,
@HeaderParam("Content-Length") Long fileSize, @FormDataParam("file") InputStream inputStream, @HeaderParam("Content-Length") Long fileSize, @FormDataParam("file") InputStream inputStream,
@FormDataParam("file") FormDataContentDisposition fileDetails, @FormDataParam("file") FormDataBodyPart bodyPart, @FormDataParam("file") FormDataContentDisposition fileDetails, @FormDataParam("file") FormDataBodyPart bodyPart,
@FormDataParam("name") String name, @FormDataParam("description") String description) { @FormDataParam("name") String name, @FormDataParam("description") String description) {
@@ -101,14 +106,14 @@ public class DocumentManagementApiResource {
Long documentId = this.documentWritePlatformService.createDocument(documentCommand, inputStream); Long documentId = this.documentWritePlatformService.createDocument(documentCommand, inputStream);
return Response.ok().entity(new EntityIdentifier(documentId)).build(); return this.toApiJsonSerializer.serialize(EntityIdentifier.resourceResult(documentId, null));
} }
@PUT @PUT
@Path("{documentId}") @Path("{documentId}")
@Consumes({ MediaType.MULTIPART_FORM_DATA }) @Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response updateDocument(@PathParam("entityType") String entityType, @PathParam("entityId") Long entityId, public String updateDocument(@PathParam("entityType") String entityType, @PathParam("entityId") Long entityId,
@PathParam("documentId") Long documentId, @HeaderParam("Content-Length") Long fileSize, @PathParam("documentId") Long documentId, @HeaderParam("Content-Length") Long fileSize,
@FormDataParam("file") InputStream inputStream, @FormDataParam("file") FormDataContentDisposition fileDetails, @FormDataParam("file") InputStream inputStream, @FormDataParam("file") FormDataContentDisposition fileDetails,
@FormDataParam("file") FormDataBodyPart bodyPart, @FormDataParam("name") String name, @FormDataParam("file") FormDataBodyPart bodyPart, @FormDataParam("name") String name,
@@ -138,7 +143,7 @@ public class DocumentManagementApiResource {
} }
EntityIdentifier identifier = this.documentWritePlatformService.updateDocument(documentCommand, inputStream); EntityIdentifier identifier = this.documentWritePlatformService.updateDocument(documentCommand, inputStream);
return Response.ok().entity(identifier).build(); return this.toApiJsonSerializer.serialize(identifier);
} }
@GET @GET
@@ -150,12 +155,10 @@ public class DocumentManagementApiResource {
context.authenticatedUser().validateHasReadPermission(SystemEntityType); context.authenticatedUser().validateHasReadPermission(SystemEntityType);
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
final DocumentData documentData = this.documentReadPlatformService.retrieveDocument(entityType, entityId, documentId); final DocumentData documentData = this.documentReadPlatformService.retrieveDocument(entityType, entityId, documentId);
return this.apiJsonSerializerService.serializeDocumentDataToJson(prettyPrint, responseParameters, documentData); final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, documentData, RESPONSE_DATA_PARAMETERS);
} }
@GET @GET
@@ -172,6 +175,7 @@ public class DocumentManagementApiResource {
ResponseBuilder response = Response.ok(file); ResponseBuilder response = Response.ok(file);
response.header("Content-Disposition", "attachment; filename=\"" + documentData.fileName() + "\""); response.header("Content-Disposition", "attachment; filename=\"" + documentData.fileName() + "\"");
response.header("Content-Type", documentData.contentType()); response.header("Content-Type", documentData.contentType());
return response.build(); return response.build();
} }
@@ -179,13 +183,14 @@ public class DocumentManagementApiResource {
@Path("{documentId}") @Path("{documentId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response deleteDocument(@PathParam("entityType") String entityType, @PathParam("entityId") Long entityId, public String deleteDocument(@PathParam("entityType") String entityType, @PathParam("entityId") Long entityId,
@PathParam("documentId") Long documentId) { @PathParam("documentId") Long documentId) {
DocumentCommand documentCommand = new DocumentCommand(null, documentId, entityType, entityId, null, null, null, null, null, null); final DocumentCommand documentCommand = new DocumentCommand(null, documentId, entityType, entityId, null, null, null, null, null,
null);
EntityIdentifier documentIdentifier = this.documentWritePlatformService.deleteDocument(documentCommand); final EntityIdentifier documentIdentifier = this.documentWritePlatformService.deleteDocument(documentCommand);
return Response.ok(documentIdentifier).build(); return this.toApiJsonSerializer.serialize(documentIdentifier);
} }
} }
@@ -10,7 +10,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService; import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.security.data.AuthenticatedUserData; import org.mifosplatform.infrastructure.security.data.AuthenticatedUserData;
import org.mifosplatform.useradministration.domain.AppUser; import org.mifosplatform.useradministration.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -29,12 +29,16 @@ import com.sun.jersey.core.util.Base64;
@Scope("singleton") @Scope("singleton")
public class AuthenticationApiResource { public class AuthenticationApiResource {
@Qualifier("customAuthenticationProvider") private final DaoAuthenticationProvider customAuthenticationProvider;
@Autowired private final ToApiJsonSerializer<AuthenticatedUserData> apiJsonSerializerService;
private DaoAuthenticationProvider customAuthenticationProvider;
@Autowired @Autowired
private PortfolioApiJsonSerializerService apiJsonSerializerService; public AuthenticationApiResource(
@Qualifier("customAuthenticationProvider") final DaoAuthenticationProvider customAuthenticationProvider,
final ToApiJsonSerializer<AuthenticatedUserData> apiJsonSerializerService) {
this.customAuthenticationProvider = customAuthenticationProvider;
this.apiJsonSerializerService = apiJsonSerializerService;
}
@POST @POST
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -59,6 +63,6 @@ public class AuthenticationApiResource {
base64EncodedAuthenticationKey)); base64EncodedAuthenticationKey));
} }
return this.apiJsonSerializerService.serializeAuthenticatedUserDataToJson(false, authenticatedUserData); return this.apiJsonSerializerService.serialize(authenticatedUserData);
} }
} }
@@ -27,10 +27,9 @@ import org.mifosplatform.commands.service.PortfolioCommandsReadPlatformService;
import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.ApiParameterHelper;
import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper; import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper;
import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService;
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService;
import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.core.data.EntityIdentifier;
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.organisation.office.data.OfficeLookup; import org.mifosplatform.organisation.office.data.OfficeLookup;
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
@@ -52,27 +51,27 @@ public class ClientsApiResource {
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final ClientReadPlatformService clientReadPlatformService; private final ClientReadPlatformService clientReadPlatformService;
private final OfficeReadPlatformService officeReadPlatformService; private final OfficeReadPlatformService officeReadPlatformService;
private final DefaultToApiJsonSerializer<ClientData> toApiJsonSerializer; private final ToApiJsonSerializer<ClientData> toApiJsonSerializer;
private final ToApiJsonSerializer<ClientAccountSummaryCollectionData> clientAccountSummaryToApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper; private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioApiDataConversionService apiDataConversionService; private final PortfolioApiDataConversionService apiDataConversionService;
private final PortfolioApiJsonSerializerService apiJsonSerializerService;
private final PortfolioCommandsReadPlatformService commandSourceReadPlatformService; private final PortfolioCommandsReadPlatformService commandSourceReadPlatformService;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@Autowired @Autowired
public ClientsApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService, public ClientsApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService,
final OfficeReadPlatformService officeReadPlatformService, final DefaultToApiJsonSerializer<ClientData> toApiJsonSerializer, final OfficeReadPlatformService officeReadPlatformService, final ToApiJsonSerializer<ClientData> toApiJsonSerializer,
final ToApiJsonSerializer<ClientAccountSummaryCollectionData> clientAccountSummaryToApiJsonSerializer,
final ApiRequestParameterHelper apiRequestParameterHelper, final PortfolioApiDataConversionService apiDataConversionService, final ApiRequestParameterHelper apiRequestParameterHelper, final PortfolioApiDataConversionService apiDataConversionService,
final PortfolioApiJsonSerializerService apiJsonSerializerService,
final PortfolioCommandsReadPlatformService commandsReadPlatformService, final PortfolioCommandsReadPlatformService commandsReadPlatformService,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context; this.context = context;
this.clientReadPlatformService = readPlatformService; this.clientReadPlatformService = readPlatformService;
this.officeReadPlatformService = officeReadPlatformService; this.officeReadPlatformService = officeReadPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer; this.toApiJsonSerializer = toApiJsonSerializer;
this.clientAccountSummaryToApiJsonSerializer = clientAccountSummaryToApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper; this.apiRequestParameterHelper = apiRequestParameterHelper;
this.apiDataConversionService = apiDataConversionService; this.apiDataConversionService = apiDataConversionService;
this.apiJsonSerializerService = apiJsonSerializerService;
this.commandSourceReadPlatformService = commandsReadPlatformService; this.commandSourceReadPlatformService = commandsReadPlatformService;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
} }
@@ -251,12 +250,17 @@ public class ClientsApiResource {
context.authenticatedUser().validateHasReadPermission("CLIENT"); context.authenticatedUser().validateHasReadPermission("CLIENT");
final Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
final ClientAccountSummaryCollectionData clientAccount = this.clientReadPlatformService.retrieveClientAccountDetails(clientId); final ClientAccountSummaryCollectionData clientAccount = this.clientReadPlatformService.retrieveClientAccountDetails(clientId);
return this.apiJsonSerializerService.serializeClientAccountSummaryCollectionDataToJson(prettyPrint, responseParameters, final Set<String> CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("pendingApprovalLoans",
clientAccount); "awaitingDisbursalLoans", "openLoans", "closedLoans", "anyLoanCount", "pendingApprovalLoanCount",
"awaitingDisbursalLoanCount", "activeLoanCount", "closedLoanCount", "pendingApprovalDespositAccountsCount",
"pendingApprovalDespositAccounts", "approvedDespositAccountsCount", "approvedDespositAccounts",
"withdrawnByClientDespositAccountsCount", "withdrawnByClientDespositAccounts", "closedDepositAccountsCount",
"closedDepositAccounts", "rejectedDepositAccountsCount", "rejectedDepositAccounts", "preclosedDepositAccountsCount",
"preclosedDepositAccounts"));
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.clientAccountSummaryToApiJsonSerializer.serialize(settings, clientAccount, CLIENT_ACCOUNTS_DATA_PARAMETERS);
} }
} }
@@ -16,14 +16,15 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.mifosplatform.infrastructure.core.api.ApiParameterHelper; import org.mifosplatform.infrastructure.core.api.ApiParameterHelper;
import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper;
import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService; import org.mifosplatform.infrastructure.core.api.PortfolioApiDataConversionService;
import org.mifosplatform.infrastructure.core.api.PortfolioApiJsonSerializerService;
import org.mifosplatform.infrastructure.core.data.EntityIdentifier; import org.mifosplatform.infrastructure.core.data.EntityIdentifier;
import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.organisation.office.data.OfficeLookup; import org.mifosplatform.organisation.office.data.OfficeLookup;
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService; import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
@@ -43,29 +44,40 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class GroupsApiResource { public class GroupsApiResource {
@Autowired private static final Set<String> GROUP_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "officeId", "name", "externalId",
"clientMembers", "allowedClients", "allowedOffices"));
private final PlatformSecurityContext context;
private GroupReadPlatformService groupReadPlatformService; private GroupReadPlatformService groupReadPlatformService;
private final GroupWritePlatformService groupWritePlatformService;
private final ClientReadPlatformService clientReadPlatformService;
private final OfficeReadPlatformService officeReadPlatformService;
private final ToApiJsonSerializer<GroupData> toApiJsonSerializer;
private final ToApiJsonSerializer<GroupAccountSummaryCollectionData> groupSummaryToApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private GroupWritePlatformService groupWritePlatformService; public GroupsApiResource(
final PlatformSecurityContext context,
@Autowired final GroupReadPlatformService groupReadPlatformService,
private ClientReadPlatformService clientReadPlatformService; final GroupWritePlatformService groupWritePlatformService,
final ClientReadPlatformService clientReadPlatformService,
@Autowired final OfficeReadPlatformService officeReadPlatformService,
private PortfolioApiDataConversionService apiDataConversionService; final ToApiJsonSerializer<GroupData> toApiJsonSerializer,
final ToApiJsonSerializer<GroupAccountSummaryCollectionData> groupSummaryToApiJsonSerializer,
@Autowired final ApiRequestParameterHelper apiRequestParameterHelper,
private OfficeReadPlatformService officeReadPlatformService; final PortfolioApiDataConversionService apiDataConversionService) {
this.context = context;
@Autowired this.groupReadPlatformService = groupReadPlatformService;
private PortfolioApiJsonSerializerService apiJsonSerializerService; this.groupWritePlatformService = groupWritePlatformService;
this.clientReadPlatformService = clientReadPlatformService;
@Autowired this.officeReadPlatformService = officeReadPlatformService;
private PlatformSecurityContext context; this.toApiJsonSerializer = toApiJsonSerializer;
this.groupSummaryToApiJsonSerializer = groupSummaryToApiJsonSerializer;
private static final Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "officeId", "name", "externalId", this.apiRequestParameterHelper = apiRequestParameterHelper;
"clientMembers")); this.apiDataConversionService = apiDataConversionService;
}
@GET @GET
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@@ -77,17 +89,10 @@ public class GroupsApiResource {
context.authenticatedUser().validateHasReadPermission("GROUP"); context.authenticatedUser().validateHasReadPermission("GROUP");
final String extraCriteria = getGroupExtraCriteria(sqlSearch, officeId, externalId, name, hierarchy); final String extraCriteria = getGroupExtraCriteria(sqlSearch, officeId, externalId, name, hierarchy);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
Collection<GroupData> groups = this.groupReadPlatformService.retrieveAllGroups(extraCriteria); Collection<GroupData> groups = this.groupReadPlatformService.retrieveAllGroups(extraCriteria);
return this.apiJsonSerializerService.serializeGroupDataToJson(prettyPrint, responseParameters, groups); final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, groups, GROUP_DATA_PARAMETERS);
} }
@GET @GET
@@ -99,13 +104,6 @@ public class GroupsApiResource {
context.authenticatedUser().validateHasReadPermission("GROUP"); context.authenticatedUser().validateHasReadPermission("GROUP");
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
GroupData group = this.groupReadPlatformService.retrieveGroup(groupId); GroupData group = this.groupReadPlatformService.retrieveGroup(groupId);
final Collection<ClientLookup> clientMembers = this.groupReadPlatformService.retrieveClientMembers(groupId); final Collection<ClientLookup> clientMembers = this.groupReadPlatformService.retrieveClientMembers(groupId);
Collection<ClientLookup> availableClients = null; Collection<ClientLookup> availableClients = null;
@@ -115,9 +113,6 @@ public class GroupsApiResource {
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters()); boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
if (template) { if (template) {
responseParameters.add("allowedClients");
responseParameters.add("allowedOffices");
if (officeId != null) { if (officeId != null) {
availableClients = this.clientReadPlatformService.retrieveAllIndividualClientsForLookupByOfficeId(officeId); availableClients = this.clientReadPlatformService.retrieveAllIndividualClientsForLookupByOfficeId(officeId);
} else { } else {
@@ -131,7 +126,8 @@ public class GroupsApiResource {
group = new GroupData(group, group.clientMembers(), availableClients, allowedOffices); group = new GroupData(group, group.clientMembers(), availableClients, allowedOffices);
} }
return this.apiJsonSerializerService.serializeGroupDataToJson(prettyPrint, responseParameters, group); final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, group, GROUP_DATA_PARAMETERS);
} }
@GET @GET
@@ -142,58 +138,51 @@ public class GroupsApiResource {
context.authenticatedUser().validateHasReadPermission("GROUP"); context.authenticatedUser().validateHasReadPermission("GROUP");
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); GroupData groupTemplateData;
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
responseParameters.addAll(Arrays.asList("officeId", "allowedClients", "allowedOffices"));
GroupData groupData;
if (officeId != null) { if (officeId != null) {
groupData = this.groupReadPlatformService.retrieveNewGroupDetails(officeId); groupTemplateData = this.groupReadPlatformService.retrieveNewGroupDetails(officeId);
} else { } else {
groupData = this.groupReadPlatformService.retrieveNewGroupDetails(context.authenticatedUser().getOffice().getId()); groupTemplateData = this.groupReadPlatformService.retrieveNewGroupDetails(context.authenticatedUser().getOffice().getId());
} }
return this.apiJsonSerializerService.serializeGroupDataToJson(prettyPrint, responseParameters, groupData); final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, groupTemplateData, GROUP_DATA_PARAMETERS);
} }
@POST @POST
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response createGroup(final String jsonRequestBody) { public String createGroup(final String jsonRequestBody) {
final GroupCommand command = this.apiDataConversionService.convertJsonToGroupCommand(null, jsonRequestBody); final GroupCommand command = this.apiDataConversionService.convertJsonToGroupCommand(null, jsonRequestBody);
EntityIdentifier entityIdentifier = this.groupWritePlatformService.createGroup(command); EntityIdentifier entityIdentifier = this.groupWritePlatformService.createGroup(command);
return Response.ok().entity(entityIdentifier).build(); return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
@PUT @PUT
@Path("{groupId}") @Path("{groupId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response updateGroup(@PathParam("groupId") final Long groupId, final String jsonRequestBody) { public String updateGroup(@PathParam("groupId") final Long groupId, final String jsonRequestBody) {
final GroupCommand command = this.apiDataConversionService.convertJsonToGroupCommand(groupId, jsonRequestBody); final GroupCommand command = this.apiDataConversionService.convertJsonToGroupCommand(groupId, jsonRequestBody);
EntityIdentifier entityIdentifier = this.groupWritePlatformService.updateGroup(command); EntityIdentifier entityIdentifier = this.groupWritePlatformService.updateGroup(command);
return Response.ok().entity(entityIdentifier).build(); return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
@DELETE @DELETE
@Path("{groupId}") @Path("{groupId}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public Response deleteGroup(@PathParam("groupId") final Long groupId) { public String deleteGroup(@PathParam("groupId") final Long groupId) {
EntityIdentifier entityIdentifier = this.groupWritePlatformService.deleteGroup(groupId); EntityIdentifier entityIdentifier = this.groupWritePlatformService.deleteGroup(groupId);
return Response.ok().entity(entityIdentifier).build(); return this.toApiJsonSerializer.serialize(entityIdentifier);
} }
@GET @GET
@@ -204,20 +193,14 @@ public class GroupsApiResource {
context.authenticatedUser().validateHasReadPermission("GROUP"); context.authenticatedUser().validateHasReadPermission("GROUP");
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("pendingApprovalLoans", "awaitingDisbursalLoans", GroupAccountSummaryCollectionData groupAccount = this.groupReadPlatformService.retrieveGroupAccountDetails(groupId);
"openLoans", "closedLoans", "anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount", "activeLoanCount",
"closedLoanCount")); final Set<String> GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("pendingApprovalLoans",
"awaitingDisbursalLoans", "openLoans", "closedLoans", "anyLoanCount", "pendingApprovalLoanCount", "awaitingDisbursalLoanCount",
"activeLoanCount", "closedLoanCount"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) { return this.groupSummaryToApiJsonSerializer.serialize(settings, groupAccount, GROUP_ACCOUNTS_DATA_PARAMETERS);
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
GroupAccountSummaryCollectionData clientAccount = this.groupReadPlatformService.retrieveGroupAccountDetails(groupId);
return this.apiJsonSerializerService.serializeGroupAccountSummaryCollectionDataToJson(prettyPrint, responseParameters,
clientAccount);
} }
// 'g.' preffix because of ERROR 1052 (23000): Column 'column_name' in where // 'g.' preffix because of ERROR 1052 (23000): Column 'column_name' in where