vidakovic commented on code in PR #5856:
URL: https://github.com/apache/fineract/pull/5856#discussion_r3261792912


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/collateralmanagement/domain/CollateralManagementDomain.java:
##########
@@ -77,53 +77,40 @@ private CollateralManagementDomain(final String quality, 
final BigDecimal basePr
         this.name = name;
     }
 
-    public static CollateralManagementDomain createNew(JsonCommand 
jsonCommand, final ApplicationCurrency applicationCurrency) {
-        String quality = jsonCommand.stringValueOfParameterNamed("quality");
-        BigDecimal basePrice = 
jsonCommand.bigDecimalValueOfParameterNamed("basePrice");
-        BigDecimal pctToBase = 
jsonCommand.bigDecimalValueOfParameterNamedDefaultToNullIfZero("pctToBase");
-        String unitType = jsonCommand.stringValueOfParameterNamed("unitType");
-        String name = jsonCommand.stringValueOfParameterNamed("name");
+    public static CollateralManagementDomain createNew(final String name, 
final String quality, final BigDecimal basePrice,
+            final String unitType, final BigDecimal pctToBase, final 
ApplicationCurrency applicationCurrency) {
         return new CollateralManagementDomain(quality, basePrice, unitType, 
pctToBase, applicationCurrency, name);
     }
 
-    public Map<String, Object> update(final JsonCommand command, final 
ApplicationCurrency applicationCurrency) {
+    public Map<String, Object> update(final String name, final String quality, 
final String unitType, final BigDecimal basePrice,

Review Comment:
   I am pretty sure this function is called only in one place. We should not 
add it to the entity, but move it to the service function where this is called. 
Then we can leave the entity class simple and not overload it with business 
logic. Note: I'm also convinced that the "changes" attributes (same in other 
packages) are rarely if at all used; but ok, let's leave them to avoid 
surprises. Anyway, stuff like this should be in the business logic service.



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