dont show curreny options by default in json, instead only show when using template resource or when template flag is provided.

This commit is contained in:
Keith Woodlock
2012-08-03 15:53:33 +01:00
parent 0b41f626b2
commit bf6c1b5606
3 changed files with 11 additions and 6 deletions
@@ -70,7 +70,8 @@ public class SavingProductsApiResource {
@Produces({MediaType.APPLICATION_JSON})
public String retrieveAllSavingProducts(@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "name", "description", "createdOn", "lastModifedOn","interestRate","currencyCode","digitsAfterDecimal"));
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "name", "description", "createdOn", "lastModifedOn",
"interestRate","currencyCode","digitsAfterDecimal"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
@@ -89,15 +90,19 @@ public class SavingProductsApiResource {
@Produces({MediaType.APPLICATION_JSON})
public String retrieveSavingProductDetails(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "name", "description", "createdOn", "lastModifedOn","interestRate","currencyCode","digitsAfterDecimal"));
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "name", "description", "createdOn", "lastModifedOn",
"interestRate","currencyCode","digitsAfterDecimal"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters);
}
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
//boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
if (template) {
responseParameters.addAll(Arrays.asList("currencyOptions"));
}
SavingProductData savingProduct = this.savingProductReadPlatformService.retrieveSavingProduct(productId);
return this.apiDataConversionService.convertSavingProductDataToJson(prettyPrint, responseParameters, savingProduct);
@@ -1441,7 +1441,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
Set<String> responseParameters, SavingProductData... products) {
Set<String> supportedParameters = new HashSet<String>(
Arrays.asList("id", "name", "description","createdOn", "lastModifedOn","interestRate","currencyCode","digitsAfterDecimal"));
Arrays.asList("id", "name", "description","createdOn", "lastModifedOn","interestRate","currencyCode","digitsAfterDecimal", "currencyOptions"));
final Set<String> parameterNamesToSkip = new HashSet<String>();
@@ -5,7 +5,7 @@
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/mifosplatform-tenants"
username="root"
password="mifos"
password="mysql"
validationQuery="select 1"
maxActive="10"
maxIdle="4"