adamsaghy commented on code in PR #2625:
URL: https://github.com/apache/fineract/pull/2625#discussion_r984321022


##########
fineract-provider/src/main/java/org/apache/fineract/cob/service/ConfigJobParameterServiceImpl.java:
##########
@@ -59,15 +60,22 @@ public JobBusinessStepConfigData 
getBusinessStepConfigByJobName(String jobName)
     public CommandProcessingResult updateStepConfigByJobName(JsonCommand 
command, String jobName)
             throws BusinessStepNotBelongsToJobException {
         List<BusinessStep> businessSteps = dataParser.parseUpdate(command);
-        List<BatchBusinessStep> batchBusinessSteps = 
batchBusinessStepRepository.findAllByJobName(jobName);
-        businessSteps.forEach(newBusinessStepConfig -> {
-            BatchBusinessStep batchBusinessStep = batchBusinessSteps.stream()
-                    .filter(oldBusinessStepConfig -> 
oldBusinessStepConfig.getStepName().equals(newBusinessStepConfig.getStepName()))
-                    
.findFirst().orElseThrow(BusinessStepNotBelongsToJobException::new);
-            batchBusinessStep.setStepName(newBusinessStepConfig.getStepName());
-            batchBusinessStep.setStepOrder(newBusinessStepConfig.getOrder());
-            batchBusinessStepRepository.save(batchBusinessStep);
-        });
+        List<String> availableBusinessStepNames = 
getAvailableBusinessStepsByJobName(BusinessStepCategory.LOAN.name())
+                
.getAvailableBusinessSteps().stream().map(BusinessStepDetail::getStepName).toList();
+        List<String> notValidBusinessStepNames = 
businessSteps.stream().map(BusinessStep::getStepName)
+                .filter(businessStepName -> 
!availableBusinessStepNames.contains(businessStepName)).toList();
+        if (notValidBusinessStepNames.isEmpty()) {

Review Comment:
   Is it allowed to remove all of the business steps for a job?



-- 
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