Defect #1799
closedCouldn't create identity when IdentityFormDefaultValueGenerator is configured
100%
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