[MNT-24310] Fix AGS Rest API returning non RM objects (#2787)

* [MNT-24310] Fix AGS Rest API returning non RM objects

* [MNT-24310] Fix AGS Rest API returning non RM objects

* [MNT-24310] Fix AGS Rest API returning non RM objects

* [MNT-24310] Fix AGS Rest API returning non RM objects

* [MNT-24310] Fix AGS Rest API returning non RM objects
This commit is contained in:
Suneet Gupta
2024-07-17 15:14:57 +05:30
committed by GitHub
parent 10f4b10ae8
commit 278aa59302

View File

@@ -92,7 +92,7 @@ public class SearchTypesFactory
boolean includeRecords = false; boolean includeRecords = false;
boolean includeSubTypes = false; boolean includeSubTypes = false;
if (q != null) if (q != null && q.getTree() != null)
{ {
// filtering via "where" clause // filtering via "where" clause
MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(listFolderChildrenEqualsQueryProperties, null); MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(listFolderChildrenEqualsQueryProperties, null);
@@ -101,11 +101,11 @@ public class SearchTypesFactory
Boolean isUnfiledRecordFolder = propertyWalker.getProperty(UnfiledChild.PARAM_IS_UNFILED_RECORD_FOLDER, Boolean isUnfiledRecordFolder = propertyWalker.getProperty(UnfiledChild.PARAM_IS_UNFILED_RECORD_FOLDER,
WhereClauseParser.EQUALS, Boolean.class); WhereClauseParser.EQUALS, Boolean.class);
Boolean isRecord = propertyWalker.getProperty(UnfiledChild.PARAM_IS_RECORD, WhereClauseParser.EQUALS, Boolean.class); Boolean isRecord = propertyWalker.getProperty(UnfiledChild.PARAM_IS_RECORD, WhereClauseParser.EQUALS, Boolean.class);
if ((isUnfiledRecordFolder != null && isUnfiledRecordFolder.booleanValue()) || (isRecord != null && !isRecord.booleanValue())) if (checkIncludeUnfiledRecordFolders(isUnfiledRecordFolder, isRecord))
{ {
includeUnfiledRecordFolders = true; includeUnfiledRecordFolders = true;
} }
else if ((isUnfiledRecordFolder != null && !isUnfiledRecordFolder.booleanValue()) || (isRecord != null && isRecord.booleanValue())) else if (checkIncludeRecords(isUnfiledRecordFolder, isRecord))
{ {
includeRecords = true; includeRecords = true;
} }
@@ -199,11 +199,11 @@ public class SearchTypesFactory
WhereClauseParser.EQUALS, Boolean.class); WhereClauseParser.EQUALS, Boolean.class);
Boolean isRecordCategory = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, WhereClauseParser.EQUALS, Boolean.class); Boolean isRecordCategory = propertyWalker.getProperty(RecordCategoryChild.PARAM_IS_RECORD_CATEGORY, WhereClauseParser.EQUALS, Boolean.class);
if ((isRecordFolder != null && isRecordFolder.booleanValue()) || (isRecordCategory != null && !isRecordCategory.booleanValue())) if (checkIncludeUnfiledRecordFolders(isRecordFolder, isRecordCategory))
{ {
includeRecordFolders = true; includeRecordFolders = true;
} }
else if ((isRecordFolder != null && !isRecordFolder.booleanValue()) || (isRecordCategory != null && isRecordCategory.booleanValue())) else if (checkIncludeRecords(isRecordFolder, isRecordCategory))
{ {
includeRecordCategories = true; includeRecordCategories = true;
} }
@@ -291,4 +291,16 @@ public class SearchTypesFactory
return new Pair<>(filterNodeTypeQName, filterIncludeSubTypes); return new Pair<>(filterNodeTypeQName, filterIncludeSubTypes);
} }
private static boolean checkIncludeRecords(Boolean isUnfiledRecordFolder, Boolean isRecord)
{
return (isUnfiledRecordFolder != null && !isUnfiledRecordFolder.booleanValue()) || (isRecord != null
&& isRecord.booleanValue());
}
private static boolean checkIncludeUnfiledRecordFolders(Boolean isUnfiledRecordFolder, Boolean isRecord)
{
return (isUnfiledRecordFolder != null && isUnfiledRecordFolder.booleanValue()) || (isRecord != null
&& !isRecord.booleanValue());
}
} }