Project

General

Profile

Actions

Task #1037

closed

Fix pageable in automatic roles

Added by Ondřej Kopr about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
High
Assignee:
Ondřej Kopr
Category:
Roles
Target version:
Start date:
03/22/2018
Due date:
% Done:

100%

Estimated time:
Owner:

Description

Together we found problem with pageable in automatic roles. Please fix it.


Files

diagram.png (18 KB) diagram.png Ondřej Kopr, 03/22/2018 09:24 PM
before.gif (388 KB) before.gif Ondřej Kopr, 03/27/2018 11:41 AM
after.gif (332 KB) after.gif Ondřej Kopr, 03/27/2018 11:41 AM
Actions #1

Updated by Ondřej Kopr about 6 years ago

  • % Done changed from 0 to 90

Only place where is this mistake is in service: DefaultIdmAutomaticRoleAttributeService method getRulesForContract, another places where is implemented pageable in automatic roles (ProcessAutomaticRoleByAttributeTaskExecutor) is pageable implemented correct. Thanks guys for help with debug.

Actions #2

Updated by Ondřej Kopr about 6 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Ondřej Kopr to Vít Švanda

Please Vitek could you made a review? Thank you :)

Commit: https://github.com/bcvsolutions/CzechIdMng/commit/95ca42a015405d5897b453cb02e6e71b2fa3391f (branch hotfix/7.8.5)

Actions #3

Updated by Ondřej Kopr about 6 years ago

I'm apologize all people for shorter describe of this problem, I'm not friend with documentation and English :D , I prefer to insert some code or commits and I read this code before I read some english description, but this is my personal priority. So there is some better describe of this problem:

In our application we are using spring data. Spring data has feature that allow paging and sorting record's/data obtained from repositories (eq. Pageable) This behavior is also good for performance improvements with iterate over many records (it's something like classic iterator in many other programming languages).

With create new request to get some entities from repository you may specified PageRequest. PageRequest contains information about sort, size, actual page and etc. see documentation I'm using pagerequest for limiting number of entities in one slice (more about slices) with this slice I made recalculation (slice containtains automatic roles for recalculations) in this request I also use ours filters for limit number of result. The filter contains these filtering attributes:
  • contenct - FALSE (boolean property that filtering automatic roles in concept true/false),
  • ruleType - Enumeration AutomaticRoleAttributeRuleType this enumeration is filtering by type of rules (IDENTITY, IDENTITY_EAV, CONTRACT, CONTRACT_EAV),
  • hasRules - boolean property that filtering automatic roles that has minimal one rule,
  • this isn't all filtering attribute, seeIdmAutomaticRoleFilter

Default page size for iterate over automatic roles in this case is 10 (this is defined in property: PROCESS_ROLE_SIZE).

Old behavior for this case:
In first 10 recordord obtained from repository is everything ok, filter and page request was used correctly and the result contains all record that we need. But in second interation is used again next page from previous request (this is correct), but this request doesnt contain filter, so result was filled with another contract and recalculation was longer, because recalculate was done even for automatic roles that hasn't any rules and etc. For better understanting problem you can see picture:

Finally solutions was easy for implementing, only changed thing was: propagate filter to next request. For future request dont forget: nextPageable returns size, sort, actual page, but doesn't return filtering paramaters!

I'm apologize for smaller description the problem. I'm not really friend with documentation and description.

Actions #4

Updated by Vít Švanda about 6 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Vít Švanda to Ondřej Kopr
  • % Done changed from 90 to 100

I did review and test. It works fine, you are awesome. For next time please do shorter description I am not good reader.

Actions #5

Updated by Ondřej Kopr about 6 years ago

  • Status changed from Resolved to Closed

Thank you I will fix it.

Actions #6

Updated by Ondřej Kopr about 6 years ago

  • Target version changed from Hematite (8.0.0) to Garnet (7.8.5)
Actions #7

Updated by Ondřej Kopr about 6 years ago

Next thing that it was repaired in this ticket is add entity type for recalculation automatic roles:

In processors IdentityAutomaticRoleProcessor and IdentityContractAutomaticRoleProcessor was add AutomaticRoleAttributeRuleType. AutomaticRoleAttributeRuleType is enumeration that is used in rules.

New behavior in processors check what event type is throw, for example:
  • contract - create, update: automatic rules that has minimal one rule with contract rule type CONTRACT,
  • contract - eav_save: automatic rules that has minimal one rule with contract rule type CONTRACT_EAV,
  • identity - create update: automatic rules that has minimal one rule with contract rule type IDENTITY,
  • identity - eav_save: automatic rules that has minimal one rule with contract rule type IDENTITY_EAV.

This is new performance feature, now is after identity save recalculate only automatic roles that has at least one rule for identity.

Before :(

After :)

Actions

Also available in: Atom PDF