oleksii-novikov-onix commented on code in PR #6295:
URL: https://github.com/apache/fineract/pull/6295#discussion_r3828364872


##########
fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesReadServiceImpl.java:
##########
@@ -41,9 +48,29 @@
 @Transactional(readOnly = true)
 public class ExternalAssetOwnerLoanProductAttributesReadServiceImpl implements 
ExternalAssetOwnerLoanProductAttributesReadService {
 
+    private static final String INVESTOR_PATH = "org.apache.fineract.investor";
+
     private final ExternalAssetOwnerLoanProductAttributesRepository 
externalAssetOwnerLoanProductAttributesRepository;
     private final LoanProductRepository loanProductRepository;
     private final ExternalAssetOwnerLoanProductAttributesMapper mapper;
+    private final Set<Class<?>> implementingClasses = new 
Reflections(INVESTOR_PATH)
+            
.get(SubTypes.of(ExternalAssetOwnerLoanProductAttribute.class).asClass());
+
+    @Override
+    public List<ExternalTransferLoanProductAttributesTemplateData> 
retrieveExternalAssetOwnerLoanProductAttributesTemplate() {
+        List<ExternalTransferLoanProductAttributesTemplateData> result = new 
ArrayList<>();
+
+        for (Class<?> implementingClass : implementingClasses) {
+            if (implementingClass.isEnum()) {
+                
Arrays.stream(implementingClass.getEnumConstants()).map(ExternalAssetOwnerLoanProductAttribute.class::cast)
+                        .forEach(attribute -> addAttributeValues(result, 
attribute));

Review Comment:
   None of `getAttributeKey`, `getAttributeValues` or `isMultiValue` actually 
looks at the
   constant it's called on, they all return the same type-level data. So 
looping over the enum
   constants just appends the same entry twice, and the endpoint returns 
SETTLEMENT_MODEL
   duplicated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to