Ashhar Ahmad Khan created FINERACT-2736:
-------------------------------------------

             Summary: Remove unused FineractEntityAccess 
(createEntityAccess/addNewEntityAccess dead since 2014/2016, no callers, no 
test coverage)
                 Key: FINERACT-2736
                 URL: https://issues.apache.org/jira/browse/FINERACT-2736
             Project: Apache Fineract
          Issue Type: Task
            Reporter: Ashhar Ahmad Khan


*What is being removed*

{{{}FineractEntityAccessWriteServiceImpl{}}}, at 
{{{}fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/{}}},
 has two methods with no live callers.

{{createEntityAccess(JsonCommand command)}} has been an empty stub returning 
null since the file was first created in commit {{9d11434ee7}} (Dec 6 2014). 
There is no API route, {{CommandWrapperBuilder}} method, permission record, or 
command handler for it anywhere in the codebase, and there never has been.

{{addNewEntityAccess(...)}} was implemented from the start and did have one 
caller, 
{{{}FineractEntityAccessUtil.checkConfigurationAndAddProductResrictionsForUserOffice(...){}}}.
 That changed in commit {{66f8d7ce43}} (June 9 2016), which rewrote the caller 
to call {{fineractEntityToEntityMappingRepository.save(...)}} directly instead, 
bypassing the write service entirely. Since then {{addNewEntityAccess}} has had 
zero callers.

Alongside these two methods, the underlying {{FineractEntityAccess}} domain 
object, its repository, its repository wrapper, and the 
{{m_entity_to_entity_access}} table are only ever referenced from inside these 
two dead methods. Nothing else touches them.

 

*Why it's dead code*

The live access control path is {{{}FineractEntityAccessUtil{}}}, used by 
Charges, Loan Products, and Savings Products, which reads from 
{{m_entity_to_entity_mapping}} via {{{}FineractEntityAccessReadServiceImpl{}}}. 
This is a separate table from {{{}m_entity_to_entity_access{}}}. 
{{{}createEntityToEntityMapping{}}}, {{{}updateEntityToEntityMapping{}}}, and 
{{deleteEntityToEntityMapping}} stay exactly as they are and are not touched by 
this change.

{{m_entity_to_entity_access}} has 0 rows in {{load_sample_data.sql}} and the 
project's generated schema docs list it at 0 rows as well.

 

*Changes made*
 * Deleted {{FineractEntityAccess.java}} (domain)
 * Deleted {{FineractEntityAccessRepository.java}}
 * Deleted {{FineractEntityAccessRepositoryWrapper.java}}
 * Deleted {{FineractEntityAccessData.java}}
 * Deleted {{FineractEntityAccessConstants.java}}
 * Deleted {{FineractEntityAccessConfigurationException.java}}
 * Removed {{createEntityAccess}} and {{addNewEntityAccess}} from 
{{FineractEntityAccessWriteService.java}} and 
{{{}FineractEntityAccessWriteServiceImpl.java{}}}, along with the now-unused 
{{entityAccessRepository}} field, constructor param, and dead imports
 * Removed the commented-out 
{{{}updateEntityAccess{}}}/{{{}removeEntityAccess{}}} stubs from the interface
 * Added {{{}0243_remove_unused_entity_access.xml{}}}, a Liquibase changeset 
that drops {{m_entity_to_entity_access}}
 * Removed the {{m_entity_to_entity_access}} table definition and sample data 
block from {{barebones_db.sql}} and {{{}load_sample_data.sql{}}}{{{}{}}}

 

*Verification*
 * Full-repo grep across {{{}.java{}}}, {{{}.xml{}}}, {{.sql}} for 
{{{}FineractEntityAccess{}}}, {{{}FineractEntityAccessRepository{}}}, 
{{{}FineractEntityAccessRepositoryWrapper{}}}, 
{{{}FineractEntityAccessData{}}}, 
{{{}FineractEntityAccessConfigurationException{}}}, and 
{{{}FineractEntityAccessConstants{}}}. No stragglers, all hits excluded as 
still-live ({{{}FineractEntityAccessType{}}}, 
{{{}FineractEntityAccessNotFoundException{}}}, 
{{{}FineractEntityAccessUtil{}}}, {{{}FineractEntityAccessReadService{}}}).
 * No reference to either method in {{fineract-client}} or 
{{{}fineract-client-feign{}}}, no OpenAPI/swagger entry for 
{{{}createEntityAccess{}}}.
 * Test file grep across the repo. No results, no test references either method 
or class.{{{}{}}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to