update loan product resource for create and update

This commit is contained in:
Keith Woodlock
2012-05-29 02:12:16 +01:00
parent defcce1a31
commit 442b9d93d0
23 changed files with 384 additions and 467 deletions
@@ -1,184 +0,0 @@
package org.mifosng.data.command;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class CommonLoanProperties {
private String currencyCode;
private Integer digitsAfterDecimal;
private BigDecimal principal;
private Integer repaymentEvery;
private Integer repaymentFrequency;
private Integer numberOfRepayments;
private Integer amortizationMethod;
private BigDecimal inArrearsToleranceAmount;
private BigDecimal interestRatePerPeriod;
private Integer interestRateFrequencyMethod;
private Integer interestMethod;
private Integer interestCalculationPeriodMethod;
private boolean flexibleRepaymentSchedule = false;
private boolean interestRebateAllowed = false;
public CommonLoanProperties() {
//
}
public CommonLoanProperties(final String currencyCode,
final Integer digitsAfterDecimal, final Number principal,
final Number interestRatePerPeriod, Integer interestRateFrequencyMethod,
final Integer interestMethod, final Integer interestCalculationPeriodMethod,
final Integer repaymentEvery, final Integer repaymentFrequency, final Integer numberOfRepayments, Integer amortizationMethod, final Number toleranceAmount,
final boolean flexibleRepaymentSchedule,
final boolean interestRebateAllowed) {
this.currencyCode = currencyCode;
this.digitsAfterDecimal = digitsAfterDecimal;
if (principal != null) {
this.principal = BigDecimal.valueOf(Double.valueOf(principal.doubleValue()));
}
if (interestRatePerPeriod != null) {
this.interestRatePerPeriod = BigDecimal.valueOf(Double.valueOf(interestRatePerPeriod.doubleValue()));
}
this.interestRateFrequencyMethod = interestRateFrequencyMethod;
this.interestMethod = interestMethod;
this.interestCalculationPeriodMethod = interestCalculationPeriodMethod;
this.repaymentEvery = repaymentEvery;
this.repaymentFrequency = repaymentFrequency;
this.numberOfRepayments = numberOfRepayments;
this.amortizationMethod = amortizationMethod;
this.inArrearsToleranceAmount = BigDecimal.valueOf(Double.valueOf(toleranceAmount.toString()));
this.flexibleRepaymentSchedule = flexibleRepaymentSchedule;
this.interestRebateAllowed = interestRebateAllowed;
}
public String getCurrencyCode() {
return this.currencyCode;
}
public void setCurrencyCode(final String currencyCode) {
this.currencyCode = currencyCode;
}
public Integer getDigitsAfterDecimal() {
return this.digitsAfterDecimal;
}
public void setDigitsAfterDecimal(final Integer digitsAfterDecimal) {
this.digitsAfterDecimal = digitsAfterDecimal;
}
public Integer getRepaymentEvery() {
return this.repaymentEvery;
}
public void setRepaymentEvery(final Integer repaymentEvery) {
this.repaymentEvery = repaymentEvery;
}
public Integer getRepaymentFrequency() {
return this.repaymentFrequency;
}
public void setRepaymentFrequency(final Integer repaymentFrequency) {
this.repaymentFrequency = repaymentFrequency;
}
public boolean isFlexibleRepaymentSchedule() {
return this.flexibleRepaymentSchedule;
}
public void setFlexibleRepaymentSchedule(
final boolean flexibleRepaymentSchedule) {
this.flexibleRepaymentSchedule = flexibleRepaymentSchedule;
}
public boolean isInterestRebateAllowed() {
return this.interestRebateAllowed;
}
public void setInterestRebateAllowed(final boolean interestRebateAllowed) {
this.interestRebateAllowed = interestRebateAllowed;
}
public BigDecimal getPrincipal() {
return this.principal;
}
public void setPrincipal(final BigDecimal principal) {
this.principal = principal;
}
// public Boolean getFlexibleRepaymentSchedule() {
// return this.flexibleRepaymentSchedule;
// }
// public Boolean getInterestRebateAllowed() {
// return this.interestRebateAllowed;
// }
public Integer getInterestRateFrequencyMethod() {
return interestRateFrequencyMethod;
}
public void setInterestRateFrequencyMethod(Integer interestRateFrequencyMethod) {
this.interestRateFrequencyMethod = interestRateFrequencyMethod;
}
public Integer getInterestMethod() {
return interestMethod;
}
public void setInterestMethod(Integer interestMethod) {
this.interestMethod = interestMethod;
}
public Integer getAmortizationMethod() {
return amortizationMethod;
}
public void setAmortizationMethod(Integer amortizationMethod) {
this.amortizationMethod = amortizationMethod;
}
public Integer getNumberOfRepayments() {
return numberOfRepayments;
}
public void setNumberOfRepayments(Integer numberOfRepayments) {
this.numberOfRepayments = numberOfRepayments;
}
public BigDecimal getInterestRatePerPeriod() {
return interestRatePerPeriod;
}
public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) {
this.interestRatePerPeriod = interestRatePerPeriod;
}
public BigDecimal getInArrearsToleranceAmount() {
return inArrearsToleranceAmount;
}
public void setInArrearsToleranceAmount(BigDecimal inArrearsToleranceAmount) {
this.inArrearsToleranceAmount = inArrearsToleranceAmount;
}
public Integer getInterestCalculationPeriodMethod() {
return interestCalculationPeriodMethod;
}
public void setInterestCalculationPeriodMethod(
Integer interestCalculationPeriodMethod) {
this.interestCalculationPeriodMethod = interestCalculationPeriodMethod;
}
}
@@ -1,200 +0,0 @@
package org.mifosng.data.command;
import java.math.BigDecimal;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class LoanProductCommand {
private Long id;
private String name;
private String description;
private String externalId;
private String locale;
private String currencyCode;
private Integer digitsAfterDecimal;
private BigDecimal principal;
private String principalFormatted;
private BigDecimal inArrearsToleranceAmount;
private String inArrearsToleranceAmountFormatted;
private Integer repaymentEvery;
private Integer repaymentFrequency;
private Integer numberOfRepayments;
private BigDecimal interestRatePerPeriod;
private String interestRatePerPeriodFormatted;
private Integer interestRateFrequencyMethod;
private Integer amortizationMethod;
private Integer interestMethod;
private Integer interestCalculationPeriodMethod;
protected LoanProductCommand() {
//
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
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 String getExternalId() {
return externalId;
}
public void setExternalId(String externalId) {
this.externalId = externalId;
}
public String getCurrencyCode() {
return currencyCode;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public Integer getDigitsAfterDecimal() {
return digitsAfterDecimal;
}
public void setDigitsAfterDecimal(Integer digitsAfterDecimal) {
this.digitsAfterDecimal = digitsAfterDecimal;
}
public BigDecimal getPrincipal() {
return principal;
}
public void setPrincipal(BigDecimal principal) {
this.principal = principal;
}
public BigDecimal getInArrearsToleranceAmount() {
return inArrearsToleranceAmount;
}
public void setInArrearsToleranceAmount(BigDecimal inArrearsToleranceAmount) {
this.inArrearsToleranceAmount = inArrearsToleranceAmount;
}
public Integer getRepaymentEvery() {
return repaymentEvery;
}
public void setRepaymentEvery(Integer repaymentEvery) {
this.repaymentEvery = repaymentEvery;
}
public Integer getRepaymentFrequency() {
return repaymentFrequency;
}
public void setRepaymentFrequency(Integer repaymentFrequency) {
this.repaymentFrequency = repaymentFrequency;
}
public Integer getNumberOfRepayments() {
return numberOfRepayments;
}
public void setNumberOfRepayments(Integer numberOfRepayments) {
this.numberOfRepayments = numberOfRepayments;
}
public BigDecimal getInterestRatePerPeriod() {
return interestRatePerPeriod;
}
public void setInterestRatePerPeriod(BigDecimal interestRatePerPeriod) {
this.interestRatePerPeriod = interestRatePerPeriod;
}
public Integer getInterestRateFrequencyMethod() {
return interestRateFrequencyMethod;
}
public void setInterestRateFrequencyMethod(Integer interestRateFrequencyMethod) {
this.interestRateFrequencyMethod = interestRateFrequencyMethod;
}
public Integer getAmortizationMethod() {
return amortizationMethod;
}
public void setAmortizationMethod(Integer amortizationMethod) {
this.amortizationMethod = amortizationMethod;
}
public Integer getInterestMethod() {
return interestMethod;
}
public void setInterestMethod(Integer interestMethod) {
this.interestMethod = interestMethod;
}
public Integer getInterestCalculationPeriodMethod() {
return interestCalculationPeriodMethod;
}
public void setInterestCalculationPeriodMethod(
Integer interestCalculationPeriodMethod) {
this.interestCalculationPeriodMethod = interestCalculationPeriodMethod;
}
public String getPrincipalFormatted() {
return principalFormatted;
}
public void setPrincipalFormatted(String principalFormatted) {
this.principalFormatted = principalFormatted;
}
public String getInterestRatePerPeriodFormatted() {
return interestRatePerPeriodFormatted;
}
public void setInterestRatePerPeriodFormatted(
String interestRatePerPeriodFormatted) {
this.interestRatePerPeriodFormatted = interestRatePerPeriodFormatted;
}
public String getInArrearsToleranceAmountFormatted() {
return inArrearsToleranceAmountFormatted;
}
public void setInArrearsToleranceAmountFormatted(
String inArrearsToleranceAmountFormatted) {
this.inArrearsToleranceAmountFormatted = inArrearsToleranceAmountFormatted;
}
public String getLocale() {
return locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
}
@@ -1,58 +0,0 @@
package org.mifosng.data.command;
import javax.xml.bind.annotation.XmlRootElement;
/**
* For creating and updating roles. When updating the id is expected to be populated.
*/
@XmlRootElement
public class RoleCommand {
private Long id;
private String name;
private String description;
private String[] permissions;
public RoleCommand() {
//
}
public RoleCommand(final String name, final String description, final String[] permissionIds) {
this.name = name;
this.description = description;
this.permissions = permissionIds;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
public String getDescription() {
return this.description;
}
public void setDescription(final String description) {
this.description = description;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String[] getPermissions() {
return permissions;
}
public void setPermissions(String[] permissions) {
this.permissions = permissions;
}
}
@@ -1,112 +0,0 @@
package org.mifosng.data.command;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
/**
* create or update user details command.
*/
@XmlRootElement
public class UserCommand implements Serializable {
private Long id;
private String username;
private String firstname;
private String lastname;
private String password;
private String repeatPassword;
private String email;
private Long officeId;
private String[] notSelectedRoles;
private String[] roles;
public UserCommand() {
//
}
public String getDisplayName() {
return new StringBuilder(this.lastname).append(", ").append(this.firstname).toString();
}
public String getUsername() {
return this.username;
}
public void setUsername(final String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(final String password) {
this.password = password;
}
public String getEmail() {
return this.email;
}
public void setEmail(final String email) {
this.email = email;
}
public Long getOfficeId() {
return this.officeId;
}
public void setOfficeId(final Long officeId) {
this.officeId = officeId;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String[] getNotSelectedRoles() {
return notSelectedRoles;
}
public void setNotSelectedRoles(String... notSelectedRoles) {
this.notSelectedRoles = notSelectedRoles;
}
public String[] getRoles() {
return roles;
}
public void setRoles(String... roles) {
this.roles = roles;
}
public String getRepeatPassword() {
return repeatPassword;
}
public void setRepeatPassword(String repeatPassword) {
this.repeatPassword = repeatPassword;
}
}