Project

General

Profile

Actions

Defect #2121

closed

Requests for automatic roles can't be displayed after deleting a tree node which used to have an automatic role

Added by Alena Peterová about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Ondrej Husník
Category:
Automatic roles
Target version:
Start date:
03/17/2020
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

Tested on version 9.7.11

Steps to reproduce:
  • create an automatic role for a tree node
  • remove the automatic role
  • remove the tree node
  • try to display Audit -> Automatic roles:

Log:

org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Unable to find eu.bcvsolutions.idm.core.model.entity.IdmTreeNode with id 60672e62-551f-40a0-95f0-9b44a559eb25; nested exception is javax.persistence.EntityNotFoundException: Unable to find eu.bcvsolutions.idm.core.model.entity.IdmTreeNode with id 60672e62-551f-40a0-95f0-9b44a559eb25
    at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:389)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:227)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:436)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy280.findAll(Unknown Source)
    at eu.bcvsolutions.idm.core.api.service.AbstractReadDtoService.findEntities(AbstractReadDtoService.java:330)
    at eu.bcvsolutions.idm.core.api.service.AbstractReadDtoService.find(AbstractReadDtoService.java:203)
    at eu.bcvsolutions.idm.core.api.service.AbstractReadDtoService$$FastClassBySpringCGLIB$$120a9283.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
    at eu.bcvsolutions.idm.core.model.service.impl.DefaultIdmAutomaticRoleRequestService$$EnhancerBySpringCGLIB$$d2912d57.find(<generated>)

Workaround:
Delete the links for non-existent tree node from the DB:

update idm_auto_role_request set tree_node_id = null where tree_node_id not in (select id from idm_tree_node);


Files

requests_for_automatic_roles.png (29.4 KB) requests_for_automatic_roles.png Alena Peterová, 03/17/2020 09:05 AM
requests_error.png (14.7 KB) requests_error.png Alena Peterová, 03/17/2020 09:21 AM
Actions #1

Updated by Alena Peterová about 4 years ago

Low low priority IMHO - you rarely delete tree nodes.
Ale hlásit se to musí ;-)

Actions #2

Updated by Ondřej Kopr about 4 years ago

  • Assignee changed from Ondřej Kopr to Radek Tomiška
Actions #3

Updated by Vít Švanda about 4 years ago

  • Assignee changed from Radek Tomiška to Ondrej Husník
  • Target version set to Rhyolite (9.7.17)

This is my fault, there is missing integrity on delete of a tree-node (TreeNodeDeleteProcessor).

Ondra, please fix this in LTS branch.

Actions #4

Updated by Ondrej Husník about 4 years ago

  • Status changed from New to In Progress
Actions #5

Updated by Ondrej Husník about 4 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Ondrej Husník to Radek Tomiška
  • % Done changed from 0 to 90

Referential integrity of automatic role requests was fixed by removing reference of the deleted tree node from request table.
Added test. Committed directly to version 9.7.17.

https://github.com/bcvsolutions/CzechIdMng/pull/97/commits/e63d8ff61606f69ca42f04f5517a0d696de294e6

Please provide me a feedback.

Actions #6

Updated by Radek Tomiška about 4 years ago

  • Status changed from Needs feedback to Closed
  • Assignee changed from Radek Tomiška to Ondrej Husník
  • % Done changed from 90 to 100

I did test and code review, it's awesome, thx!

Merged into develop too:
https://github.com/bcvsolutions/CzechIdMng/commit/9397fd6a6aa9aa8c9e838b716fbfa2c911a0b28f

Actions

Also available in: Atom PDF