Project

General

Profile

Actions

Defect #1799

closed

Couldn't create identity when IdentityFormDefaultValueGenerator is configured

Added by Vladimír Kotýnek over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Ondřej Kopr
Category:
Generating values
Target version:
Start date:
08/15/2019
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

Version 9.7.2 (current master, pulled today)
In the configuration of IdentityFormDefaultValueGenerator set form definition to default IdmIdentity definition and save.
!Snímek z 2019-08-15 18-59-44.png!
Try to create a new identity.
This error appears:

Definice má špatný typ
Formulářová definice id [913ae48f-bfe4-460e-a0d5-3cb856977102], má špatný typ. Správný typ: [eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto].

In application log you can find:
2019-08-15 18:31:45.567  WARN 21977 --- [nio-8080-exec-7] e.b.i.c.e.ExceptionControllerAdvice      : [core:GENERATOR_FORM_DEFINITION_BAD_TYPE:64960e1a-b7f1-46e5-86d6-65d6d735d70e] Given form definition id [913ae48f-bfe4-460e-a0d5-3cb856977102], has not type. Correct type: [eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto]. ({formDefinitionId=913ae48f-bfe4-460e-a0d5-3cb856977102, dtoType=eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto})

eu.bcvsolutions.idm.core.api.exception.ResultCodeException: Given form definition id [913ae48f-bfe4-460e-a0d5-3cb856977102], has not type. Correct type: [eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto].
    at eu.bcvsolutions.idm.core.generator.identity.IdentityFormDefaultValueGenerator.generate(IdentityFormDefaultValueGenerator.java:68)
    at eu.bcvsolutions.idm.core.generator.identity.IdentityFormDefaultValueGenerator.generate(IdentityFormDefaultValueGenerator.java:37)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultValueGeneratorManager.generate(DefaultValueGeneratorManager.java:70)
    at eu.bcvsolutions.idm.core.model.event.processor.EntityGenerateValuesProcessor.process(EntityGenerateValuesProcessor.java:45)
    at eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor.onApplicationEvent(AbstractEntityEventProcessor.java:238)

There is an exception thrown from method public IdmIdentityDto generate(IdmIdentityDto dto, IdmGenerateValueDto valueGenerator) in class IdentityFormDefaultValueGenerator
This is the problematic piece of code:

        if (formDefinition != null && !formDefinition.getType().equals(getDtoClass().getCanonicalName())) {
            LOG.error("Given form definition isn't for entity!");
            throw new ResultCodeException(CoreResultCode.GENERATOR_FORM_DEFINITION_BAD_TYPE,
                    ImmutableMap.of(
                            "formDefinitionId", formDefinition.getId(),
                            "dtoType", getDtoClass().getCanonicalName()));
        }

The problem is, that the type of the definition is "eu.bcvsolutions.idm.core.model.entity.IdmIdentity", however getCanonicalName returns "eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto".

This was tested on two different environments with the same version of CzechIdM with the same result.

The impact of this bug is, that default values of identity EAVs doesn't apply.


Files

Snímek z 2019-08-15 18-59-44.png (113 KB) Snímek z 2019-08-15 18-59-44.png Vladimír Kotýnek, 08/15/2019 05:05 PM
Actions #1

Updated by Ondřej Kopr over 5 years ago

  • Status changed from New to In Progress
Actions #2

Updated by Ondřej Kopr over 5 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Ondřej Kopr to Radek Tomiška
  • % Done changed from 0 to 90

Thank you for check this situation. For this generator doesn't make sense select specific form definition, however I fixed it this. Tests are included.

Please Radek could you make a review?

Commit: https://github.com/bcvsolutions/CzechIdMng/commit/1c7649605ede7bf3a0c5ca9f59d5c0ecde45be81 (branch: develop)

Thank you.

Actions #3

Updated by Radek Tomiška over 5 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Radek Tomiška to Ondřej Kopr
  • Priority changed from High to Normal
  • Target version changed from Rhyolite (9.7.5) to Rhyolite (9.7.3)
  • % Done changed from 90 to 100

I did test and review, it works, thx! I just changed error message localization:
https://github.com/bcvsolutions/CzechIdMng/commit/97c7fbe54f3f9aceeefe450b84a2ac5957000085

Note: Sorry Ondra, I broke your generator, when entity usage was replaced by dto.

Actions #4

Updated by Radek Tomiška over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF