small bit of tidy up.

This commit is contained in:
Keith Woodlock
2012-09-13 17:10:25 +01:00
parent 45200343be
commit 16da04f089
3 changed files with 22 additions and 25 deletions
@@ -196,27 +196,27 @@ public class DepositAccountsApiResource {
DepositStateTransitionApprovalCommand command=apiDataConversionService.convertJsonToDepositStateTransitionApprovalCommand(accountId, jsonRequestBody);
EntityIdentifier identifier = this.depositAccountWritePlatformService.approveDepositApplication(command);
response = Response.ok().entity(identifier).build();
}
else{
DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody);
if (is(commandParam, "reject")) {
EntityIdentifier identifier = this.depositAccountWritePlatformService.rejectDepositApplication(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "withdrewbyclient")) {
EntityIdentifier identifier = this.depositAccountWritePlatformService.withdrawDepositApplication(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "mature")){
EntityIdentifier identifier = this.depositAccountWritePlatformService.matureDepositApplication(command);
response = Response.ok().entity(identifier).build();
}
UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(accountId, command.getNote());
if (is(commandParam, "undoapproval")) {
EntityIdentifier identifier = this.depositAccountWritePlatformService.undoDepositApproval(undoCommand);
response = Response.ok().entity(identifier).build();
}
} else {
DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody);
if (is(commandParam, "reject")) {
EntityIdentifier identifier = this.depositAccountWritePlatformService.rejectDepositApplication(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "withdrewbyclient")) {
EntityIdentifier identifier = this.depositAccountWritePlatformService.withdrawDepositApplication(command);
response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "mature")){
EntityIdentifier identifier = this.depositAccountWritePlatformService.matureDepositApplication(command);
response = Response.ok().entity(identifier).build();
}
UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(accountId, command.getNote());
if (is(commandParam, "undoapproval")) {
EntityIdentifier identifier = this.depositAccountWritePlatformService.undoDepositApproval(undoCommand);
response = Response.ok().entity(identifier).build();
}
}
if (response == null) {
throw new UnrecognizedQueryParamException("command", commandParam);
}
@@ -41,7 +41,6 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@JoinColumn(name = "client_id", nullable = false)
private Client client;
@SuppressWarnings("unused")
@ManyToOne
@JoinColumn(name = "product_id")
private final DepositProduct product;
@@ -75,7 +74,6 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "actual_commencement_date")
private Date actualCommencementDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE)
@Column(name = "matures_on_date")
private Date maturesOnDate;
@@ -92,7 +90,6 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "projected_total_maturity_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal projectedTotalOnMaturity;
@SuppressWarnings("unused")
@Column(name = "actual_total_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal total;
@@ -100,7 +97,6 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "pre_closure_interest_rate", scale = 6, precision = 19, nullable = false)
private BigDecimal preClosureInterestRate;
@SuppressWarnings("unused")
@Column(name = "is_renewal_allowed", nullable = false)
private boolean renewalAllowed = false;
@@ -137,6 +133,7 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "depositAccount", orphanRemoval = true)
private final List<DepositAccountTransaction> depositaccountTransactions = new ArrayList<DepositAccountTransaction>();
@SuppressWarnings("unused")
@OneToOne(optional=true, cascade={CascadeType.PERSIST})
@JoinColumn(name = "renewed_account_id")
private DepositAccount renewdAccount;
@@ -57,7 +57,7 @@ public class DepositAccountCommandValidator {
baseDataValidator.reset().parameter("productId").value(command.getProductId()).notNull();
baseDataValidator.reset().parameter("externalId").value(command.getExternalId()).ignoreIfNull().notExceedingLengthOf(100);
baseDataValidator.reset().parameter("depositAmount").value(command.getDepositAmount()).notNull().zeroOrPositiveAmount();
baseDataValidator.reset().parameter("deposit").value(command.getDepositAmount()).notNull().zeroOrPositiveAmount();
baseDataValidator.reset().parameter("maturityInterestRate").value(command.getMaturityInterestRate()).ignoreIfNull().zeroOrPositiveAmount();
baseDataValidator.reset().parameter("preClosureInterestRate").value(command.getPreClosureInterestRate()).ignoreIfNull().zeroOrPositiveAmount();
baseDataValidator.reset().parameter("tenureInMonths").value(command.getTenureInMonths()).ignoreIfNull().integerGreaterThanZero();