Attachments
Attachments
Issue Links
- is duplicated by
-
FALCON-793 Rest API for getting the list of entities with pagination and filter
- Resolved
Public signup for this instance is disabled. Go to our Self serve sign up page to request an account. Report potential security issues privately
FALCON-793 Rest API for getting the list of entities with pagination and filter
Couple of things that needs to be taken care of before considering complete:
Working on CLI and tests. All code required for Falcon-471 and Falcon-472 will be part of this patch.
Thank you
Please also make sure to update the docs in docs module for the API changes.
new patch available. This patch handles following.
This version of patch added unit tests that can handle implicit user filter.
A lot of issues with the code and it wont compile.
FalconCLI
if (commandLine.getOptionValue(OFFSET_OPT) != null) { try { offset = Integer.parseInt(commandLine.getOptionValue(OFFSET_OPT)); } catch (NumberFormatException e) { throw new FalconCLIException("Input value provided for queryParam \"offset\" is not a valid Integer"); } }
if (fields == null) { fields = ""; } else if (!fields.equalsIgnoreCase("status")) { throw new FalconCLIException("Invalid value for queryParam \"fields\" : "+fields); }
FalconClient
AbstractEntityManager
protected UserGroupInformation currentUgi
AbstractInstanceManager
Thank you Venkatesh. I followed your suggestions for ResourceList.twiki, AbstractEntityManager, AbstractInstanceManager and FalconCLI.
FalconCLI is becoming unwieldy and we should tackle it in a separate JIRA ticket.
FalconClient - I did not remove the parameterCheck, I moved it to encompass more methods.
EntityManagerJerseyIT - The test was disabled by mistake, I enabled it again.
ProcessInstanceManagerIT - The tests have been disabled in the source as they take too long. For the sake of testing, I enabled them, ran the tests and disabled again once all the tests passed.
1. Please remove protected EntityList getEntityList in AbstractEntityManager and call public method from tests
2. AbstractEntityManager line 504: configStore.get can return null. Can we do null validation before accessing it?
3. Minor nit: In previous version entityTypeString = type.toLowerCase(). Can you retain this behavior?
4. AbstractEntityManager.getStatusString : null check at 606 is redundant since enum.name can never return null. Also please change the caught exception from throwable to FalconException
5. nit: Lot of places you check the condition and then do ! e.g. Instead of if (!(filterTagsList.size() == 0)) , please use != 0
6. nit: Few util methods can be made static and params final
7. AbstractEntityManager Line 623 can filterValue be null?
8. AbstractEntityManager : Move try IllegalArgumentException to line 638
9. Can you rename getReturnArrayLength to getRequiredNumberOfResults
10. FalconCLI: Validate methods ideally should be void methods doing validation and shouldn't return any value. Can you please change it?
11. FalconClient : Why was import changed to *? Please import only required classes.
Thanks!
Thank you sowmyaramesh for the suggestions. I agree with and made all the changes you recommended.
bvellanki, few minor nits:
if (orderBy == null) { orderBy = ""; } if (filterBy == null) { filterBy = ""; } if (instanceOrderBy == null) { instanceOrderBy = ""; } if (instanceFilter == null) { instanceFilter = ""; } if (fields == null) { fields = ""; }
if (filterBy != null && !filterBy.equals("")) {
Use StringUtils.isEmpty instead
Added support for pagination for list api. New query params introduced are
– orderBy : String. Optional. Sort the list results by specific key. Supports orderBy name, status and entity type. By default, results are not sorted.
– offset : int. Optional. Start showing results from Nth entity. Default is 1st entity.
– count : int. Optional. Show N results per fetch. Default value is -1 (show all entities)