From c4a687c5c907e9ce1be6f9f369e77457d9e08059 Mon Sep 17 00:00:00 2001 From: John Woodlock Date: Thu, 7 Jun 2012 17:47:13 +1000 Subject: [PATCH] associations parameter - works but rubbish coding --- .../ApiJSONFormattingServiceImpl.java | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiJSONFormattingServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiJSONFormattingServiceImpl.java index fbca317a4..35e27c7b1 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiJSONFormattingServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiJSONFormattingServiceImpl.java @@ -78,20 +78,14 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService { } - logger.info("fieldList before template is: " + fieldList - + " filter type is: " + filterType); - fieldList = updateListForTemplate(fieldList, allowedFieldList, queryParams.getFirst("template"), filterType); - logger.info("fieldList before assocs is: " + fieldList - + " filter type is: " + filterType); - fieldList = updateListForAssociations(fieldList, associationFields, queryParams.getFirst("associations"), filterType); - logger.info("fieldList to be processed is: " + fieldList - + " filter type is: " + filterType); + // logger.info("fieldList to be processed is: " + fieldList + // + " filter type is: " + filterType); return convertDataObjectJSON(dataObject, filterName, filterType, fieldList, isTrue(queryParams.getFirst("pretty"))); @@ -120,18 +114,18 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService { String associationFields, String param, String filterType) { if (isPassed(param)) { - logger.info("is associations"); + //logger.info("is associations"); if (param.equalsIgnoreCase("ALL")) { - logger.info("is ALL"); + //logger.info("is ALL"); if (filterType.equals("I")) { - logger.info("is Include"); + //logger.info("is Include"); return fieldList + "," + associationFields; } - logger.info("is Exclude"); + //logger.info("is Exclude"); return fieldList; } - logger.info("Not ALL"); + //logger.info("Not ALL"); Set fullAssociationsSet = createSetFromString(associationFields); Set paramAssociationsSet = createSetFromString(param); @@ -139,15 +133,15 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService { String selectedAssociationFields = createIncludedInStringList( paramAssociationsSet, fullAssociationsSet); - logger.info("is Include - selected fields are :" - + selectedAssociationFields); + //logger.info("is Include - selected fields are :" + // + selectedAssociationFields); return fieldList + "," + selectedAssociationFields; } String unSelectedAssociationFields = createNotIncludedInStringList( fullAssociationsSet, paramAssociationsSet); - logger.info("is Exclude - unselected fields are :" - + unSelectedAssociationFields); + //logger.info("is Exclude - unselected fields are :" + // + unSelectedAssociationFields); if (fieldList.equals("")) { return unSelectedAssociationFields;