FINERACT-2103: refactor boilerplate code under portfolio package using Lombok annotations.
This commit is contained in:
+4
-120
@@ -22,8 +22,12 @@ package org.apache.fineract.portfolio.client.data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public final class ClientFamilyMembersData implements Serializable {
|
||||
|
||||
private final Long id;
|
||||
@@ -68,124 +72,4 @@ public final class ClientFamilyMembersData implements Serializable {
|
||||
private final Collection<CodeValueData> maritalStatusIdOptions;
|
||||
private final Collection<CodeValueData> professionIdOptions;
|
||||
|
||||
private ClientFamilyMembersData(final Long id, final Long clientId, final String firstName, final String middleName,
|
||||
final String lastName, final String qualification, final String mobileNumber, final Long age, final Boolean isDependent,
|
||||
final String relationship, final Long relationshipId, final String maritalStatus, final Long maritalStatusId,
|
||||
final String gender, final Long genderId, final LocalDate dateOfBirth, final String profession, final Long professionId,
|
||||
final Collection<CodeValueData> relationshipIdOptions, final Collection<CodeValueData> genderIdOptions,
|
||||
final Collection<CodeValueData> maritalStatusIdOptions, final Collection<CodeValueData> professionIdOptions) {
|
||||
this.id = id;
|
||||
this.clientId = clientId;
|
||||
this.firstName = firstName;
|
||||
this.middleName = middleName;
|
||||
this.lastName = lastName;
|
||||
this.qualification = qualification;
|
||||
this.relationship = relationship;
|
||||
this.relationshipId = relationshipId;
|
||||
this.maritalStatus = maritalStatus;
|
||||
this.maritalStatusId = maritalStatusId;
|
||||
this.gender = gender;
|
||||
this.genderId = genderId;
|
||||
this.dateOfBirth = dateOfBirth;
|
||||
this.profession = profession;
|
||||
this.professionId = professionId;
|
||||
this.mobileNumber = mobileNumber;
|
||||
this.age = age;
|
||||
this.isDependent = isDependent;
|
||||
this.relationshipIdOptions = relationshipIdOptions;
|
||||
this.genderIdOptions = genderIdOptions;
|
||||
this.maritalStatusIdOptions = maritalStatusIdOptions;
|
||||
this.professionIdOptions = professionIdOptions;
|
||||
|
||||
}
|
||||
|
||||
public static ClientFamilyMembersData instance(final Long id, final Long clientId, final String firstName, final String middleName,
|
||||
final String lastName, final String qualification, final String mobileNumber, final Long age, final Boolean isDependent,
|
||||
final String relationship, final Long relationshipId, final String maritalStatus, final Long maritalStatusId,
|
||||
final String gender, final Long genderId, final LocalDate dateOfBirth, final String profession, final Long professionId) {
|
||||
return new ClientFamilyMembersData(id, clientId, firstName, middleName, lastName, qualification, mobileNumber, age, isDependent,
|
||||
relationship, relationshipId, maritalStatus, maritalStatusId, gender, genderId, dateOfBirth, profession, professionId, null,
|
||||
null, null, null);
|
||||
}
|
||||
|
||||
public static ClientFamilyMembersData templateInstance(final Collection<CodeValueData> relationshipIdOptions,
|
||||
final Collection<CodeValueData> genderIdOptions, final Collection<CodeValueData> maritalStatusIdOptions,
|
||||
final Collection<CodeValueData> professionIdOptions) {
|
||||
|
||||
return new ClientFamilyMembersData(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, relationshipIdOptions, genderIdOptions, maritalStatusIdOptions, professionIdOptions);
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Long getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return this.firstName;
|
||||
}
|
||||
|
||||
public String getMiddleName() {
|
||||
return this.middleName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return this.lastName;
|
||||
}
|
||||
|
||||
public String getQualification() {
|
||||
return this.qualification;
|
||||
}
|
||||
|
||||
public Long getRelationshipId() {
|
||||
return this.relationshipId;
|
||||
}
|
||||
|
||||
public String getRelationship() {
|
||||
return this.relationship;
|
||||
}
|
||||
|
||||
public Long getMaritalStatusId() {
|
||||
return this.maritalStatusId;
|
||||
}
|
||||
|
||||
public String getMaritalStatus() {
|
||||
return this.maritalStatus;
|
||||
}
|
||||
|
||||
public Long getGenderId() {
|
||||
return this.genderId;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return this.gender;
|
||||
}
|
||||
|
||||
public LocalDate getDateOfBirth() {
|
||||
return this.dateOfBirth;
|
||||
}
|
||||
|
||||
public Long getProfessionId() {
|
||||
return this.professionId;
|
||||
}
|
||||
|
||||
public String getProfession() {
|
||||
return this.profession;
|
||||
}
|
||||
|
||||
public String getMobileNumber() {
|
||||
return this.mobileNumber;
|
||||
}
|
||||
|
||||
public Long getAge() {
|
||||
return this.age;
|
||||
}
|
||||
|
||||
public Boolean getIsDependent() {
|
||||
return this.isDependent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-22
@@ -20,6 +20,7 @@ package org.apache.fineract.portfolio.client.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
@@ -27,6 +28,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class ClientTimelineData implements Serializable {
|
||||
|
||||
private final LocalDate submittedOnDate;
|
||||
@@ -43,26 +45,4 @@ public class ClientTimelineData implements Serializable {
|
||||
private final String closedByUsername;
|
||||
private final String closedByFirstname;
|
||||
private final String closedByLastname;
|
||||
|
||||
public ClientTimelineData(final LocalDate submittedOnDate, final String submittedByUsername, final String submittedByFirstname,
|
||||
final String submittedByLastname, final LocalDate activatedOnDate, final String activatedByUsername,
|
||||
final String activatedByFirstname, final String activatedByLastname, final LocalDate closedOnDate,
|
||||
final String closedByUsername, final String closedByFirstname, final String closedByLastname) {
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
this.submittedByUsername = submittedByUsername;
|
||||
this.submittedByFirstname = submittedByFirstname;
|
||||
this.submittedByLastname = submittedByLastname;
|
||||
|
||||
this.activatedOnDate = activatedOnDate;
|
||||
this.activatedByUsername = activatedByUsername;
|
||||
this.activatedByFirstname = activatedByFirstname;
|
||||
this.activatedByLastname = activatedByLastname;
|
||||
|
||||
this.closedOnDate = closedOnDate;
|
||||
this.closedByUsername = closedByUsername;
|
||||
this.closedByFirstname = closedByFirstname;
|
||||
this.closedByLastname = closedByLastname;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package org.apache.fineract.portfolio.note.data;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
@@ -26,6 +27,7 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
* Immutable data object represent note or case information about a client, loan or loan transaction.
|
||||
*/
|
||||
@Getter
|
||||
@Builder
|
||||
public class NoteData {
|
||||
|
||||
private final Long id;
|
||||
@@ -43,25 +45,4 @@ public class NoteData {
|
||||
private final Long updatedById;
|
||||
private final String updatedByUsername;
|
||||
private final OffsetDateTime updatedOn;
|
||||
|
||||
public NoteData(final Long id, final Long clientId, final Long groupId, final Long loanId, final Long transactionId,
|
||||
final Long depositAccountId, final Long savingAccountId, final EnumOptionData noteType, final String note,
|
||||
final OffsetDateTime createdDate, final Long createdById, final String createdByUsername, final OffsetDateTime lastModifiedDate,
|
||||
final Long lastModifiedById, final String updatedByUsername) {
|
||||
this.id = id;
|
||||
this.clientId = clientId;
|
||||
this.groupId = groupId;
|
||||
this.loanId = loanId;
|
||||
this.loanTransactionId = transactionId;
|
||||
this.depositAccountId = depositAccountId;
|
||||
this.savingAccountId = savingAccountId;
|
||||
this.noteType = noteType;
|
||||
this.note = note;
|
||||
this.createdOn = createdDate;
|
||||
this.createdById = createdById;
|
||||
this.createdByUsername = createdByUsername;
|
||||
this.updatedOn = lastModifiedDate;
|
||||
this.updatedById = lastModifiedById;
|
||||
this.updatedByUsername = updatedByUsername;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
||||
final Long noteId = JdbcSupport.getLong(rs, "noteId");
|
||||
if (noteId != null) {
|
||||
final String note = rs.getString("transactionNote");
|
||||
noteData = new NoteData(noteId, null, null, null, null, null, null, null, note, null, null, null, null, null, null);
|
||||
noteData = NoteData.builder().id(noteId).note(note).build();
|
||||
}
|
||||
Long transaction = null;
|
||||
if (entityType != null && transactionId != null) {
|
||||
|
||||
+6
-5
@@ -83,10 +83,10 @@ public class ClientFamilyMembersReadPlatformServiceImpl implements ClientFamilyM
|
||||
final String profession = rs.getString("profession");
|
||||
final long professionId = rs.getLong("professionId");
|
||||
|
||||
return ClientFamilyMembersData.instance(id, clientId, firstName, middleName, lastName, qualification, mobileNumber, age,
|
||||
isDependent, relationship, relationshipId, maritalStatus, maritalStatusId, gender, genderId, dateOfBirth, profession,
|
||||
professionId);
|
||||
|
||||
return ClientFamilyMembersData.builder().id(id).clientId(clientId).firstName(firstName).middleName(middleName)
|
||||
.lastName(lastName).qualification(qualification).mobileNumber(mobileNumber).age(age).isDependent(isDependent)
|
||||
.relationship(relationship).relationshipId(relationshipId).maritalStatus(maritalStatus).maritalStatusId(maritalStatusId)
|
||||
.gender(gender).genderId(genderId).dateOfBirth(dateOfBirth).profession(profession).professionId(professionId).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,8 @@ public class ClientFamilyMembersReadPlatformServiceImpl implements ClientFamilyM
|
||||
final List<CodeValueData> professionOptions = new ArrayList<>(
|
||||
this.codeValueReadPlatformService.retrieveCodeValuesByCode("PROFESSION"));
|
||||
|
||||
return ClientFamilyMembersData.templateInstance(relationshipOptions, genderOptions, maritalStatusOptions, professionOptions);
|
||||
return ClientFamilyMembersData.builder().relationshipIdOptions(relationshipOptions).genderIdOptions(genderOptions)
|
||||
.maritalStatusIdOptions(maritalStatusOptions).professionIdOptions(professionOptions).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-2
@@ -74,8 +74,10 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
|
||||
final String updatedByUsername = rs.getString("modifiedBy");
|
||||
final OffsetDateTime createdDate = createdDateUtc != null ? createdDateUtc : createdDateLocal;
|
||||
final OffsetDateTime lastModifiedDate = lastModifiedDateUtc != null ? lastModifiedDateUtc : lastModifiedDateLocal;
|
||||
return new NoteData(id, clientId, groupId, loanId, transactionId, null, null, noteType, note, createdDate, createdById,
|
||||
createdByUsername, lastModifiedDate, lastModifiedById, updatedByUsername);
|
||||
|
||||
return NoteData.builder().id(id).clientId(clientId).groupId(groupId).loanId(loanId).loanTransactionId(transactionId)
|
||||
.noteType(noteType).note(note).createdOn(createdDate).createdById(createdById).createdByUsername(createdByUsername)
|
||||
.updatedOn(lastModifiedDate).updatedById(lastModifiedById).updatedByUsername(updatedByUsername).build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user