hmg65 commented on code in PR #2666:
URL: https://github.com/apache/fineract/pull/2666#discussion_r997376562


##########
fineract-provider/src/main/java/org/apache/fineract/organisation/staff/domain/Staff.java:
##########
@@ -110,24 +118,9 @@ public static Staff fromJson(final Office staffOffice, 
final JsonCommand command
             joiningDate = 
command.localDateValueOfParameterNamed(joiningDateParamName);
         }
 
-        return new Staff(staffOffice, firstname, lastname, externalId, 
mobileNo, isLoanOfficer, isActive, joiningDate);
-    }
-
-    protected Staff() {
-        //
-    }
-
-    private Staff(final Office staffOffice, final String firstname, final 
String lastname, final String externalId, final String mobileNo,
-            final boolean isLoanOfficer, final Boolean isActive, final 
LocalDate joiningDate) {
-        this.office = staffOffice;
-        this.firstname = StringUtils.defaultIfEmpty(firstname, null);
-        this.lastname = StringUtils.defaultIfEmpty(lastname, null);
-        this.externalId = StringUtils.defaultIfEmpty(externalId, null);
-        this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null);
-        this.loanOfficer = isLoanOfficer;
-        this.active = isActive == null ? true : isActive;
-        deriveDisplayName(firstname);
-        this.joiningDate = joiningDate;
+        return new 
Staff().setOffice(staffOffice).setFirstname(firstname).setLastname(lastname).setExternalId(externalId)

Review Comment:
   @galovics @vidakovic @BLasan @thesmallstar one solution to remove this 
constructor is to get away with the `deriveDisplayName` function as well. We 
can just implement the contents of that function directly inside 
`setDisplayName` like this - `.setDisplayName(!StringUtils.isBlank(firstname) ? 
lastname + ", " + firstname : lastname)`
   
   your suggestions around this?



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