From ea9e24a270953117cf4e273cb16246b7e84e34bd Mon Sep 17 00:00:00 2001 From: John Woodlock Date: Thu, 21 Mar 2013 22:20:32 +0000 Subject: [PATCH] fixed mifosx-268 one to many datatable update and deletes fail maker checker approve... plus minor other changes --- .../0001a-mifosplatform-core-ddl-latest.sql | 1 + ..._audit_log_for_datatable_1_to_many_use.sql | 7 ++++ .../mifosplatform/audit/data/AuditData.java | 5 ++- .../service/AuditReadPlatformServiceImpl.java | 5 ++- .../commands/domain/CommandSource.java | 20 +++++++++- .../commands/domain/CommandWrapper.java | 38 ++++++++++++------ .../service/CommandWrapperBuilder.java | 39 +++++++++---------- ...CommandSourceWritePlatformServiceImpl.java | 8 ++-- .../infrastructure/core/api/JsonCommand.java | 16 +++++--- .../CreateDatatableEntryCommandHandler.java | 9 +---- ...OneToManyDatatableEntryCommandHandler.java | 4 +- ...eOneToOneDatatableEntryCommandHandler.java | 9 +---- ...OneToManyDatatableEntryCommandHandler.java | 4 +- ...eOneToOneDatatableEntryCommandHandler.java | 9 +---- 14 files changed, 102 insertions(+), 72 deletions(-) create mode 100644 mifosng-db/patches/5-add-subresource_id_to_audit_log_for_datatable_1_to_many_use.sql diff --git a/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql b/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql index 06dfb9343..3bfeb9294 100644 --- a/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql +++ b/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql @@ -291,6 +291,7 @@ CREATE TABLE `m_portfolio_command_source` ( `loan_id` bigint(20) DEFAULT NULL, `api_get_url` varchar(100) NOT NULL, `resource_id` bigint(20) DEFAULT NULL, + `subresource_id` bigint(20) DEFAULT NULL, `command_as_json` text NOT NULL, `maker_id` bigint(20) NOT NULL, `made_on_date` datetime NOT NULL, diff --git a/mifosng-db/patches/5-add-subresource_id_to_audit_log_for_datatable_1_to_many_use.sql b/mifosng-db/patches/5-add-subresource_id_to_audit_log_for_datatable_1_to_many_use.sql new file mode 100644 index 000000000..bcbdd818d --- /dev/null +++ b/mifosng-db/patches/5-add-subresource_id_to_audit_log_for_datatable_1_to_many_use.sql @@ -0,0 +1,7 @@ + +/* +Datatables defined as one to many need a subresource_id for maker-checker approval +*/ + +ALTER TABLE m_portfolio_command_source + ADD COLUMN `subresource_id` BIGINT(20) NULL AFTER `resource_id` ; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/audit/data/AuditData.java b/mifosng-provider/src/main/java/org/mifosplatform/audit/data/AuditData.java index 2b2d7f262..2ced9b8b9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/audit/data/AuditData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/audit/data/AuditData.java @@ -21,6 +21,8 @@ public final class AuditData { @SuppressWarnings("unused") private final Long resourceId; @SuppressWarnings("unused") + private final Long subresourceId; + @SuppressWarnings("unused") private final String maker; @SuppressWarnings("unused") private final DateTime madeOnDate; @@ -33,7 +35,7 @@ public final class AuditData { @SuppressWarnings("unused") private final String commandAsJson; - public AuditData(final Long id, final String actionName, final String entityName, final Long resourceId, final String maker, + public AuditData(final Long id, final String actionName, final String entityName, final Long resourceId, final Long subresourceId, final String maker, final DateTime madeOnDate, final String checker, final DateTime checkedOnDate, final String processingResult, final String commandAsJson) { @@ -41,6 +43,7 @@ public final class AuditData { this.actionName = actionName; this.entityName = entityName; this.resourceId = resourceId; + this.subresourceId = subresourceId; this.maker = maker; this.madeOnDate = madeOnDate; this.checker = checker; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/audit/service/AuditReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/audit/service/AuditReadPlatformServiceImpl.java index dc3820abe..3fdaaed65 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/audit/service/AuditReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/audit/service/AuditReadPlatformServiceImpl.java @@ -50,7 +50,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { String commandAsJsonString = ""; if (includeJson) commandAsJsonString = ", aud.command_as_json as commandAsJson "; - return " aud.id as id, aud.action_name as actionName, aud.entity_name as entityName," + " aud.resource_id as resourceId," + return " aud.id as id, aud.action_name as actionName, aud.entity_name as entityName," + " aud.resource_id as resourceId, aud.subresource_id as subresourceId," + " mk.username as maker, aud.made_on_date as madeOnDate, " + "ck.username as checker, aud.checked_on_date as checkedOnDate, ev.enum_message_property as processingResult " + commandAsJsonString + " from m_portfolio_command_source aud " + " left join m_appuser mk on mk.id = aud.maker_id" @@ -65,6 +65,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { final String actionName = rs.getString("actionName"); final String entityName = rs.getString("entityName"); final Long resourceId = JdbcSupport.getLong(rs, "resourceId"); + final Long subresourceId = JdbcSupport.getLong(rs, "subresourceId"); final String maker = rs.getString("maker"); final DateTime madeOnDate = JdbcSupport.getDateTime(rs, "madeOnDate"); final String checker = rs.getString("checker"); @@ -77,7 +78,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { } catch (SQLException e) { commandAsJson = null; } - return new AuditData(id, actionName, entityName, resourceId, maker, madeOnDate, checker, checkedOnDate, processingResult, + return new AuditData(id, actionName, entityName, resourceId, subresourceId, maker, madeOnDate, checker, checkedOnDate, processingResult, commandAsJson); } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java index a64a9d697..7261580fa 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java @@ -52,6 +52,9 @@ public class CommandSource extends AbstractPersistable { @Column(name = "resource_id") private Long resourceId; + + @Column(name = "subresource_id") + private Long subresourceId; @Column(name = "command_as_json", length = 1000) private String commandAsJson; @@ -81,7 +84,7 @@ public class CommandSource extends AbstractPersistable { private Integer processingResult; public static CommandSource fullEntryFrom(final CommandWrapper wrapper, final JsonCommand command, final AppUser maker) { - return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.json(), maker, DateTime.now()); + return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.subentityId(), command.json(), maker, DateTime.now()); } protected CommandSource() { @@ -90,13 +93,14 @@ public class CommandSource extends AbstractPersistable { private CommandSource( final String actionName, final String entityName, final String href, - final Long resourceId, + final Long resourceId, final Long subresourceId, final String commandSerializedAsJson, final AppUser maker, final DateTime madeOnDateTime) { this.actionName = actionName; this.entityName = entityName; this.resourceGetUrl = href; this.resourceId = resourceId; + this.subresourceId = subresourceId; this.commandAsJson = commandSerializedAsJson; this.maker = maker; this.madeOnDate = madeOnDateTime.toDate(); @@ -112,6 +116,10 @@ public class CommandSource extends AbstractPersistable { public void updateResourceId(final Long resourceId) { this.resourceId = resourceId; } + + public void updateSubresourceId(final Long subresourceId) { + this.subresourceId = subresourceId; + } public void updateJsonTo(final String json) { this.commandAsJson = json; @@ -120,6 +128,10 @@ public class CommandSource extends AbstractPersistable { public Long resourceId() { return this.resourceId; } + + public Long subresourceId() { + return this.subresourceId; + } public boolean hasJson() { return StringUtils.isNotBlank(this.commandAsJson); @@ -144,6 +156,10 @@ public class CommandSource extends AbstractPersistable { public Long getResourceId() { return this.resourceId; } + + public Long getSubresourceId() { + return this.subresourceId; + } public void markAsAwaitingApproval() { this.processingResult = CommandProcessingResultType.AWAITING_APPROVAL.getValue(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java index 73f3db897..9da63a1b5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java @@ -17,6 +17,7 @@ public class CommandWrapper { private final String entityName; private final String taskPermissionName; private final Long entityId; + private final Long subentityId; private final String href; private final String json; private final Long apptableId; @@ -26,16 +27,16 @@ public class CommandWrapper { private final String supportedEntityType; private final Long supportedEntityId; - public static CommandWrapper wrap(final String actionName, final String enityName, final Long resourceId) { - return new CommandWrapper(null, actionName, enityName, resourceId, null); + public static CommandWrapper wrap(final String actionName, final String entityName, final Long resourceId, final Long subresourceId) { + return new CommandWrapper(null, actionName, entityName, resourceId, subresourceId, null); } - public static CommandWrapper fromExistingCommand(final Long commandId, final String actionName, final String enityName, - final Long resourceId, final String resourceGetUrl) { - return new CommandWrapper(commandId, actionName, enityName, resourceId, resourceGetUrl); + public static CommandWrapper fromExistingCommand(final Long commandId, final String actionName, final String entityName, + final Long resourceId, final Long subresourceId, final String resourceGetUrl) { + return new CommandWrapper(commandId, actionName, entityName, resourceId, subresourceId, resourceGetUrl); } - private CommandWrapper(final Long commandId, final String actionName, final String enityName, final Long resourceId, + private CommandWrapper(final Long commandId, final String actionName, final String entityName, final Long resourceId, final Long subresourceId, final String resourceGetUrl) { this.commandId = commandId; this.officeId = null; @@ -43,10 +44,10 @@ public class CommandWrapper { this.clientId = null; this.loanId = null; this.actionName = actionName; - this.entityName = enityName; + this.entityName = entityName; this.taskPermissionName = actionName + "_" + entityName; this.entityId = resourceId; - this.datatableId = null; + this.subentityId = subresourceId; this.codeId = null; this.supportedEntityType = null; this.supportedEntityId = null; @@ -54,15 +55,19 @@ public class CommandWrapper { this.json = null; this.transactionId = null; - if (this.href.contains("datatables")) { + /* TODO - jpw taking this out later*/ + if (this.href.startsWith("/datatables/")) { this.apptableId = resourceId; + this.datatableId = subresourceId; } else { this.apptableId = null; + this.datatableId = null; } + } public CommandWrapper(final Long officeId, final Long groupId, final Long clientId, final Long loanId, final String actionName, - final String entityName, final Long entityId, final Long apptableId, final Long datatableId, final Long codeId, + final String entityName, final Long entityId, final Long subentityId, final Long apptableId, final Long datatableId, final Long codeId, final String supportedEntityType, final Long supportedEntityId, final String href, final String json, final String transactionId) { this.commandId = null; this.officeId = officeId; @@ -73,6 +78,7 @@ public class CommandWrapper { this.entityName = entityName; this.taskPermissionName = actionName + "_" + entityName; this.entityId = entityId; + this.subentityId = subentityId; this.apptableId = apptableId; this.datatableId = datatableId; this.codeId = codeId; @@ -98,6 +104,10 @@ public class CommandWrapper { public Long resourceId() { return this.entityId; } + + public Long subresourceId() { + return this.subentityId; + } public String taskPermissionName() { return this.actionName + "_" + this.entityName; @@ -134,6 +144,10 @@ public class CommandWrapper { public Long getEntityId() { return this.entityId; } + + public Long getSubentityId() { + return this.subentityId; + } public Long getGroupId() { return this.groupId; @@ -353,8 +367,8 @@ public class CommandWrapper { return this.actionName.equalsIgnoreCase("BULKREASSIGN") && this.entityName.equalsIgnoreCase("LOAN"); } - public boolean isDatatableResource() { - return this.apptableId != null; + public boolean isDatatableResource() { + return this.href.startsWith("/datatables/"); } public boolean isDeleteOneToOne() { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java index 7979cef59..c8e68cd20 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java @@ -16,6 +16,7 @@ public class CommandWrapperBuilder { private String actionName; private String entityName; private Long entityId; + private Long subentityId; private String href; private String json = "{}"; private Long apptableId; @@ -26,7 +27,7 @@ public class CommandWrapperBuilder { private Long supportedEntityId; public CommandWrapper build() { - return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.actionName, this.entityName, this.entityId, + return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.actionName, this.entityName, this.entityId, this.subentityId, this.apptableId, this.datatableId, this.codeId, this.supportedEntityType, this.supportedEntityId, this.href, this.json, this.transactionId); } @@ -326,45 +327,41 @@ public class CommandWrapperBuilder { return this; } - public CommandWrapperBuilder createDatatable(final String datatable, final Long apptableId, final Long datatableId) { - this.apptableId = apptableId; - this.datatableId = datatableId; + public CommandWrapperBuilder createDatatable(final String datatable, final Long apptableId, final Long datatableId) { this.actionName = "CREATE"; - this.entityName = datatable; - if (datatableId == null) { - this.href = "/datatables/" + datatable + "/" + apptableId; - } else { - this.href = "/datatables/" + datatable + "/" + apptableId + "/" + datatableId; - } + commonDatatableSettings(datatable, apptableId, datatableId); return this; } public CommandWrapperBuilder updateDatatable(final String datatable, final Long apptableId, final Long datatableId) { - this.apptableId = apptableId; - this.datatableId = datatableId; this.actionName = "UPDATE"; - this.entityName = datatable; - if (datatableId == null) { - this.href = "/datatables/" + datatable + "/" + apptableId; - } else { - this.href = "/datatables/" + datatable + "/" + apptableId + "/" + datatableId; - } + commonDatatableSettings(datatable, apptableId, datatableId); return this; } public CommandWrapperBuilder deleteDatatable(final String datatable, final Long apptableId, final Long datatableId) { + this.actionName = "DELETE"; + commonDatatableSettings(datatable, apptableId, datatableId); + return this; + } + + + private void commonDatatableSettings(final String datatable, final Long apptableId, final Long datatableId) { + //TODO - remove apptableId and datatableId later JPW this.apptableId = apptableId; this.datatableId = datatableId; - this.actionName = "DELETE"; + this.entityName = datatable; + this.entityId = apptableId; + this.subentityId = datatableId; if (datatableId == null) { this.href = "/datatables/" + datatable + "/" + apptableId; } else { this.href = "/datatables/" + datatable + "/" + apptableId + "/" + datatableId; } - return this; } - + + public CommandWrapperBuilder createLoanCharge(final Long loanId) { this.actionName = "CREATE"; this.entityName = "LOANCHARGE"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java index b46567386..5843cb637 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java @@ -57,7 +57,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio try { final JsonElement parsedCommand = this.fromApiJsonHelper.parse(json); final JsonCommand command = JsonCommand.from(json, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(), - wrapper.getEntityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(), + wrapper.getEntityId(), wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(), wrapper.getDatatableId(), wrapper.getCodeId(), wrapper.getSupportedEntityType(), wrapper.getSupportedEntityId(), wrapper.getTransactionId()); result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker); @@ -74,7 +74,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio } final JsonCommand command = JsonCommand.from(jsonToUse, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(), - entityId, wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(), + entityId, wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(), wrapper.getDatatableId(), wrapper.getCodeId(), wrapper.getSupportedEntityType(), wrapper.getSupportedEntityId(), wrapper.getTransactionId()); result = this.processAndLogCommandService.logCommand(wrapper, command); @@ -91,11 +91,11 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio context.authenticatedUser().validateHasCheckerPermissionTo(commandSourceInput.getPermissionCode()); final CommandWrapper wrapper = CommandWrapper.fromExistingCommand(commandId, commandSourceInput.getActionName(), - commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.getResourceGetUrl()); + commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.subresourceId(), commandSourceInput.getResourceGetUrl()); final JsonElement parsedCommand = this.fromApiJsonHelper.parse(commandSourceInput.json()); final JsonCommand command = JsonCommand.fromExistingCommand(commandId, commandSourceInput.json(), parsedCommand, - this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId()); + this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.subresourceId()); final boolean makerCheckerApproval = true; return this.processAndLogCommandService.processAndLogCommand(wrapper, command, makerCheckerApproval); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/JsonCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/JsonCommand.java index 78a953c1c..d4c49043e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/JsonCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/JsonCommand.java @@ -33,6 +33,7 @@ public final class JsonCommand { private final FromJsonHelper fromApiJsonHelper; private final Long commandId; private final Long resourceId; + private final Long subresourceId; private final Long groupId; private final Long clientId; private final Long loanId; @@ -45,21 +46,21 @@ public final class JsonCommand { private final String transactionId; public static JsonCommand from(final String jsonCommand, final JsonElement parsedCommand, final FromJsonHelper fromApiJsonHelper, - final String entityName, final Long resourceId, final Long groupId, final Long clientId, final Long loanId, + final String entityName, final Long resourceId, final Long subresourceId, final Long groupId, final Long clientId, final Long loanId, final Long apptableId, final Long datatableId, final Long codeId, final String supportedEntityType, final Long supportedEntityId, final String transactionId) { - return new JsonCommand(null, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, groupId, clientId, loanId, + return new JsonCommand(null, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId, clientId, loanId, apptableId, datatableId, codeId, supportedEntityType, supportedEntityId, transactionId); } public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand, - final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId) { - return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, null, null, null, null, + final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId) { + return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, null, null, null, null, null, null, null, null, null); } public JsonCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand, - final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long groupId, + final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId, final Long subresourceId, final Long groupId, final Long clientId, final Long loanId, final Long apptableId, final Long datatableId, final Long codeId, final String supportedEntityType, final Long supportedEntityId, final String transactionId) { this.commandId = commandId; @@ -68,6 +69,7 @@ public final class JsonCommand { this.fromApiJsonHelper = fromApiJsonHelper; this.entityName = entityName; this.resourceId = resourceId; + this.subresourceId = subresourceId; this.groupId = groupId; this.clientId = clientId; this.loanId = loanId; @@ -107,6 +109,10 @@ public final class JsonCommand { public Long entityId() { return this.resourceId; } + + public Long subentityId() { + return this.subresourceId; + } public Long getGroupId() { return this.groupId; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/CreateDatatableEntryCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/CreateDatatableEntryCommandHandler.java index 792c023cb..84a5aaf4c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/CreateDatatableEntryCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/CreateDatatableEntryCommandHandler.java @@ -28,16 +28,11 @@ public class CreateDatatableEntryCommandHandler implements NewCommandSourceHandl @Override public CommandProcessingResult processCommand(final JsonCommand command) { - Long appTableId = command.getApptableId(); - if (appTableId == null) { - appTableId = command.entityId(); - } - - this.writePlatformService.createNewDatatableEntry(command.entityName(), appTableId, command); + this.writePlatformService.createNewDatatableEntry(command.entityName(), command.entityId(), command); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // - .withEntityId(appTableId) // + .withEntityId(command.entityId()) // .build(); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToManyDatatableEntryCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToManyDatatableEntryCommandHandler.java index d0c120c16..f6eb9bbf0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToManyDatatableEntryCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToManyDatatableEntryCommandHandler.java @@ -28,8 +28,8 @@ public class DeleteOneToManyDatatableEntryCommandHandler implements NewCommandSo @Override public CommandProcessingResult processCommand(final JsonCommand command) { - this.writePlatformService.deleteDatatableEntry(command.entityName(), command.getApptableId(), command.getDatatableId()); + this.writePlatformService.deleteDatatableEntry(command.entityName(), command.entityId(), command.subentityId()); - return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(command.getDatatableId()).build(); + return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(command.entityId()).build(); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToOneDatatableEntryCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToOneDatatableEntryCommandHandler.java index e5e3df0de..062ea2971 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToOneDatatableEntryCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/DeleteOneToOneDatatableEntryCommandHandler.java @@ -28,16 +28,11 @@ public class DeleteOneToOneDatatableEntryCommandHandler implements NewCommandSou @Override public CommandProcessingResult processCommand(final JsonCommand command) { - Long appTableId = command.getApptableId(); - if (appTableId == null) { - appTableId = command.entityId(); - } - - this.writePlatformService.deleteDatatableEntries(command.entityName(), appTableId); + this.writePlatformService.deleteDatatableEntries(command.entityName(), command.entityId()); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // - .withEntityId(appTableId) // + .withEntityId(command.entityId()) // .build(); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToManyDatatableEntryCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToManyDatatableEntryCommandHandler.java index a51057971..c4e92baab 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToManyDatatableEntryCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToManyDatatableEntryCommandHandler.java @@ -31,8 +31,8 @@ public class UpdateOneToManyDatatableEntryCommandHandler implements NewCommandSo public CommandProcessingResult processCommand(final JsonCommand command) { final Map changes = this.writePlatformService.updateDatatableEntryOneToMany(command.entityName(), - command.getApptableId(), command.getDatatableId(), command); + command.entityId(), command.subentityId(), command); - return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(command.getDatatableId()).with(changes).build(); + return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(command.entityId()).with(changes).build(); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToOneDatatableEntryCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToOneDatatableEntryCommandHandler.java index 6068fcfb1..fca32bc9c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToOneDatatableEntryCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/handler/UpdateOneToOneDatatableEntryCommandHandler.java @@ -30,17 +30,12 @@ public class UpdateOneToOneDatatableEntryCommandHandler implements NewCommandSou @Override public CommandProcessingResult processCommand(final JsonCommand command) { - Long appTableId = command.getApptableId(); - if (appTableId == null) { - appTableId = command.entityId(); - } - - final Map changes = this.writePlatformService.updateDatatableEntryOneToOne(command.entityName(), appTableId, + final Map changes = this.writePlatformService.updateDatatableEntryOneToOne(command.entityName(), command.entityId(), command); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // - .withEntityId(appTableId) // + .withEntityId(command.entityId()) // .with(changes) // .build(); }