associations parameter - works but rubbish coding

This commit is contained in:
John Woodlock
2012-06-07 17:47:13 +10:00
parent db27f429cd
commit c4a687c5c9
@@ -78,20 +78,14 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
} }
logger.info("fieldList before template is: " + fieldList
+ " filter type is: " + filterType);
fieldList = updateListForTemplate(fieldList, allowedFieldList, fieldList = updateListForTemplate(fieldList, allowedFieldList,
queryParams.getFirst("template"), filterType); queryParams.getFirst("template"), filterType);
logger.info("fieldList before assocs is: " + fieldList
+ " filter type is: " + filterType);
fieldList = updateListForAssociations(fieldList, associationFields, fieldList = updateListForAssociations(fieldList, associationFields,
queryParams.getFirst("associations"), filterType); queryParams.getFirst("associations"), filterType);
logger.info("fieldList to be processed is: " + fieldList // logger.info("fieldList to be processed is: " + fieldList
+ " filter type is: " + filterType); // + " filter type is: " + filterType);
return convertDataObjectJSON(dataObject, filterName, filterType, return convertDataObjectJSON(dataObject, filterName, filterType,
fieldList, isTrue(queryParams.getFirst("pretty"))); fieldList, isTrue(queryParams.getFirst("pretty")));
@@ -120,18 +114,18 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
String associationFields, String param, String filterType) { String associationFields, String param, String filterType) {
if (isPassed(param)) { if (isPassed(param)) {
logger.info("is associations"); //logger.info("is associations");
if (param.equalsIgnoreCase("ALL")) { if (param.equalsIgnoreCase("ALL")) {
logger.info("is ALL"); //logger.info("is ALL");
if (filterType.equals("I")) { if (filterType.equals("I")) {
logger.info("is Include"); //logger.info("is Include");
return fieldList + "," + associationFields; return fieldList + "," + associationFields;
} }
logger.info("is Exclude"); //logger.info("is Exclude");
return fieldList; return fieldList;
} }
logger.info("Not ALL"); //logger.info("Not ALL");
Set<String> fullAssociationsSet = createSetFromString(associationFields); Set<String> fullAssociationsSet = createSetFromString(associationFields);
Set<String> paramAssociationsSet = createSetFromString(param); Set<String> paramAssociationsSet = createSetFromString(param);
@@ -139,15 +133,15 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
String selectedAssociationFields = createIncludedInStringList( String selectedAssociationFields = createIncludedInStringList(
paramAssociationsSet, fullAssociationsSet); paramAssociationsSet, fullAssociationsSet);
logger.info("is Include - selected fields are :" //logger.info("is Include - selected fields are :"
+ selectedAssociationFields); // + selectedAssociationFields);
return fieldList + "," + selectedAssociationFields; return fieldList + "," + selectedAssociationFields;
} }
String unSelectedAssociationFields = createNotIncludedInStringList( String unSelectedAssociationFields = createNotIncludedInStringList(
fullAssociationsSet, paramAssociationsSet); fullAssociationsSet, paramAssociationsSet);
logger.info("is Exclude - unselected fields are :" //logger.info("is Exclude - unselected fields are :"
+ unSelectedAssociationFields); // + unSelectedAssociationFields);
if (fieldList.equals("")) { if (fieldList.equals("")) {
return unSelectedAssociationFields; return unSelectedAssociationFields;