cleaning up MIFOSX-1014

This commit is contained in:
Vishwas Babu A J
2014-03-26 01:21:31 -07:00
parent 8b86bde18b
commit f28e26c1e4
3 changed files with 26 additions and 21 deletions
@@ -37,13 +37,13 @@ public class CommandWrapper {
return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl, productId); return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl, productId);
} }
public static CommandWrapper fromExistingCommand(final Long commandId, final String actionName, final String entityName, public static CommandWrapper fromExistingCommand(final Long commandId, final String actionName, final String entityName,
final Long resourceId, final Long subresourceId, final String resourceGetUrl, final Long productId, final Long resourceId, final Long subresourceId, final String resourceGetUrl, final Long productId, final Long officeId,
final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId) { final Long groupId, final Long clientId, final Long loanId, final Long savingsId) {
return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl, productId); return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl, productId, officeId,
groupId, clientId, loanId, savingsId);
} }
private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId, private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId,
final Long subresourceId, final String resourceGetUrl, final Long productId) { final Long subresourceId, final String resourceGetUrl, final Long productId) {
this.commandId = commandId; this.commandId = commandId;
@@ -91,10 +91,10 @@ public class CommandWrapper {
this.templateId = templateId; this.templateId = templateId;
} }
public CommandWrapper(final Long commandId, final String actionName, final String entityName, private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId,
final Long resourceId, final Long subresourceId, final String resourceGetUrl, final Long productId, final Long subresourceId, final String resourceGetUrl, final Long productId, final Long officeId, final Long groupId,
final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId) { final Long clientId, final Long loanId, final Long savingsId) {
this.commandId = commandId; this.commandId = commandId;
this.officeId = officeId; this.officeId = officeId;
this.groupId = groupId; this.groupId = groupId;
@@ -114,7 +114,7 @@ public class CommandWrapper {
this.transactionId = null; this.transactionId = null;
this.productId = productId; this.productId = productId;
} }
public Long commandId() { public Long commandId() {
return this.commandId; return this.commandId;
} }
@@ -691,7 +691,7 @@ public class CommandWrapper {
public boolean isRejectClientTransfer() { public boolean isRejectClientTransfer() {
return this.actionName.equalsIgnoreCase("REJECTTRANSFER") && this.entityName.equalsIgnoreCase("CLIENT"); return this.actionName.equalsIgnoreCase("REJECTTRANSFER") && this.entityName.equalsIgnoreCase("CLIENT");
} }
public boolean isUpdateClientSavingsAccount() { public boolean isUpdateClientSavingsAccount() {
return this.actionName.equalsIgnoreCase("UPDATESAVINGSACCOUNT") && this.entityName.equalsIgnoreCase("CLIENT"); return this.actionName.equalsIgnoreCase("UPDATESAVINGSACCOUNT") && this.entityName.equalsIgnoreCase("CLIENT");
} }
@@ -86,14 +86,15 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
final CommandWrapper wrapper = CommandWrapper.fromExistingCommand(makerCheckerId, commandSourceInput.getActionName(), final CommandWrapper wrapper = CommandWrapper.fromExistingCommand(makerCheckerId, commandSourceInput.getActionName(),
commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.subresourceId(), commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.subresourceId(),
commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId(), commandSourceInput.getOfficeId(), commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId(), commandSourceInput.getOfficeId(),
commandSourceInput.getGroupId(), commandSourceInput.getClientId(), commandSourceInput.getLoanId(), commandSourceInput.getSavingsId()); commandSourceInput.getGroupId(), commandSourceInput.getClientId(), commandSourceInput.getLoanId(),
commandSourceInput.getSavingsId());
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(commandSourceInput.json()); final JsonElement parsedCommand = this.fromApiJsonHelper.parse(commandSourceInput.json());
final JsonCommand command = JsonCommand.fromExistingCommand(makerCheckerId, commandSourceInput.json(), parsedCommand, final JsonCommand command = JsonCommand.fromExistingCommand(makerCheckerId, commandSourceInput.json(), parsedCommand,
this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId(), this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId(),
commandSourceInput.subresourceId(), commandSourceInput.getGroupId(), commandSourceInput.getClientId(), commandSourceInput.getLoanId(), commandSourceInput.subresourceId(), commandSourceInput.getGroupId(), commandSourceInput.getClientId(),
commandSourceInput.getSavingsId(), commandSourceInput.getResourceGetUrl(), commandSourceInput.getProductId()); commandSourceInput.getLoanId(), commandSourceInput.getSavingsId(), commandSourceInput.getResourceGetUrl(),
commandSourceInput.getProductId());
final boolean makerCheckerApproval = true; final boolean makerCheckerApproval = true;
return this.processAndLogCommandService.processAndLogCommand(wrapper, command, makerCheckerApproval); return this.processAndLogCommandService.processAndLogCommand(wrapper, command, makerCheckerApproval);
@@ -67,13 +67,18 @@ public final class JsonCommand {
null, null, null, null, null, null, url, productId); null, null, null, null, null, null, url, productId);
} }
/***
* Vishwas TODO: If we are recreating this command from the database, all
* properties should be set. Presence of NULL properties means we can expect
* errors!
***/
public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand, public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId, final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
final Long groupId, final Long clientId, final Long loanId, final Long savingsId,final String url, final Long productId) { final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final String url, final Long productId) {
return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId, clientId, return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId,
loanId, savingsId, null, null, null, null, url, productId); clientId, loanId, savingsId, null, null, null, null, url, productId);
} }
public JsonCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand, public JsonCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId, final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId,
final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final Long codeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId, final Long codeId,
@@ -97,7 +102,6 @@ public final class JsonCommand {
this.url = url; this.url = url;
this.productId = productId; this.productId = productId;
} }
public String json() { public String json() {
return this.jsonCommand; return this.jsonCommand;