nikpawar89 commented on a change in pull request #738: GSIM and GLIM with test 
cases (FINERACT-603)
URL: https://github.com/apache/fineract/pull/738#discussion_r410961637
 
 

 ##########
 File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
 ##########
 @@ -145,6417 +145,6708 @@
 
 @Entity
 @Component
-@Table(name = "m_loan", uniqueConstraints = { @UniqueConstraint(columnNames = 
{ "account_no" }, name = "loan_account_no_UNIQUE"),
-        @UniqueConstraint(columnNames = { "external_id" }, name = 
"loan_externalid_UNIQUE") })
+@Table(name = "m_loan", uniqueConstraints = {
+          @UniqueConstraint(columnNames = { "account_no" }, name = 
"loan_account_no_UNIQUE"),
+          @UniqueConstraint(columnNames = { "external_id" }, name = 
"loan_externalid_UNIQUE") })
 public class Loan extends AbstractPersistableCustom {
 
-    /** Disable optimistic locking till batch jobs failures can be fixed **/
-    @Version
-    int version;
+     /** Disable optimistic locking till batch jobs failures can be fixed **/
+     @Version
+     int version;
 
-    @Column(name = "account_no", length = 20, unique = true, nullable = false)
-    private String accountNumber;
+     @Column(name = "account_no", length = 20, unique = true, nullable = false)
+     private String accountNumber;
 
-    @Column(name = "external_id")
-    private String externalId;
+     @Column(name = "external_id")
+     private String externalId;
 
-    @ManyToOne
-    @JoinColumn(name = "client_id", nullable = true)
-    private Client client;
+     @ManyToOne
+     @JoinColumn(name = "client_id", nullable = true)
+     private Client client;
 
-    @ManyToOne
-    @JoinColumn(name = "group_id", nullable = true)
-    private Group group;
+     @ManyToOne
+     @JoinColumn(name = "group_id", nullable = true)
+     private Group group;
 
-    @Column(name = "loan_type_enum", nullable = false)
-    private Integer loanType;
+     @ManyToOne
+     @JoinColumn(name = "glim_id", nullable = true)
+     private GroupLoanIndividualMonitoringAccount glim;
 
-    @ManyToOne(fetch=FetchType.EAGER)
-    @JoinColumn(name = "product_id", nullable = false)
-    private LoanProduct loanProduct;
+     @Column(name = "loan_type_enum", nullable = false)
+     private Integer loanType;
 
-    @ManyToOne(optional = true, fetch=FetchType.EAGER)
-    @JoinColumn(name = "fund_id", nullable = true)
-    private Fund fund;
+     @ManyToOne(fetch = FetchType.EAGER)
+     @JoinColumn(name = "product_id", nullable = false)
+     private LoanProduct loanProduct;
 
-    @ManyToOne(fetch=FetchType.EAGER)
-    @JoinColumn(name = "loan_officer_id", nullable = true)
-    private Staff loanOfficer;
+     @ManyToOne(optional = true, fetch = FetchType.EAGER)
+     @JoinColumn(name = "fund_id", nullable = true)
+     private Fund fund;
 
-    @ManyToOne(fetch=FetchType.LAZY)
-    @JoinColumn(name = "loanpurpose_cv_id", nullable = true)
-    private CodeValue loanPurpose;
+     @ManyToOne(fetch = FetchType.EAGER)
+     @JoinColumn(name = "loan_officer_id", nullable = true)
+     private Staff loanOfficer;
 
-    @ManyToOne(fetch=FetchType.EAGER)
-    @JoinColumn(name = "loan_transaction_strategy_id", nullable = true)
-    private LoanTransactionProcessingStrategy transactionProcessingStrategy;
+     @ManyToOne(fetch = FetchType.LAZY)
+     @JoinColumn(name = "loanpurpose_cv_id", nullable = true)
+     private CodeValue loanPurpose;
 
-    @Embedded
-    private LoanProductRelatedDetail loanRepaymentScheduleDetail;
+     @ManyToOne(fetch = FetchType.EAGER)
+     @JoinColumn(name = "loan_transaction_strategy_id", nullable = true)
+     private LoanTransactionProcessingStrategy transactionProcessingStrategy;
 
-    @Column(name = "term_frequency", nullable = false)
-    private Integer termFrequency;
+     @Embedded
+     private LoanProductRelatedDetail loanRepaymentScheduleDetail;
 
-    @Column(name = "term_period_frequency_enum", nullable = false)
-    private Integer termPeriodFrequencyType;
+     @Column(name = "term_frequency", nullable = false)
+     private Integer termFrequency;
 
-    @Column(name = "loan_status_id", nullable = false)
-    private Integer loanStatus;
+     @Column(name = "term_period_frequency_enum", nullable = false)
+     private Integer termPeriodFrequencyType;
 
-    @Column(name = "sync_disbursement_with_meeting", nullable = true)
-    private Boolean syncDisbursementWithMeeting;
+     @Column(name = "loan_status_id", nullable = false)
+     private Integer loanStatus;
 
-    // loan application states
-    @Temporal(TemporalType.DATE)
-    @Column(name = "submittedon_date")
-    private Date submittedOnDate;
+     @Column(name = "sync_disbursement_with_meeting", nullable = true)
+     private Boolean syncDisbursementWithMeeting;
 
-    @ManyToOne(optional = true, fetch=FetchType.LAZY)
-    @JoinColumn(name = "submittedon_userid", nullable = true)
-    private AppUser submittedBy;
+     // loan application states
+     @Temporal(TemporalType.DATE)
+     @Column(name = "submittedon_date")
+     private Date submittedOnDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "rejectedon_date")
-    private Date rejectedOnDate;
+     @ManyToOne(optional = true, fetch = FetchType.LAZY)
+     @JoinColumn(name = "submittedon_userid", nullable = true)
+     private AppUser submittedBy;
 
-    @ManyToOne(optional = true, fetch=FetchType.LAZY)
-    @JoinColumn(name = "rejectedon_userid", nullable = true)
-    private AppUser rejectedBy;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "rejectedon_date")
+     private Date rejectedOnDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "withdrawnon_date")
-    private Date withdrawnOnDate;
+     @ManyToOne(optional = true, fetch = FetchType.LAZY)
+     @JoinColumn(name = "rejectedon_userid", nullable = true)
+     private AppUser rejectedBy;
 
-    @ManyToOne(optional = true, fetch=FetchType.LAZY)
-    @JoinColumn(name = "withdrawnon_userid", nullable = true)
-    private AppUser withdrawnBy;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "withdrawnon_date")
+     private Date withdrawnOnDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "approvedon_date")
-    private Date approvedOnDate;
+     @ManyToOne(optional = true, fetch = FetchType.LAZY)
+     @JoinColumn(name = "withdrawnon_userid", nullable = true)
+     private AppUser withdrawnBy;
 
-    @ManyToOne(optional = true, fetch=FetchType.LAZY)
-    @JoinColumn(name = "approvedon_userid", nullable = true)
-    private AppUser approvedBy;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "approvedon_date")
+     private Date approvedOnDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "expected_disbursedon_date")
-    private Date expectedDisbursementDate;
+     @ManyToOne(optional = true, fetch = FetchType.LAZY)
+     @JoinColumn(name = "approvedon_userid", nullable = true)
+     private AppUser approvedBy;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "disbursedon_date")
-    private Date actualDisbursementDate;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "expected_disbursedon_date")
+     private Date expectedDisbursementDate;
 
-    @ManyToOne(optional = true, fetch=FetchType.LAZY)
-    @JoinColumn(name = "disbursedon_userid", nullable = true)
-    private AppUser disbursedBy;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "disbursedon_date")
+     private Date actualDisbursementDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "closedon_date")
-    private Date closedOnDate;
+     @ManyToOne(optional = true, fetch = FetchType.LAZY)
+     @JoinColumn(name = "disbursedon_userid", nullable = true)
+     private AppUser disbursedBy;
 
-    @ManyToOne(optional = true, fetch=FetchType.LAZY)
-    @JoinColumn(name = "closedon_userid", nullable = true)
-    private AppUser closedBy;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "closedon_date")
+     private Date closedOnDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "writtenoffon_date")
-    private Date writtenOffOnDate;
+     @ManyToOne(optional = true, fetch = FetchType.LAZY)
+     @JoinColumn(name = "closedon_userid", nullable = true)
+     private AppUser closedBy;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "rescheduledon_date")
-    private Date rescheduledOnDate;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "writtenoffon_date")
+     private Date writtenOffOnDate;
 
-    @ManyToOne(optional = true, fetch=FetchType.LAZY)
-    @JoinColumn(name = "rescheduledon_userid", nullable = true)
-    private AppUser rescheduledByUser;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "rescheduledon_date")
+     private Date rescheduledOnDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "expected_maturedon_date")
-    private Date expectedMaturityDate;
+     @ManyToOne(optional = true, fetch = FetchType.LAZY)
+     @JoinColumn(name = "rescheduledon_userid", nullable = true)
+     private AppUser rescheduledByUser;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "maturedon_date")
-    private Date actualMaturityDate;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "expected_maturedon_date")
+     private Date expectedMaturityDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "expected_firstrepaymenton_date")
-    private Date expectedFirstRepaymentOnDate;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "maturedon_date")
+     private Date actualMaturityDate;
 
-    @Temporal(TemporalType.DATE)
-    @Column(name = "interest_calculated_from_date")
-    private Date interestChargedFromDate;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "expected_firstrepaymenton_date")
+     private Date expectedFirstRepaymentOnDate;
 
-    @Column(name = "total_overpaid_derived", scale = 6, precision = 19)
-    private BigDecimal totalOverpaid;
+     @Temporal(TemporalType.DATE)
+     @Column(name = "interest_calculated_from_date")
+     private Date interestChargedFromDate;
 
-    @Column(name = "loan_counter")
-    private Integer loanCounter;
+     @Column(name = "total_overpaid_derived", scale = 6, precision = 19)
+     private BigDecimal totalOverpaid;
 
-    @Column(name = "loan_product_counter")
-    private Integer loanProductCounter;
+     @Column(name = "loan_counter")
+     private Integer loanCounter;
 
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    private Set<LoanCharge> charges = new HashSet<>();
+     @Column(name = "loan_product_counter")
+     private Integer loanProductCounter;
 
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    private Set<LoanTrancheCharge> trancheCharges = new HashSet<>();
+     @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch = FetchType.LAZY)
+     private Set<LoanCharge> charges = new HashSet<>();
 
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    private Set<LoanCollateral> collateral = null;
+     @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch = FetchType.LAZY)
+     private Set<LoanTrancheCharge> trancheCharges = new HashSet<>();
 
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    private Set<LoanOfficerAssignmentHistory> loanOfficerHistory;
+     @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch = FetchType.LAZY)
+     private Set<LoanCollateral> collateral = null;
 
-    @OrderBy(value = "installmentNumber")
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    private List<LoanRepaymentScheduleInstallment> 
repaymentScheduleInstallments = new ArrayList<>();
+     @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch = FetchType.LAZY)
+     private Set<LoanOfficerAssignmentHistory> loanOfficerHistory;
 
-    @OrderBy(value = "dateOf, id")
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    private List<LoanTransaction> loanTransactions = new ArrayList<>();
+     @OrderBy(value = "installmentNumber")
+     @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch = FetchType.LAZY)
+     private List<LoanRepaymentScheduleInstallment> 
repaymentScheduleInstallments = new ArrayList<>();
 
-    @Embedded
-    private LoanSummary summary;
+     @OrderBy(value = "dateOf, id")
+     @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch = FetchType.LAZY)
+     private List<LoanTransaction> loanTransactions = new ArrayList<>();
 
-    @Transient
-    private boolean accountNumberRequiresAutoGeneration = false;
-    @Transient
-    private LoanRepaymentScheduleTransactionProcessorFactory 
transactionProcessorFactory;
-
-    @Transient
-    private LoanLifecycleStateMachine loanLifecycleStateMachine;
-    @Transient
-    private LoanSummaryWrapper loanSummaryWrapper;
-
-    @Column(name = "principal_amount_proposed", scale = 6, precision = 19, 
nullable = false)
-    private BigDecimal proposedPrincipal;
-
-    @Column(name = "approved_principal", scale = 6, precision = 19, nullable = 
false)
-    private BigDecimal approvedPrincipal;
-
-    @Column(name = "fixed_emi_amount", scale = 6, precision = 19, nullable = 
true)
-    private BigDecimal fixedEmiAmount;
-
-    @Column(name = "max_outstanding_loan_balance", scale = 6, precision = 19, 
nullable = true)
-    private BigDecimal maxOutstandingLoanBalance;
-
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    @OrderBy(value = "expectedDisbursementDate, id")
-    private List<LoanDisbursementDetails> disbursementDetails = new 
ArrayList<>();
-
-    @OrderBy(value = "termApplicableFrom, id")
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = 
true, fetch=FetchType.LAZY)
-    private List<LoanTermVariations> loanTermVariations = new ArrayList<>();
-
-    @Column(name = "total_recovered_derived", scale = 6, precision = 19)
-    private BigDecimal totalRecovered;
-
-    @OneToOne(cascade = CascadeType.ALL, mappedBy = "loan", optional = true, 
orphanRemoval = true, fetch=FetchType.EAGER)
-    private LoanInterestRecalculationDetails loanInterestRecalculationDetails;
-
-    @Column(name = "is_npa", nullable = false)
-    private boolean isNpa;
-
-    @Temporal(TemporalType.DATE)
-    @Column(name = "accrued_till")
-    private Date accruedTill;
-
-    @Column(name = "create_standing_instruction_at_disbursement", nullable = 
true)
-    private Boolean createStandingInstructionAtDisbursement;
-
-    @Column(name = "guarantee_amount_derived", scale = 6, precision = 19, 
nullable = true)
-    private BigDecimal guaranteeAmountDerived;
-
-    @Temporal(TemporalType.DATE)
-    @Column(name = "interest_recalcualated_on")
-    private Date interestRecalculatedOn;
-
-    @Column(name = "is_floating_interest_rate", nullable = true)
-    private Boolean isFloatingInterestRate;
-
-    @Column(name = "interest_rate_differential", scale = 6, precision = 19, 
nullable = true)
-    private BigDecimal interestRateDifferential;
-
-    @ManyToOne(fetch=FetchType.LAZY)
-    @JoinColumn(name = "writeoff_reason_cv_id", nullable = true)
-    private CodeValue writeOffReason;
-
-    @Column(name = "loan_sub_status_id", nullable = true)
-    private Integer loanSubStatus;
-
-    @Column(name = "is_topup", nullable = false)
-    private boolean isTopup = false;
-
-    @OneToOne(cascade = CascadeType.ALL, mappedBy = "loan", optional = true, 
orphanRemoval = true, fetch=FetchType.EAGER)
-    private LoanTopupDetails loanTopupDetails;
-
-    @OneToMany(fetch = FetchType.LAZY)
-    @JoinTable(name = "m_loan_rate", joinColumns = @JoinColumn(name = 
"loan_id"), inverseJoinColumns = @JoinColumn(name = "rate_id"))
-    private List<Rate> rates;
-
-    public static Loan newIndividualLoanApplication(final String accountNo, 
final Client client, final Integer loanType,
-            final LoanProduct loanProduct, final Fund fund, final Staff 
officer, final CodeValue loanPurpose,
-            final LoanTransactionProcessingStrategy 
transactionProcessingStrategy,
-            final LoanProductRelatedDetail loanRepaymentScheduleDetail, final 
Set<LoanCharge> loanCharges,
-            final Set<LoanCollateral> collateral, final BigDecimal 
fixedEmiAmount, final List<LoanDisbursementDetails> disbursementDetails,
 
 Review comment:
   Please note, whenever we send a PR, it should contain either refactoring 
commit or new change commit. If the PR contains both then we should have first 
refactoring and then new feature commit.
   I know its difficult, to judge initially whether the change you are going to 
make is going to be either refactoring or new change. But practicing such 
behavior makes it easy for reviewer. It also helps to understand the impact the 
PR is going to have on the existing functionality.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to