fixed mifosx-268 one to many datatable update and deletes fail maker checker approve... plus minor other changes
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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` ;
|
||||
@@ -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;
|
||||
|
||||
+3
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-2
@@ -52,6 +52,9 @@ public class CommandSource extends AbstractPersistable<Long> {
|
||||
|
||||
@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<Long> {
|
||||
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<Long> {
|
||||
|
||||
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<Long> {
|
||||
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<Long> {
|
||||
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<Long> {
|
||||
public Long getResourceId() {
|
||||
return this.resourceId;
|
||||
}
|
||||
|
||||
public Long getSubresourceId() {
|
||||
return this.subresourceId;
|
||||
}
|
||||
|
||||
public void markAsAwaitingApproval() {
|
||||
this.processingResult = CommandProcessingResultType.AWAITING_APPROVAL.getValue();
|
||||
|
||||
+26
-12
@@ -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() {
|
||||
|
||||
+18
-21
@@ -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";
|
||||
|
||||
+4
-4
@@ -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);
|
||||
|
||||
+11
-5
@@ -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;
|
||||
|
||||
+2
-7
@@ -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();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -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();
|
||||
}
|
||||
}
|
||||
+2
-7
@@ -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();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -31,8 +31,8 @@ public class UpdateOneToManyDatatableEntryCommandHandler implements NewCommandSo
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
final Map<String, Object> 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();
|
||||
}
|
||||
}
|
||||
+2
-7
@@ -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<String, Object> changes = this.writePlatformService.updateDatatableEntryOneToOne(command.entityName(), appTableId,
|
||||
final Map<String, Object> changes = this.writePlatformService.updateDatatableEntryOneToOne(command.entityName(), command.entityId(),
|
||||
command);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(appTableId) //
|
||||
.withEntityId(command.entityId()) //
|
||||
.with(changes) //
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user