Github user nazeer1100126 commented on a diff in the pull request: https://github.com/apache/incubator-fineract/pull/88#discussion_r61570545 --- Diff: fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/FineractEntityAccessReadServiceImpl.java --- @@ -220,30 +197,35 @@ public FineractEntityAccessData mapRow(final ResultSet rs, @SuppressWarnings("un public String getSQLQueryInClauseIDList_ForLoanProductsForOffice(Long officeId, boolean includeAllOffices) { FineractEntityType firstEntityType = FineractEntityType.OFFICE; - FineractEntityAccessType accessType = FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS; - FineractEntityType secondEntityType = FineractEntityType.LOAN_PRODUCT; + + FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository + .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS.toStr()); + Long relId = fineractEntityRelation.getId(); - return getSQLQueryInClause_WithListOfIDsForEntityAccess(officeId, firstEntityType, accessType, secondEntityType, includeAllOffices); + return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices); } @Override public String getSQLQueryInClauseIDList_ForSavingsProductsForOffice(Long officeId, boolean includeAllOffices) { FineractEntityType firstEntityType = FineractEntityType.OFFICE; - FineractEntityAccessType accessType = FineractEntityAccessType.OFFICE_ACCESS_TO_SAVINGS_PRODUCTS; - FineractEntityType secondEntityType = FineractEntityType.SAVINGS_PRODUCT; + FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository + .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_SAVINGS_PRODUCTS.toStr()); + Long relId = fineractEntityRelation.getId(); + - return getSQLQueryInClause_WithListOfIDsForEntityAccess(officeId, firstEntityType, accessType, secondEntityType, includeAllOffices); + return getSQLQueryInClause_WithListOfIDsForEntityAccess(firstEntityType, relId, officeId, includeAllOffices); } @Override public String getSQLQueryInClauseIDList_ForChargesForOffice(Long officeId, boolean includeAllOffices) { FineractEntityType firstEntityType = FineractEntityType.OFFICE; - FineractEntityAccessType accessType = FineractEntityAccessType.OFFICE_ACCESS_TO_CHARGES; - FineractEntityType secondEntityType = FineractEntityType.CHARGE; - - return getSQLQueryInClause_WithListOfIDsForEntityAccess(officeId, firstEntityType, accessType, secondEntityType, includeAllOffices); + FineractEntityRelation fineractEntityRelation = fineractEntityRelationRepository + .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_CHARGES.toStr()); + Long relId = fineractEntityRelation.getId(); --- End diff -- There is a chance of null pointer exception if FineractEntityAccessType.OFFICE_ACCESS_TO_CHARGES doesn't exists
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---