Merge pull request #814 from Musoni/MIFOSX-1014

MIFOSX-1014 - Fixed MakerChecker for Loans,Savings and possibly many mor...
This commit is contained in:
Vishwas Babu A J
2014-03-26 01:09:45 -07:00
4 changed files with 81 additions and 3 deletions
@@ -183,4 +183,41 @@ public class CommandSource extends AbstractPersistable<Long> {
public Long getProductId() { public Long getProductId() {
return this.productId; return this.productId;
} }
/**
* @return the clientId
*/
public Long getClientId() {
return clientId;
}
/**
* @return the groupId
*/
public Long getGroupId() {
return groupId;
}
/**
* @return the loanId
*/
public Long getLoanId() {
return loanId;
}
/**
* @return the officeId
*/
public Long getOfficeId() {
return officeId;
}
/**
* @return the savingsId
*/
public Long getSavingsId() {
return savingsId;
}
} }
@@ -37,6 +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,
final Long resourceId, final Long subresourceId, final String resourceGetUrl, final Long productId,
final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId) {
return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl, productId);
}
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;
@@ -84,6 +91,30 @@ public class CommandWrapper {
this.templateId = templateId; this.templateId = templateId;
} }
public CommandWrapper(final Long commandId, final String actionName, final String entityName,
final Long resourceId, final Long subresourceId, final String resourceGetUrl, final Long productId,
final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId) {
this.commandId = commandId;
this.officeId = officeId;
this.groupId = groupId;
this.clientId = clientId;
this.loanId = loanId;
this.savingsId = savingsId;
this.actionName = actionName;
this.entityName = entityName;
this.taskPermissionName = actionName + "_" + entityName;
this.entityId = resourceId;
this.subentityId = subresourceId;
this.codeId = null;
this.supportedEntityType = null;
this.supportedEntityId = null;
this.href = resourceGetUrl;
this.json = null;
this.transactionId = null;
this.productId = productId;
}
public Long commandId() { public Long commandId() {
return this.commandId; return this.commandId;
} }
@@ -86,12 +86,14 @@ 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.getResourceGetUrl(), commandSourceInput.getProductId(), commandSourceInput.getOfficeId(),
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.getResourceGetUrl(), commandSourceInput.getProductId()); commandSourceInput.subresourceId(), commandSourceInput.getGroupId(), commandSourceInput.getClientId(), 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,6 +67,13 @@ public final class JsonCommand {
null, null, null, null, null, null, url, productId); null, null, null, null, null, null, url, productId);
} }
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 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,
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,
@@ -90,6 +97,7 @@ 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;