tidy up response for client data with display name and also loanschedule field of new loan data.

This commit is contained in:
Keith Woodlock
2012-06-06 15:51:14 +01:00
parent 8ddbb0935d
commit db32280c0d
2 changed files with 9 additions and 19 deletions
@@ -4,10 +4,9 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonFilter;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.LocalDate;
@JsonIgnoreProperties({ "organisationId","organisationName"})
@@ -42,17 +41,18 @@ public class ClientData implements Serializable {
this.id = id;
this.firstname = firstname;
this.lastname = lastname;
this.displayName = new StringBuilder(this.firstname).append(' ')
.append(this.lastname).toString();
StringBuilder nameBuilder = new StringBuilder(this.firstname);
if (StringUtils.isNotBlank(nameBuilder.toString())) {
nameBuilder.append(' ');
}
nameBuilder.append(this.lastname);
this.displayName = nameBuilder.toString();
this.externalId = externalId;
this.joinedDate = joinedDate;
}
public int getMaxJoinedOnOffsetFromToday() {
return Days.daysBetween(new DateTime(),
this.getJoinedDate().toDateMidnight().toDateTime()).getDays();
}
public Long getId() {
return this.id;
}
@@ -19,8 +19,6 @@ public class NewLoanData implements Serializable {
private LocalDate expectedDisbursementDate;
private LoanSchedule repaymentSchedule;
private List<LoanProductLookup> allowedProducts = new ArrayList<LoanProductLookup>();
public NewLoanData() {
@@ -75,14 +73,6 @@ public class NewLoanData implements Serializable {
this.selectedProduct = selectedProduct;
}
public LoanSchedule getRepaymentSchedule() {
return repaymentSchedule;
}
public void setRepaymentSchedule(LoanSchedule repaymentSchedule) {
this.repaymentSchedule = repaymentSchedule;
}
public LocalDate getExpectedDisbursementDate() {
return expectedDisbursementDate;
}