From fe5076354955ed598b8211134f452b8d9a2e7c11 Mon Sep 17 00:00:00 2001 From: meghnabajoria Date: Sun, 12 Mar 2023 10:36:15 -0700 Subject: [PATCH] Introduce Lombok to teller module (FINERACT-1779) --- .../organisation/teller/data/CashierData.java | 187 ++------------ .../teller/data/CashierTransactionData.java | 156 +++-------- .../data/CashierTransactionDataValidator.java | 6 +- .../CashierTransactionTypeTotalsData.java | 28 +- .../organisation/teller/data/TellerData.java | 115 ++------- .../teller/data/TellerJournalData.java | 75 ++---- .../teller/data/TellerTransactionData.java | 74 ++---- .../organisation/teller/domain/Cashier.java | 242 +----------------- .../teller/domain/CashierTransaction.java | 162 ++---------- .../teller/domain/CashierTxnType.java | 20 +- .../organisation/teller/domain/Teller.java | 123 +-------- .../teller/domain/TellerStatus.java | 19 +- .../teller/domain/TellerTransaction.java | 69 +---- .../TellerWritePlatformServiceJpaImpl.java | 23 +- 14 files changed, 202 insertions(+), 1097 deletions(-) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierData.java index 85a75703e..1024962f8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierData.java @@ -21,6 +21,10 @@ package org.apache.fineract.organisation.teller.data; import java.io.Serializable; import java.time.LocalDate; import java.util.Collection; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.apache.fineract.organisation.staff.data.StaffData; /** @@ -32,48 +36,28 @@ import org.apache.fineract.organisation.staff.data.StaffData; * @see org.apache.fineract.organisation.teller.domain.Cashier * @since 2.0.0 */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public final class CashierData implements Serializable { - private final Long id; - private final Long tellerId; - private final Long officeId; - private final Long staffId; - private final String description; - private final LocalDate startDate; - private final LocalDate endDate; - private final Boolean isFullDay; - private final String startTime; - private final String endTime; + private Long id; + private Long tellerId; + private Long officeId; + private Long staffId; + private String description; + private LocalDate startDate; + private LocalDate endDate; + private Boolean isFullDay; + private String startTime; + private String endTime; // Template fields - private final String officeName; - private final String tellerName; - private final String staffName; - private final Collection staffOptions; - - /* - * Creates a new cashier. - */ - private CashierData(final Long id, final Long officeId, String officeName, final Long staffId, final String staffName, - final Long tellerId, final String tellerName, final String description, final LocalDate startDate, final LocalDate endDate, - final Boolean isFullDay, final String startTime, final String endTime, Collection staffOptions) { - this.id = id; - this.officeId = officeId; - this.staffId = staffId; - this.tellerId = tellerId; - this.description = description; - this.startDate = startDate; - this.endDate = endDate; - this.isFullDay = isFullDay; - this.startTime = startTime; - this.endTime = endTime; - - this.officeName = officeName; - this.tellerName = tellerName; - this.staffName = staffName; - this.staffOptions = staffOptions; - - } + private String officeName; + private String tellerName; + private String staffName; + private Collection staffOptions; /** * Creates a new cashier. @@ -115,8 +99,9 @@ public final class CashierData implements Serializable { public static CashierData instance(final Long id, final Long officeId, String officeName, final Long staffId, final String staffName, final Long tellerId, final String tellerName, final String description, final LocalDate startDate, final LocalDate endDate, final Boolean isFullDay, final String startTime, final String endTime) { - return new CashierData(id, officeId, officeName, staffId, staffName, tellerId, tellerName, description, startDate, endDate, - isFullDay, startTime, endTime, null); + return new CashierData().setId(id).setOfficeId(officeId).setOfficeName(officeName).setStaffId(staffId).setStaffName(staffName) + .setTellerId(tellerId).setTellerName(tellerName).setDescription(description).setStartDate(startDate).setEndDate(endDate) + .setIsFullDay(isFullDay).setStartTime(startTime).setEndTime(endTime); } /* @@ -124,125 +109,7 @@ public final class CashierData implements Serializable { */ public static CashierData template(final Long officeId, final String officeName, final Long tellerId, final String tellerName, final Collection staffOptions) { - return new CashierData(null, officeId, officeName, null, null, tellerId, tellerName, null, null, null, null, null, null, - staffOptions); - } - - /** - * Returns the primary key of this cashier. - * - * @return the primary key of this cashier - */ - public Long getId() { - return id; - } - - /** - * Returns the primary key of this cashiers related office. - * - * @return the primary key of this cashiers related office - */ - public Long getOfficeId() { - return officeId; - } - - /** - * Returns the primary key of this cashiers related staff. - * - * @return the primary key of this cashiers related staff - */ - public Long getStaffId() { - return staffId; - } - - /** - * Returns the primary key of this cashiers related teller. - * - * @return the primary key of this cashiers related teller - */ - public Long getTellerId() { - return tellerId; - } - - /** - * Returns the description of this cashier. - * - * @return the description of this cashier - */ - public String getDescription() { - return description; - } - - /** - * Returns the valid from date of this cashier. - * - *

- * The valid from/to dates may be used to define a time period in which the cashier is assignable to a teller. - *

- * - * @return the valid from date of this cashier - */ - public LocalDate getStartDate() { - return startDate; - } - - /** - * Returns the valid to date of this cashier. - * - *

- * The valid from/to dates may be used to define a time period in which the cashier is assignable to a teller. - *

- * - * @return the valid to date of this cashier - */ - public LocalDate getEndDate() { - return endDate; - } - - /** - * Returns whether this cashier works part time or not. - * - * @return {@code true} if this cashier works part time; {@code false} otherwise - */ - public Boolean isFullDay() { - return isFullDay; - } - - /** - * Returns the start time of this cashier. - * - *

- * The start/end times may be used to define a time period in which the cashier works part time. - *

- * - * @return the start time of this cashier - */ - public String getStartTime() { - return startTime; - } - - /** - * Returns the end time of this cashier. - * - *

- * The start/end times may be used to define a time period in which the cashier works part time. - *

- * - * @return the start time of this cashier - */ - public String getEndTime() { - return endTime; - } - - public String getOfficeName() { - return officeName; - } - - public String getTellerName() { - return tellerName; - } - - public String getStaffName() { - return staffName; + return new CashierData().setOfficeId(officeId).setOfficeName(officeName).setTellerId(tellerId).setTellerName(tellerName) + .setStaffOptions(staffOptions); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionData.java index b375b5d1c..9343b5354 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionData.java @@ -23,145 +23,55 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.Collection; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.teller.domain.CashierTxnType; +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public final class CashierTransactionData implements Serializable { - private final Long id; - private final Long cashierId; - private final CashierTxnType txnType; - private final BigDecimal txnAmount; - private final LocalDate txnDate; - private final Long entityId; - private final String entityType; - private final String txnNote; - private final OffsetDateTime createdDate; + private Long id; + private Long cashierId; + private CashierTxnType txnType; + private BigDecimal txnAmount; + private LocalDate txnDate; + private Long entityId; + private String entityType; + private String txnNote; + private OffsetDateTime createdDate; // Template fields - private final Long officeId; - private final String officeName; - private final Long tellerId; - private final String tellerName; - private final String cashierName; - - private final CashierData cashierData; - private final LocalDate startDate; - private final LocalDate endDate; - - private final Collection currencyOptions; - - /* - * Creates a new cashier. - */ - private CashierTransactionData(final Long id, final Long cashierId, CashierTxnType txnType, final BigDecimal txnAmount, - final LocalDate txnDate, String txnNote, String entityType, Long entityId, OffsetDateTime createdDate, Long officeId, - String officeName, Long tellerId, String tellerName, String cashierName, CashierData cashierData, LocalDate startDate, - LocalDate endDate, final Collection currencyOptions) { - this.id = id; - this.cashierId = cashierId; - this.txnType = txnType; - this.txnAmount = txnAmount; - this.txnDate = txnDate; - this.txnNote = txnNote; - this.entityType = entityType; - this.entityId = entityId; - this.createdDate = createdDate; - - this.officeId = officeId; - this.officeName = officeName; - this.tellerId = tellerId; - this.tellerName = tellerName; - this.cashierName = cashierName; - this.cashierData = cashierData; - - this.startDate = startDate; - this.endDate = endDate; - - this.currencyOptions = currencyOptions; - } + private Long officeId; + private String officeName; + private Long tellerId; + private String tellerName; + private String cashierName; + private CashierData cashierData; + private LocalDate startDate; + private LocalDate endDate; + private Collection currencyOptions; public static CashierTransactionData instance(final Long id, final Long cashierId, CashierTxnType txnType, final BigDecimal txnAmount, final LocalDate txnDate, final String txnNote, final String entityType, final Long entityId, final OffsetDateTime createdDate, final Long officeId, final String officeName, final Long tellerId, final String tellerName, final String cashierName, final CashierData cashierData, LocalDate startDate, LocalDate endDate) { - return new CashierTransactionData(id, cashierId, txnType, txnAmount, txnDate, txnNote, entityType, entityId, createdDate, officeId, - officeName, tellerId, tellerName, cashierName, cashierData, startDate, endDate, null); + return new CashierTransactionData().setId(id).setCashierId(cashierId).setTxnType(txnType).setTxnAmount(txnAmount) + .setTxnDate(txnDate).setTxnNote(txnNote).setEntityType(entityType).setEntityId(entityId).setCreatedDate(createdDate) + .setOfficeId(officeId).setOfficeName(officeName).setTellerId(tellerId).setTellerName(tellerName).setCashierName(cashierName) + .setCashierData(cashierData).setStartDate(startDate).setEndDate(endDate); } public static CashierTransactionData template(final Long cashierId, final Long tellerId, final String tellerName, final Long officeId, final String officeName, final String cashierName, final CashierData cashierData, LocalDate startDate, LocalDate endDate, final Collection currencyOptions) { - return new CashierTransactionData(null, cashierId, null, null, null, null, null, null, null, officeId, officeName, tellerId, - tellerName, cashierName, cashierData, startDate, endDate, currencyOptions); + return new CashierTransactionData().setCashierId(cashierId).setOfficeId(officeId).setOfficeName(officeName).setTellerId(tellerId) + .setTellerName(tellerName).setCashierName(cashierName).setCashierData(cashierData).setStartDate(startDate) + .setEndDate(endDate).setCurrencyOptions(currencyOptions); } - - public Long getId() { - return id; - } - - public Long getCashierId() { - return cashierId; - } - - public CashierTxnType getTxnType() { - return txnType; - } - - public BigDecimal getTxnAmount() { - return txnAmount; - } - - public LocalDate getTxnDate() { - return txnDate; - } - - public String getTxnNote() { - return txnNote; - } - - public String getEntityType() { - return entityType; - } - - public Long getEntityId() { - return entityId; - } - - public OffsetDateTime getCreatedDate() { - return createdDate; - } - - public Long getOfficeId() { - return officeId; - } - - public String getOfficeName() { - return officeName; - } - - public Long getTellerId() { - return tellerId; - } - - public String getTellerName() { - return tellerName; - } - - public String getCashierName() { - return cashierName; - } - - public LocalDate getStartDate() { - return startDate; - } - - public LocalDate getEndDate() { - return endDate; - } - - public CashierData getCashierData() { - return cashierData; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java index 4d7d36b4f..2305f7a58 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java @@ -79,8 +79,8 @@ public class CashierTransactionDataValidator { Long staffId = cashier.getStaff().getId(); final LocalDate fromDate = cashier.getStartDate(); final LocalDate endDate = cashier.getEndDate(); - final LocalDate tellerFromDate = teller.getStartLocalDate(); - final LocalDate tellerEndDate = teller.getEndLocalDate(); + final LocalDate tellerFromDate = teller.getStartDate(); + final LocalDate tellerEndDate = teller.getEndDate(); /** * to validate cashier date range in range of teller date range */ @@ -95,7 +95,7 @@ public class CashierTransactionDataValidator { + "' BETWEEN c.start_date AND c.end_date OR '" + endDate + "' BETWEEN c.start_date AND c.end_date )" + " OR ( c.start_date BETWEEN '" + fromDate + "' AND '" + endDate + "' OR c.end_date BETWEEN '" + fromDate + "' AND '" + endDate + "'))"; - if (!cashier.isFullDay()) { + if (!cashier.getIsFullDay()) { String startTime = cashier.getStartTime(); String endTime = cashier.getEndTime(); sql = sql + " AND ( Time(c.start_time) BETWEEN TIME(?) and TIME('" + endTime + "') or Time(c.end_time) BETWEEN TIME('" diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionTypeTotalsData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionTypeTotalsData.java index a7ae0f5d3..c831c3379 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionTypeTotalsData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionTypeTotalsData.java @@ -20,27 +20,21 @@ package org.apache.fineract.organisation.teller.data; import java.io.Serializable; import java.math.BigDecimal; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public final class CashierTransactionTypeTotalsData implements Serializable { - private final Integer cashierTxnType; - private final BigDecimal cashTotal; - - private CashierTransactionTypeTotalsData(final Integer cashierTxnType, final BigDecimal cashTotal) { - this.cashierTxnType = cashierTxnType; - this.cashTotal = cashTotal; - } + private Integer cashierTxnType; + private BigDecimal cashTotal; public static CashierTransactionTypeTotalsData instance(final Integer cashierTxnType, final BigDecimal cashTotal) { - return new CashierTransactionTypeTotalsData(cashierTxnType, cashTotal); + return new CashierTransactionTypeTotalsData().setCashierTxnType(cashierTxnType).setCashTotal(cashTotal); } - - public Integer getCashierTxnType() { - return cashierTxnType; - } - - public BigDecimal getCashTotal() { - return cashTotal; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerData.java index 790f3183b..5b9bbc71a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerData.java @@ -21,6 +21,10 @@ package org.apache.fineract.organisation.teller.data; import java.io.Serializable; import java.time.LocalDate; import java.util.Collection; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.apache.fineract.organisation.office.data.OfficeData; import org.apache.fineract.organisation.staff.data.StaffData; import org.apache.fineract.organisation.teller.domain.TellerStatus; @@ -34,47 +38,27 @@ import org.apache.fineract.organisation.teller.domain.TellerStatus; * @see java.io.Serializable * @since 2.0.0 */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public final class TellerData implements Serializable { - private final Long id; - private final Long officeId; - private final Long debitAccountId; - private final Long creditAccountId; - private final String name; - - private final String description; - private final LocalDate startDate; - private final LocalDate endDate; - private final TellerStatus status; - private final Boolean hasTransactions; - private final Boolean hasMappedCashiers; + private Long id; + private Long officeId; + private Long debitAccountId; + private Long creditAccountId; + private String name; + private String description; + private LocalDate startDate; + private LocalDate endDate; + private TellerStatus status; + private Boolean hasTransactions; + private Boolean hasMappedCashiers; private String officeName; - - private final Collection officeOptions; - private final Collection staffOptions; - - /* - * Sole private CTOR to create a new instance. - */ - private TellerData(final Long id, final Long officeId, final Long debitAccountId, final Long creditAccountId, final String name, - final String description, final LocalDate startDate, final LocalDate endDate, final TellerStatus status, - final Boolean hasTransactions, final Boolean hasMappedCashiers) { - - this.id = id; - this.officeId = officeId; - this.debitAccountId = debitAccountId; - this.creditAccountId = creditAccountId; - this.name = name; - this.description = description; - this.startDate = startDate; - this.endDate = endDate; - this.status = status; - this.hasTransactions = hasTransactions; - this.hasMappedCashiers = hasMappedCashiers; - this.officeOptions = null; - this.staffOptions = null; - } + private Collection officeOptions; + private Collection staffOptions; /** * Creates a new teller data object. @@ -106,61 +90,12 @@ public final class TellerData implements Serializable { public static TellerData instance(final Long id, final Long officeId, final Long debitAccountId, final Long creditAccountId, final String name, final String description, final LocalDate startDate, final LocalDate endDate, final TellerStatus status, final String officeName, final Boolean hasTransactions, final Boolean hasMappedCashiers) { - TellerData tellerData = new TellerData(id, officeId, debitAccountId, creditAccountId, name, description, startDate, endDate, status, - hasTransactions, hasMappedCashiers); - tellerData.officeName = officeName; - return tellerData; + return new TellerData().setId(id).setOfficeId(officeId).setDebitAccountId(debitAccountId).setCreditAccountId(creditAccountId) + .setName(name).setDescription(description).setStartDate(startDate).setEndDate(endDate).setStatus(status) + .setOfficeName(officeName).setHasTransactions(hasTransactions).setHasMappedCashiers(hasMappedCashiers); } public static TellerData lookup(final Long id, final String name) { - return new TellerData(id, null, null, null, name, null, null, null, null, null, null); - } - - public Long getId() { - return this.id; - } - - public Long getOfficeId() { - return this.officeId; - } - - public Long getDebitAccountId() { - return this.debitAccountId; - } - - public Long getCreditAccountId() { - return this.creditAccountId; - } - - public String getName() { - return this.name; - } - - public String getOfficeName() { - return this.officeName; - } - - public String getDescription() { - return this.description; - } - - public LocalDate getStartDate() { - return this.startDate; - } - - public LocalDate getEndDate() { - return this.endDate; - } - - public TellerStatus getStatus() { - return this.status; - } - - public Boolean hasTransactions() { - return this.hasTransactions; - } - - public Boolean hasMappedCashiers() { - return this.hasMappedCashiers; + return new TellerData().setId(id).setName(name); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerJournalData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerJournalData.java index 0629af11a..1bd2bd2c0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerJournalData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerJournalData.java @@ -20,6 +20,10 @@ package org.apache.fineract.organisation.teller.data; import java.io.Serializable; import java.time.LocalDate; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; /** * {@code TellerJournalData} represents an immutable journal data object. @@ -30,31 +34,20 @@ import java.time.LocalDate; * @see java.io.Serializable * @since 2.0.0 */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public final class TellerJournalData implements Serializable { - private final Long officeId; - private final Long tellerId; - private final LocalDate day; - private final Double openingBalance; - private final Double settledBalance; - private final Double closingBalance; - private final Double sumReceipts; - private final Double sumPayments; - - /* - * Sole private CTOR to create a new instance. - */ - private TellerJournalData(final Long officeId, final Long tellerId, final LocalDate day, final Double openingBalance, - final Double settledBalance, final Double closingBalance, final Double sumReceipts, final Double sumPayments) { - this.officeId = officeId; - this.tellerId = tellerId; - this.day = day; - this.openingBalance = openingBalance; - this.settledBalance = settledBalance; - this.closingBalance = closingBalance; - this.sumReceipts = sumReceipts; - this.sumPayments = sumPayments; - } + private Long officeId; + private Long tellerId; + private LocalDate day; + private Double openingBalance; + private Double settledBalance; + private Double closingBalance; + private Double sumReceipts; + private Double sumPayments; /** * Create a new teller journal data object. @@ -79,38 +72,8 @@ public final class TellerJournalData implements Serializable { */ public static TellerJournalData instance(final Long officeId, final Long tellerId, final LocalDate day, final Double openingBalance, final Double settledBalance, final Double closingBalance, final Double sumReceipts, final Double sumPayments) { - return new TellerJournalData(officeId, tellerId, day, openingBalance, settledBalance, closingBalance, sumReceipts, sumPayments); - } - - public Long getOfficeId() { - return officeId; - } - - public Long getTellerId() { - return tellerId; - } - - public LocalDate getDay() { - return day; - } - - public Double getOpeningBalance() { - return openingBalance; - } - - public Double getSettledBalance() { - return settledBalance; - } - - public Double getClosingBalance() { - return closingBalance; - } - - public Double getSumReceipts() { - return sumReceipts; - } - - public Double getSumPayments() { - return sumPayments; + return new TellerJournalData().setOfficeId(officeId).setTellerId(tellerId).setDay(day).setOpeningBalance(openingBalance) + .setSettledBalance(settledBalance).setClosingBalance(closingBalance).setSumReceipts(sumReceipts) + .setSumPayments(sumPayments); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerTransactionData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerTransactionData.java index 62ab13bf7..bf3514029 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerTransactionData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/TellerTransactionData.java @@ -20,6 +20,10 @@ package org.apache.fineract.organisation.teller.data; import java.io.Serializable; import java.time.LocalDate; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; import org.apache.fineract.infrastructure.core.data.EnumOptionData; /** @@ -31,31 +35,20 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData; * @see java.io.Serializable * @since 2.0.0 */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public final class TellerTransactionData implements Serializable { - private final Long id; - private final Long officeId; - private final Long tellerId; - private final Long cashierId; - private final Long clientId; - private final EnumOptionData type; - private final Double amount; - private final LocalDate postingDate; - - /* - * Sole private CTOR to create a new instance - */ - private TellerTransactionData(final Long id, final Long officeId, final Long tellerId, final Long cashierId, final Long clientId, - final EnumOptionData type, final Double amount, final LocalDate postingDate) { - this.id = id; - this.officeId = officeId; - this.tellerId = tellerId; - this.cashierId = cashierId; - this.clientId = clientId; - this.type = type; - this.amount = amount; - this.postingDate = postingDate; - } + private Long id; + private Long officeId; + private Long tellerId; + private Long cashierId; + private Long clientId; + private EnumOptionData type; + private Double amount; + private LocalDate postingDate; /** * Creates a new teller transaction data object. @@ -80,38 +73,7 @@ public final class TellerTransactionData implements Serializable { */ public static TellerTransactionData instance(final Long id, final Long officeId, final Long tellerId, final Long cashierId, final Long clientId, final EnumOptionData type, final Double amount, final LocalDate postingDate) { - return new TellerTransactionData(id, officeId, tellerId, cashierId, clientId, type, amount, postingDate); - } - - public Long getId() { - return id; - } - - public Long getOfficeId() { - return officeId; - } - - public Long getTellerId() { - return tellerId; - } - - public Long getCashierId() { - return cashierId; - } - - public Long getClientId() { - return clientId; - } - - public EnumOptionData getType() { - return type; - } - - public Double getAmount() { - return amount; - } - - public LocalDate getPostingDate() { - return postingDate; + return new TellerTransactionData().setId(id).setOfficeId(officeId).setTellerId(tellerId).setCashierId(cashierId) + .setClientId(clientId).setType(type).setAmount(amount).setPostingDate(postingDate); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Cashier.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Cashier.java index 9a39d2800..9a77571a0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Cashier.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Cashier.java @@ -31,6 +31,11 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; import javax.persistence.UniqueConstraint; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.organisation.office.domain.Office; @@ -46,6 +51,11 @@ import org.apache.fineract.organisation.staff.domain.Staff; @Entity @Table(name = "m_cashiers", uniqueConstraints = { @UniqueConstraint(name = "ux_cashiers_staff_teller", columnNames = { "staff_id", "teller_id" }) }) +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class Cashier extends AbstractPersistableCustom { // ManyToOne(fetch = FetchType.LAZY) @@ -79,13 +89,6 @@ public class Cashier extends AbstractPersistableCustom { @Column(name = "end_time", nullable = true, length = 10) private String endTime; - /** - * Creates a new cashier. - */ - public Cashier() { - - } - public static Cashier fromJson(final Office cashierOffice, final Teller teller, final Staff staff, final String startTime, final String endTime, final JsonCommand command) { // final Long tellerId = teller.getId(); @@ -99,20 +102,8 @@ public class Cashier extends AbstractPersistableCustom { * command.stringValueOfParameterNamed("endTime"); */ - return new Cashier(cashierOffice, teller, staff, description, startDate, endDate, isFullDay, startTime, endTime); - } - - public Cashier(Office office, Teller teller, Staff staff, String description, LocalDate startDate, LocalDate endDate, Boolean isFullDay, - String startTime, String endTime) { - this.office = office; - this.teller = teller; - this.staff = staff; - this.description = description; - this.startDate = startDate; - this.endDate = endDate; - this.isFullDay = isFullDay; - this.startTime = startTime; - this.endTime = endTime; + return new Cashier().setOffice(cashierOffice).setTeller(teller).setStaff(staff).setDescription(description).setStartDate(startDate) + .setEndDate(endDate).setIsFullDay(isFullDay).setStartTime(startTime).setEndTime(endTime); } public Map update(final JsonCommand command) { @@ -205,16 +196,6 @@ public class Cashier extends AbstractPersistableCustom { return actualChanges; } - /** - * Returns the office of this cashier. - * - * @return the office of this cashier - * @see org.apache.fineract.organisation.office.domain.Office - */ - public Office getOffice() { - return office; - } - public Long getHourFromStartTime() { if (this.startTime != null && !this.startTime.equalsIgnoreCase("")) { List extractHourFromStartTime = Splitter.on(':').splitToList(this.startTime); @@ -250,203 +231,4 @@ public class Cashier extends AbstractPersistableCustom { } return null; } - - /** - * Sets the office of this cashier. - * - * @param office - * the office of this cashier - * @see org.apache.fineract.organisation.office.domain.Office - */ - public void setOffice(Office office) { - this.office = office; - } - - /** - * Returns the staff of this cashier. - * - * @return the staff of this cashier - * @see org.apache.fineract.organisation.staff.domain.Staff - */ - public Staff getStaff() { - return staff; - } - - /** - * Sets the staff of this cashier. - * - * @param staff - * the staff of this cashier - * @see org.apache.fineract.organisation.staff.domain.Staff - */ - public void setStaff(Staff staff) { - this.staff = staff; - } - - /** - * Returns the teller of this cashier. - * - * @return the teller of this cashier - * @see org.apache.fineract.organisation.teller.domain.Teller - */ - public Teller getTeller() { - return teller; - } - - /** - * Sets the teller of this cashier. - * - * @param teller - * the teller of this cashier - * @see org.apache.fineract.organisation.teller.domain.Teller - */ - public void setTeller(Teller teller) { - this.teller = teller; - } - - /** - * Returns the description of this cashier. . - * - * @return the description of this cashier or {@code null} if not present. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of this cashier. - * - * @param description - * the description of this cashier - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Returns the valid from date of this cashier. - * - *

- * The valid from/to dates may be used to define a time period in which the cashier is assignable to a teller. - *

- * - * @return the valid from date of this cashier - */ - public LocalDate getStartDate() { - return startDate; - } - - /** - * Sets the valid from date of this cashier. - * - *

- * The valid from/to dates may be used to define a time period in which the cashier is assignable to a teller. - *

- * - * @param startDate - * validFrom the valid from date of this cashier - */ - public void setStartDate(LocalDate startDate) { - this.startDate = startDate; - } - - /** - * Returns the valid to date of this cashier. - * - *

- * The valid from/to dates may be used to define a time period in which the cashier is assignable to a teller. - *

- * - * @return the valid to date of this cashier - */ - public LocalDate getEndDate() { - return endDate; - } - - /** - * Sets the valid to date of this cashier. - * - *

- * The valid from/to dates may be used to define a time period in which the cashier is assignable to a teller. - *

- * - * @param endDate - * validTo the valid to date of this cashier - */ - public void setEndDate(LocalDate endDate) { - this.endDate = endDate; - } - - /** - * Returns whether this cashier works part time or not. - * - * @return {@code true} if this cashier works part time; {@code false} otherwise - */ - public Boolean isFullDay() { - return isFullDay; - } - - /** - * Sets the part time flag of this cashier. - * - * @param isFullDay - * partTime the part time flag of this cashier - */ - public void setFullDay(Boolean isFullDay) { - this.isFullDay = isFullDay; - } - - /** - * Returns the start time of this cashier. - * - *

- * The start/end times may be used to define a time period in which the cashier works part time. - *

- * - * @return the start time of this cashier - */ - public String getStartTime() { - return startTime; - } - - /** - * Set the start time of this cashier. - * - *

- * The start/end times may be used to define a time period in which the cashier works part time. - *

- * - * @param startTime - * the start time of this cashier - */ - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - /** - * Returns the end time of this cashier. - * - *

- * The start/end times may be used to define a time period in which the cashier works part time. - *

- * - * @return the end time of this cashier - */ - public String getEndTime() { - return endTime; - } - - /** - * Sets the end time of this cashier. - * - *

- * The start/end times may be used to define a time period in which the cashier works part time. - *

- * - * @param endTime - * the end time of this cashier - */ - public void setEndTime(String endTime) { - this.endTime = endTime; - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTransaction.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTransaction.java index a033d663c..d97e42f07 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTransaction.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTransaction.java @@ -30,6 +30,11 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.infrastructure.core.service.DateUtils; @@ -37,6 +42,11 @@ import org.apache.fineract.organisation.office.domain.Office; @Entity @Table(name = "m_cashier_transactions") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class CashierTransaction extends AbstractPersistableCustom { @Transient @@ -68,18 +78,11 @@ public class CashierTransaction extends AbstractPersistableCustom { private Long entityId; @Column(name = "created_date", nullable = false) - private LocalDateTime createdDate; + private LocalDateTime createdDate = DateUtils.getLocalDateTimeOfSystem(); @Column(name = "currency_code", nullable = true) private String currencyCode; - /** - * Creates a new cashier. - */ - public CashierTransaction() { - - } - public static CashierTransaction fromJson(final Cashier cashier, final JsonCommand command) { final Integer txnType = command.integerValueOfParameterNamed("txnType"); final BigDecimal txnAmount = command.bigDecimalValueOfParameterNamed("txnAmount"); @@ -90,23 +93,9 @@ public class CashierTransaction extends AbstractPersistableCustom { final String currencyCode = command.stringValueOfParameterNamed("currencyCode"); // TODO: get client/loan/savings details - return new CashierTransaction(cashier, txnType, txnAmount, txnDate, entityType, entityId, txnNote, currencyCode); - - } - - public CashierTransaction(Cashier cashier, Integer txnType, BigDecimal txnAmount, LocalDate txnDate, String entityType, Long entityId, - String txnNote, String currencyCode) { - this.cashier = cashier; - this.txnType = txnType; - if (txnDate != null) { - this.txnDate = txnDate; - } - this.txnAmount = txnAmount; - this.entityType = entityType; - this.entityId = entityId; - this.txnNote = txnNote; - this.createdDate = DateUtils.getLocalDateTimeOfSystem(); - this.currencyCode = currencyCode; + return new CashierTransaction().setCashier(cashier).setTxnType(txnType).setTxnAmount(txnAmount) + .setTxnDate(txnDate != null ? txnDate : null).setEntityType(entityType).setEntityId(entityId).setTxnNote(txnNote) + .setCurrencyCode(currencyCode); } public Map update(final JsonCommand command) { @@ -124,7 +113,7 @@ public class CashierTransaction extends AbstractPersistableCustom { } final String txnDateParamName = "txnDate"; - if (command.isChangeInLocalDateParameterNamed(txnDateParamName, getTxnLocalDate())) { + if (command.isChangeInLocalDateParameterNamed(txnDateParamName, this.txnDate)) { final String valueAsInput = command.stringValueOfParameterNamed(txnDateParamName); actualChanges.put(txnDateParamName, valueAsInput); actualChanges.put("dateFormat", dateFormatAsInput); @@ -156,125 +145,4 @@ public class CashierTransaction extends AbstractPersistableCustom { return actualChanges; } - - /** - * Returns the office of this cashier transaction. - * - * @return the office of this cashier transaction - * @see org.apache.fineract.organisation.office.domain.Office - */ - public Office getOffice() { - return office; - } - - /** - * Sets the office of this cashier transaction. - * - * @param office - * the office of this cashier transaction - * @see org.apache.fineract.organisation.office.domain.Office - */ - public void setOffice(Office office) { - this.office = office; - } - - /** - * Returns the teller of this cashier transaction. - * - * @return the teller of this cashier transaction - * @see org.apache.fineract.organisation.teller.domain.Teller - */ - public Teller getTeller() { - return teller; - } - - /** - * Sets the teller of this cashier transaction. - * - * @param teller - * the teller of this cashier transaction - * @see org.apache.fineract.organisation.teller.domain.Teller - */ - public void setTeller(Teller teller) { - this.teller = teller; - } - - /** - * Returns the transaction type of this cashier transaction. . - * - * @return the transaction type of this cashier transaction or {@code null} if not present. - */ - public Integer getTxnType() { - return txnType; - } - - /** - * Sets the transaction type of this cashier transaction. - * - * @param txnType - * description the transaction type of this cashier transaction - */ - public void setTxnType(Integer txnType) { - this.txnType = txnType; - } - - /** - * Returns the transaction date of this cashier transaction. - * - * @return the transaction date of this cashier transaction - */ - public LocalDate getTxnDate() { - return txnDate; - } - - public LocalDate getTxnLocalDate() { - return this.txnDate; - } - - /** - * Sets the transaction date of this cashier transaction. - * - * @param txnDate - * transaction date of this cashier transaction - */ - public void setTxnDate(LocalDate txnDate) { - this.txnDate = txnDate; - } - - public String getEntityType() { - return entityType; - } - - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - public Long getEntityId() { - return entityId; - } - - public void setEntityId(Long entityId) { - this.entityId = entityId; - } - - public String getTxnNote() { - return txnNote; - } - - public BigDecimal getTxnAmount() { - return txnAmount; - } - - public void setTxnNote(String txnNote) { - this.txnNote = txnNote; - } - - public String getCurrencyCode() { - return this.currencyCode; - } - - public void setCurrencyCode(String currencyCode) { - this.currencyCode = currencyCode; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java index e177b5246..06dc0facf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/CashierTxnType.java @@ -19,7 +19,13 @@ package org.apache.fineract.organisation.teller.domain; import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +@Getter +@NoArgsConstructor +@AllArgsConstructor public final class CashierTxnType implements Serializable { private Integer id; @@ -30,18 +36,8 @@ public final class CashierTxnType implements Serializable { public static final CashierTxnType INWARD_CASH_TXN = new CashierTxnType(103, "Cash In"); public static final CashierTxnType OUTWARD_CASH_TXN = new CashierTxnType(104, "Cash Out"); - private CashierTxnType() {} - - private CashierTxnType(Integer id, String value) { - this.id = id; - this.value = value; - } - - public Integer getId() { - return id; - } - - public String getValue() { + @Override + public String toString() { return value; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Teller.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Teller.java index 443492192..5dc64e79b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Teller.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/Teller.java @@ -30,6 +30,11 @@ import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.UniqueConstraint; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; import org.apache.fineract.accounting.glaccount.domain.GLAccount; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; @@ -37,6 +42,11 @@ import org.apache.fineract.organisation.office.domain.Office; @Entity @Table(name = "m_tellers", uniqueConstraints = { @UniqueConstraint(name = "ux_tellers_name", columnNames = { "name" }) }) +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class Teller extends AbstractPersistableCustom { @ManyToOne(fetch = FetchType.LAZY) @@ -69,32 +79,6 @@ public class Teller extends AbstractPersistableCustom { @OneToMany(mappedBy = "teller", fetch = FetchType.LAZY) private Set cashiers; - public Teller() { - - } - - private Teller(final Office staffOffice, final String name, final String description, final LocalDate startDate, - final LocalDate endDate, final TellerStatus status) { - - this.name = name; - this.description = description; - this.startDate = startDate; - this.endDate = endDate; - - if (status != null) { - this.status = status.getValue(); - } - this.office = staffOffice; - - /* - * if (StringUtils.isNotBlank(name)) { this.name = name.trim(); } else { this.name = null; } - * - * if (StringUtils.isNotBlank(description)) { this.description = description.trim(); } else { this.description = - * null; } - */ - - } - public static Teller fromJson(final Office tellerOffice, final JsonCommand command) { final String name = command.stringValueOfParameterNamed("name"); final String description = command.stringValueOfParameterNamed("description"); @@ -103,7 +87,8 @@ public class Teller extends AbstractPersistableCustom { final Integer tellerStatusInt = command.integerValueOfParameterNamed("status"); final TellerStatus status = TellerStatus.fromInt(tellerStatusInt); - return new Teller(tellerOffice, name, description, startDate, endDate, status); + return new Teller().setOffice(tellerOffice).setName(name).setDescription(description).setStartDate(startDate).setEndDate(endDate) + .setStatus(status.getValue()); } public Map update(Office tellerOffice, final JsonCommand command) { @@ -135,7 +120,7 @@ public class Teller extends AbstractPersistableCustom { } final String startDateParamName = "startDate"; - if (command.isChangeInLocalDateParameterNamed(startDateParamName, getStartLocalDate())) { + if (command.isChangeInLocalDateParameterNamed(startDateParamName, this.startDate)) { final String valueAsInput = command.stringValueOfParameterNamed(startDateParamName); actualChanges.put(startDateParamName, valueAsInput); actualChanges.put("dateFormat", dateFormatAsInput); @@ -145,7 +130,7 @@ public class Teller extends AbstractPersistableCustom { } final String endDateParamName = "endDate"; - if (command.isChangeInLocalDateParameterNamed(endDateParamName, getEndLocalDate())) { + if (command.isChangeInLocalDateParameterNamed(endDateParamName, this.endDate)) { final String valueAsInput = command.stringValueOfParameterNamed(endDateParamName); actualChanges.put(endDateParamName, valueAsInput); actualChanges.put("dateFormat", dateFormatAsInput); @@ -168,90 +153,10 @@ public class Teller extends AbstractPersistableCustom { return actualChanges; } - public Office getOffice() { - return office; - } - - public void setOffice(Office office) { - this.office = office; - } - - public GLAccount getDebitAccount() { - return debitAccount; - } - - public void setDebitAccount(GLAccount debitAccount) { - this.debitAccount = debitAccount; - } - - public GLAccount getCreditAccount() { - return creditAccount; - } - - public void setCreditAccount(GLAccount creditAccount) { - this.creditAccount = creditAccount; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public LocalDate getStartDate() { - return startDate; - } - - public LocalDate getStartLocalDate() { - return this.startDate; - } - - public void setStartDate(LocalDate startDate) { - this.startDate = startDate; - } - - public LocalDate getEndDate() { - return endDate; - } - - public LocalDate getEndLocalDate() { - return this.endDate; - } - - public void setEndDate(LocalDate endDate) { - this.endDate = endDate; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - public Long officeId() { return this.office.getId(); } - public Set getCashiers() { - return cashiers; - } - - public void setCashiers(Set cashiers) { - this.cashiers = cashiers; - } - public void initializeLazyCollections() { this.office.getId(); this.cashiers.size(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerStatus.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerStatus.java index 47f1b7866..13983732d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerStatus.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerStatus.java @@ -18,10 +18,14 @@ */ package org.apache.fineract.organisation.teller.domain; +import lombok.AllArgsConstructor; +import lombok.Getter; + /** * Enum representation of teller status states. */ - +@Getter +@AllArgsConstructor public enum TellerStatus { INVALID(0, "tellerStatusType.invalid"), PENDING(100, "tellerStatusType.pending"), ACTIVE(300, "tellerStatusType.active"), INACTIVE(400, @@ -50,23 +54,10 @@ public enum TellerStatus { return status; } - TellerStatus(final Integer value, final String code) { - this.value = value; - this.code = code; - } - public boolean hasStateOf(final TellerStatus state) { return this.value.equals(state.getValue()); } - public Integer getValue() { - return this.value; - } - - public String getCode() { - return this.code; - } - public boolean isPending() { return this.value.equals(TellerStatus.PENDING.getValue()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerTransaction.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerTransaction.java index 503a258f0..c5b7019aa 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerTransaction.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/domain/TellerTransaction.java @@ -25,12 +25,22 @@ import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.organisation.office.domain.Office; import org.apache.fineract.portfolio.client.domain.Client; @Entity @Table(name = "m_teller_transactions") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) public class TellerTransaction extends AbstractPersistableCustom { @ManyToOne(fetch = FetchType.LAZY) @@ -58,63 +68,4 @@ public class TellerTransaction extends AbstractPersistableCustom { @Column(name = "posting_date", nullable = false) private LocalDate postingDate; - public TellerTransaction() { - - } - - public Office getOffice() { - return office; - } - - public void setOffice(Office office) { - this.office = office; - } - - public Teller getTeller() { - return teller; - } - - public void setTeller(Teller teller) { - this.teller = teller; - } - - public Cashier getCashier() { - return cashier; - } - - public void setCashier(Cashier cashier) { - this.cashier = cashier; - } - - public Client getClient() { - return client; - } - - public void setClient(Client client) { - this.client = client; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Double getAmount() { - return amount; - } - - public void setAmount(Double amount) { - this.amount = amount; - } - - public LocalDate getPostingDate() { - return postingDate; - } - - public void setPostingDate(LocalDate postingDate) { - this.postingDate = postingDate; - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java index 4460258ca..af176e300 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerWritePlatformServiceJpaImpl.java @@ -21,6 +21,7 @@ package org.apache.fineract.organisation.teller.service; import java.util.Map; import java.util.Set; import javax.persistence.PersistenceException; +import lombok.AllArgsConstructor; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity; import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccount; @@ -55,12 +56,12 @@ import org.apache.fineract.portfolio.client.domain.ClientTransaction; import org.apache.fineract.useradministration.domain.AppUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.orm.jpa.JpaSystemException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +@AllArgsConstructor @Service public class TellerWritePlatformServiceJpaImpl implements TellerWritePlatformService { @@ -77,26 +78,6 @@ public class TellerWritePlatformServiceJpaImpl implements TellerWritePlatformSer private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper; private final CashierTransactionDataValidator cashierTransactionDataValidator; - @Autowired - public TellerWritePlatformServiceJpaImpl(final PlatformSecurityContext context, - final TellerCommandFromApiJsonDeserializer fromApiJsonDeserializer, final TellerRepositoryWrapper tellerRepositoryWrapper, - final OfficeRepositoryWrapper officeRepositoryWrapper, final StaffRepository staffRepository, - CashierRepository cashierRepository, CashierTransactionRepository cashierTxnRepository, - JournalEntryRepository glJournalEntryRepository, - FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper, - final CashierTransactionDataValidator cashierTransactionDataValidator) { - this.context = context; - this.fromApiJsonDeserializer = fromApiJsonDeserializer; - this.tellerRepositoryWrapper = tellerRepositoryWrapper; - this.officeRepositoryWrapper = officeRepositoryWrapper; - this.staffRepository = staffRepository; - this.cashierRepository = cashierRepository; - this.cashierTxnRepository = cashierTxnRepository; - this.glJournalEntryRepository = glJournalEntryRepository; - this.financialActivityAccountRepositoryWrapper = financialActivityAccountRepositoryWrapper; - this.cashierTransactionDataValidator = cashierTransactionDataValidator; - } - @Override @Transactional public CommandProcessingResult createTeller(JsonCommand command) {