in scorecard-plugin/src/main/java/org/apache/fineract/portfolio/creditscorecard/service/CreditScorecardAssemblerImpl.java [195:235]
public List<LoanProductScorecardFeature> assembleListOfProductScoringFeatures(final JsonCommand command, LoanProduct loanProduct) {
final List<LoanProductScorecardFeature> loanProductFeatures = new ArrayList<>();
// JsonCommand incentivesCommand = JsonCommand.fromExistingCommand(command, incentiveElement);
// chartSlab.slabFields().validateChartSlabPlatformRules(chartSlabsCommand, baseDataValidator, locale);
if (command.parameterExists("scorecardFeatures")) {
final JsonArray featuresArray = command.arrayOfParameterNamed("scorecardFeatures");
if (featuresArray != null) {
for (int i = 0; i < featuresArray.size(); i++) {
final JsonObject jsonObject = featuresArray.get(i).getAsJsonObject();
if (jsonObject.has("featureId")) {
final Long id = jsonObject.get("featureId").getAsLong();
final BigDecimal weightage = jsonObject.get("weightage").getAsBigDecimal();
final Integer greenMin = jsonObject.get("greenMin").getAsInt();
final Integer greenMax = jsonObject.get("greenMax").getAsInt();
final Integer amberMin = jsonObject.get("amberMin").getAsInt();
final Integer amberMax = jsonObject.get("amberMax").getAsInt();
final Integer redMin = jsonObject.get("redMin").getAsInt();
final Integer redMax = jsonObject.get("redMax").getAsInt();
final List<FeatureCriteria> criteria = this
.assembleListOfProductScoringFeatureCriteriaScores(jsonObject.get("criteriaScores").getAsJsonArray());
final CreditScorecardFeature feature = this.readPlatformService.findOneFeatureWithNotFoundDetection(id);
final LoanProductScorecardFeature loanProductFeature = new LoanProductScorecardFeature(feature, weightage, greenMin,
greenMax, amberMin, amberMax, redMin, redMax);
loanProductFeature.setFeatureCriteria(criteria);
loanProductFeatures.add(loanProductFeature);
}
}
}
}
return loanProductFeatures;
}