Project

General

Profile

Actions

Defect #2271

closed

Parent folder in catalogue cannot be removed

Added by Vladimír Kotýnek almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Radek Tomiška
Category:
Roles
Target version:
Start date:
05/25/2020
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

In catalogue folder editation form when I have paren folder already set and I want to remove it (make the current folder root), I set the field empty or select "--not selected--". After save of the folder the parent folder is not removed.

@affected version >= 9.7.9


Related issues

Related to IdStory Identity Manager - Task #1888: Update ModelMapperClosedRadek Tomiška10/03/2019

Actions
Actions #1

Updated by Radek Tomiška almost 4 years ago

  • Status changed from New to In Progress
  • Target version set to 10.4.0
Actions #2

Updated by Radek Tomiška almost 4 years ago

Actions #3

Updated by Radek Tomiška almost 4 years ago

  • Description updated (diff)
  • Assignee changed from Radek Tomiška to Vít Švanda

The issue is related to model mapper version 2.3.5 updated in ticket #1888 (the previous 0.7.8 worked correctly, latest 2.3.7 doesn't work too). I was not able to find a way how to fix this issue. Model mapper ignores conversion for 'null' value as source and 'BaseEntity' as destination and leaves originally set value. This wrong behavior is the same for tree nodes too.

The issue can be debug on row 'AbstractReadDtoService#678' where original property value is set even source is null.

I created test to cover this issue (not pass now):
https://github.com/bcvsolutions/CzechIdMng/commit/83d86bb2110df3541f470c5f88c1bd7523decfbc#diff-facf3bce6fd03524d4351bc124a883e0R261

Vitek, could you help me please with this? I tried various ideas, how to solve this, but nothing worked.

Actions #4

Updated by Radek Tomiška almost 4 years ago

  • Target version changed from 10.4.0 to Rhyolite (9.7.17)
Actions #5

Updated by Vít Švanda almost 4 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Vít Švanda to Radek Tomiška
  • % Done changed from 0 to 40

This is very oggly task. I spend more than five hours with these and I am sure this is some bug in ModelMapper.

I think problem starts on row MappingEngineImpl(241) https://github.com/modelmapper/modelmapper/blob/439fba786eae68c84cc61e07f330aad44870e3c4/core/src/main/java/org/modelmapper/internal/MappingEngineImpl.java#L241).
There is checking if source value is not null. Different is in the way how a converter is searching. If value is not null, the converter is found via mapType. If value is null, the converter is trying to find in a connectorStore.

What is conncetor store? It is list of internal conditional converters. After debugging I had idea with use this internal converters and put ours UuidToEntityConvertor to it. These converters are different they supports conditional. So I created new version UuidToEntityConditionalConvertor.

He lives!!

It's brutal, but looks as working solutions. All tests in Core passed. More testing is necessary and may be all ours convertors should be rewritten to Conditional Convertors. Conditional converters has one benefit for us. Only one instance of convertor have to be created and it works for all entities (unlike of standard convertor).

PoC commit: https://github.com/bcvsolutions/CzechIdMng/commit/80e9b9d9caa8ecc22a956287a5e35174ccd19de2

Actions #6

Updated by Radek Tomiška almost 4 years ago

  • Status changed from Needs feedback to In Progress

It's awesome, you found the working combination! I tried the conditional converter too, but with different template (Object, Object) and this doesn't work.

I will move your change into LTS version and refactor EntityToUuidConvertor usage too - the benefit with one converter instance is nice (we have 100+ entities already).

Actions #7

Updated by Radek Tomiška almost 4 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Radek Tomiška to Vít Švanda
  • % Done changed from 40 to 90

I've moved your fix as it is into LTS 9.7.17 and 10.3.2 too, commit:
https://github.com/bcvsolutions/CzechIdMng/commit/28be52893cf4adee04d7b9b39b1540c978a4c8e9

Bigger refactoring is in develop. One converter instance is reused for other converter too, commit:
https://github.com/bcvsolutions/CzechIdMng/commit/06169e42b353c0f05378c1e9a2a53715f701c631

Could you please provide me a feedback for develop?

Actions #8

Updated by Vít Švanda almost 4 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Vít Švanda to Radek Tomiška
  • % Done changed from 90 to 100

I did review. Thnaks for hotfix.

Actions #9

Updated by Radek Tomiška almost 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF