associations parameter - works but rubbish coding
This commit is contained in:
+11
-17
@@ -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<String> fullAssociationsSet = createSetFromString(associationFields);
|
||||
Set<String> 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;
|
||||
|
||||
Reference in New Issue
Block a user