fix datatables on maker checker
This commit is contained in:
@@ -47,7 +47,6 @@ public class CommandSource extends AbstractPersistable<Long> {
|
||||
@Column(name = "loan_id")
|
||||
private Long loanId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "api_get_url", length = 100)
|
||||
private String resourceGetUrl;
|
||||
|
||||
@@ -156,4 +155,8 @@ public class CommandSource extends AbstractPersistable<Long> {
|
||||
this.clientId = clientId;
|
||||
this.loanId = loanId;
|
||||
}
|
||||
|
||||
public String getResourceGetUrl() {
|
||||
return this.resourceGetUrl;
|
||||
}
|
||||
}
|
||||
+12
-6
@@ -27,15 +27,16 @@ public class CommandWrapper {
|
||||
private final Long supportedEntityId;
|
||||
|
||||
public static CommandWrapper wrap(final String actionName, final String enityName, final Long resourceId) {
|
||||
return new CommandWrapper(null, actionName, enityName, resourceId);
|
||||
return new CommandWrapper(null, actionName, enityName, resourceId, null);
|
||||
}
|
||||
|
||||
public static CommandWrapper fromExistingCommand(final Long commandId, final String actionName, final String enityName,
|
||||
final Long resourceId) {
|
||||
return new CommandWrapper(commandId, actionName, enityName, resourceId);
|
||||
final Long resourceId, final String resourceGetUrl) {
|
||||
return new CommandWrapper(commandId, actionName, enityName, resourceId, 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 enityName, final Long resourceId,
|
||||
final String resourceGetUrl) {
|
||||
this.commandId = commandId;
|
||||
this.officeId = null;
|
||||
this.groupId = null;
|
||||
@@ -45,14 +46,19 @@ public class CommandWrapper {
|
||||
this.entityName = enityName;
|
||||
this.taskPermissionName = actionName + "_" + entityName;
|
||||
this.entityId = resourceId;
|
||||
this.apptableId = null;
|
||||
this.datatableId = null;
|
||||
this.codeId = null;
|
||||
this.supportedEntityType = null;
|
||||
this.supportedEntityId = null;
|
||||
this.href = null;
|
||||
this.href = resourceGetUrl;
|
||||
this.json = null;
|
||||
this.transactionId = null;
|
||||
|
||||
if (this.href.contains("datatables")) {
|
||||
this.apptableId = resourceId;
|
||||
} else {
|
||||
this.apptableId = null;
|
||||
}
|
||||
}
|
||||
|
||||
public CommandWrapper(final Long officeId, final Long groupId, final Long clientId, final Long loanId, final String actionName,
|
||||
|
||||
+10
-3
@@ -66,8 +66,15 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
|
||||
final String jsonToUse = StringUtils.defaultIfEmpty(e.getJsonOfChangesOnly(), json);
|
||||
|
||||
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(jsonToUse);
|
||||
|
||||
// for datatables
|
||||
Long entityId = wrapper.getEntityId();
|
||||
if (entityId == null && wrapper.isDatatableResource()) {
|
||||
entityId = wrapper.getApptableId();
|
||||
}
|
||||
|
||||
final JsonCommand command = JsonCommand.from(jsonToUse, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(),
|
||||
wrapper.getEntityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(),
|
||||
entityId, wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(),
|
||||
wrapper.getDatatableId(), wrapper.getCodeId(), wrapper.getSupportedEntityType(), wrapper.getSupportedEntityId(), wrapper.getTransactionId());
|
||||
|
||||
result = this.processAndLogCommandService.logCommand(wrapper, command);
|
||||
@@ -84,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.getEntityName(), commandSourceInput.resourceId(), commandSourceInput.getResourceGetUrl());
|
||||
|
||||
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(commandSourceInput.json());
|
||||
final JsonCommand command = JsonCommand.fromExistingCommand(commandId, commandSourceInput.json(), parsedCommand,
|
||||
this.fromApiJsonHelper, commandSourceInput.resourceId());
|
||||
this.fromApiJsonHelper, commandSourceInput.getEntityName(), commandSourceInput.resourceId());
|
||||
|
||||
final boolean makerCheckerApproval = true;
|
||||
return this.processAndLogCommandService.processAndLogCommand(wrapper, command, makerCheckerApproval);
|
||||
|
||||
+8
-9
@@ -46,21 +46,21 @@ public final class JsonCommand {
|
||||
|
||||
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 Long apptableId, final Long datatableId, final Long codeId, final String supportedEntityType, final Long supportedEntityId,
|
||||
final String transactionId) {
|
||||
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,
|
||||
apptableId, datatableId, codeId, supportedEntityType, supportedEntityId, transactionId);
|
||||
}
|
||||
|
||||
public static JsonCommand fromExistingCommand(final Long commandId, final String jsonCommand, final JsonElement parsedCommand,
|
||||
final FromJsonHelper fromApiJsonHelper, final Long resourceId) {
|
||||
return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, null, resourceId, null, null, null, null, null,
|
||||
null, null, null, null);
|
||||
final FromJsonHelper fromApiJsonHelper, final String entityName, final Long resourceId) {
|
||||
return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, 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 Long clientId, final Long loanId, final Long apptableId, final Long datatableId, final Long codeId,
|
||||
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;
|
||||
this.jsonCommand = jsonCommand;
|
||||
@@ -135,15 +135,14 @@ public final class JsonCommand {
|
||||
public Long getSupportedEntityId() {
|
||||
return this.supportedEntityId;
|
||||
}
|
||||
|
||||
|
||||
public String getSupportedEntityType() {
|
||||
return this.supportedEntityType;
|
||||
}
|
||||
|
||||
public String getTransactionId(){
|
||||
public String getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
|
||||
private boolean differenceExists(final LocalDate baseValue, final LocalDate workingCopyValue) {
|
||||
boolean differenceExists = false;
|
||||
|
||||
+7
-2
@@ -28,11 +28,16 @@ public class CreateDatatableEntryCommandHandler implements NewCommandSourceHandl
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
this.writePlatformService.createNewDatatableEntry(command.entityName(), command.getApptableId(), command);
|
||||
Long appTableId = command.getApptableId();
|
||||
if (appTableId == null) {
|
||||
appTableId = command.entityId();
|
||||
}
|
||||
|
||||
this.writePlatformService.createNewDatatableEntry(command.entityName(), appTableId, command);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.getApptableId()) //
|
||||
.withEntityId(appTableId) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+7
-2
@@ -28,11 +28,16 @@ public class DeleteOneToOneDatatableEntryCommandHandler implements NewCommandSou
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
this.writePlatformService.deleteDatatableEntries(command.entityName(), command.getApptableId());
|
||||
Long appTableId = command.getApptableId();
|
||||
if (appTableId == null) {
|
||||
appTableId = command.entityId();
|
||||
}
|
||||
|
||||
this.writePlatformService.deleteDatatableEntries(command.entityName(), appTableId);
|
||||
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(command.getApptableId()) //
|
||||
.withEntityId(appTableId) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -30,10 +30,18 @@ public class UpdateOneToOneDatatableEntryCommandHandler implements NewCommandSou
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
final Map<String, Object> changes = this.writePlatformService.updateDatatableEntryOneToOne(command.entityName(), command.getApptableId(),
|
||||
Long appTableId = command.getApptableId();
|
||||
if (appTableId == null) {
|
||||
appTableId = command.entityId();
|
||||
}
|
||||
|
||||
final Map<String, Object> changes = this.writePlatformService.updateDatatableEntryOneToOne(command.entityName(), appTableId,
|
||||
command);
|
||||
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(command.getApptableId()).with(changes)
|
||||
return new CommandProcessingResultBuilder() //
|
||||
.withCommandId(command.commandId()) //
|
||||
.withEntityId(appTableId) //
|
||||
.with(changes) //
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user