You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/10/17 18:21:06 UTC

[GitHub] [fineract] hmg65 commented on a diff in pull request #2666: FINERACT-1778: Introduce Lombok to staff module

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 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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org