remove apptableId and datatableId from audit & maker-checker processing (refactored to not need them)
This commit is contained in:
+6
-26
@@ -20,8 +20,6 @@ public class CommandWrapper {
|
|||||||
private final Long subentityId;
|
private final Long subentityId;
|
||||||
private final String href;
|
private final String href;
|
||||||
private final String json;
|
private final String json;
|
||||||
private final Long apptableId;
|
|
||||||
private final Long datatableId;
|
|
||||||
private final Long codeId;
|
private final Long codeId;
|
||||||
private final String transactionId;
|
private final String transactionId;
|
||||||
private final String supportedEntityType;
|
private final String supportedEntityType;
|
||||||
@@ -55,19 +53,10 @@ public class CommandWrapper {
|
|||||||
this.json = null;
|
this.json = null;
|
||||||
this.transactionId = null;
|
this.transactionId = null;
|
||||||
|
|
||||||
/* 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,
|
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 subentityId, final Long apptableId, final Long datatableId, final Long codeId,
|
final String entityName, final Long entityId, final Long subentityId, final Long codeId,
|
||||||
final String supportedEntityType, final Long supportedEntityId, final String href, final String json, final String transactionId) {
|
final String supportedEntityType, final Long supportedEntityId, final String href, final String json, final String transactionId) {
|
||||||
this.commandId = null;
|
this.commandId = null;
|
||||||
this.officeId = officeId;
|
this.officeId = officeId;
|
||||||
@@ -79,8 +68,6 @@ public class CommandWrapper {
|
|||||||
this.taskPermissionName = actionName + "_" + entityName;
|
this.taskPermissionName = actionName + "_" + entityName;
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
this.subentityId = subentityId;
|
this.subentityId = subentityId;
|
||||||
this.apptableId = apptableId;
|
|
||||||
this.datatableId = datatableId;
|
|
||||||
this.codeId = codeId;
|
this.codeId = codeId;
|
||||||
this.supportedEntityType = supportedEntityType;
|
this.supportedEntityType = supportedEntityType;
|
||||||
this.supportedEntityId = supportedEntityId;
|
this.supportedEntityId = supportedEntityId;
|
||||||
@@ -161,14 +148,6 @@ public class CommandWrapper {
|
|||||||
return this.loanId;
|
return this.loanId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getApptableId() {
|
|
||||||
return this.apptableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDatatableId() {
|
|
||||||
return this.datatableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSupportedEntityId() {
|
public Long getSupportedEntityId() {
|
||||||
return this.supportedEntityId;
|
return this.supportedEntityId;
|
||||||
}
|
}
|
||||||
@@ -372,19 +351,20 @@ public class CommandWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeleteOneToOne() {
|
public boolean isDeleteOneToOne() {
|
||||||
return isDatatableResource() && isDeleteOperation() && this.apptableId != null;
|
/* also covers case of deleting all of a one to many*/
|
||||||
|
return isDatatableResource() && isDeleteOperation() && this.subentityId == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeleteMultiple() {
|
public boolean isDeleteMultiple() {
|
||||||
return isDatatableResource() && isDeleteOperation() && this.apptableId != null && this.datatableId != null;
|
return isDatatableResource() && isDeleteOperation() && this.subentityId != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUpdateOneToOne() {
|
public boolean isUpdateOneToOne() {
|
||||||
return isDatatableResource() && isUpdateOperation() && this.apptableId != null;
|
return isDatatableResource() && isUpdateOperation() && this.subentityId == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUpdateMultiple() {
|
public boolean isUpdateMultiple() {
|
||||||
return isDatatableResource() && isUpdateOperation() && this.apptableId != null && this.datatableId != null;
|
return isDatatableResource() && isUpdateOperation() && this.subentityId != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnassignStaff() {
|
public boolean isUnassignStaff() {
|
||||||
|
|||||||
+1
-6
@@ -19,8 +19,6 @@ public class CommandWrapperBuilder {
|
|||||||
private Long subentityId;
|
private Long subentityId;
|
||||||
private String href;
|
private String href;
|
||||||
private String json = "{}";
|
private String json = "{}";
|
||||||
private Long apptableId;
|
|
||||||
private Long datatableId;
|
|
||||||
private Long codeId;
|
private Long codeId;
|
||||||
private String transactionId;
|
private String transactionId;
|
||||||
private String supportedEntityType;
|
private String supportedEntityType;
|
||||||
@@ -28,7 +26,7 @@ public class CommandWrapperBuilder {
|
|||||||
|
|
||||||
public CommandWrapper build() {
|
public CommandWrapper build() {
|
||||||
return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.actionName, this.entityName, this.entityId, this.subentityId,
|
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.codeId, this.supportedEntityType, this.supportedEntityId, this.href, this.json,
|
||||||
this.transactionId);
|
this.transactionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,9 +345,6 @@ public class CommandWrapperBuilder {
|
|||||||
|
|
||||||
|
|
||||||
private void commonDatatableSettings(final String datatable, final Long apptableId, final Long datatableId) {
|
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.entityName = datatable;
|
this.entityName = datatable;
|
||||||
this.entityId = apptableId;
|
this.entityId = apptableId;
|
||||||
|
|||||||
+2
-10
@@ -57,8 +57,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
|
|||||||
try {
|
try {
|
||||||
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(json);
|
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(json);
|
||||||
final JsonCommand command = JsonCommand.from(json, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(),
|
final JsonCommand command = JsonCommand.from(json, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(),
|
||||||
wrapper.getEntityId(), wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(),
|
wrapper.getEntityId(), wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getCodeId(), wrapper.getSupportedEntityType(), wrapper.getSupportedEntityId(), wrapper.getTransactionId());
|
||||||
wrapper.getDatatableId(), wrapper.getCodeId(), wrapper.getSupportedEntityType(), wrapper.getSupportedEntityId(), wrapper.getTransactionId());
|
|
||||||
|
|
||||||
result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
|
result = this.processAndLogCommandService.processAndLogCommand(wrapper, command, isApprovedByChecker);
|
||||||
} catch (RollbackTransactionAsCommandIsNotApprovedByCheckerException e) {
|
} catch (RollbackTransactionAsCommandIsNotApprovedByCheckerException e) {
|
||||||
@@ -67,15 +66,8 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
|
|||||||
|
|
||||||
final JsonElement parsedCommand = this.fromApiJsonHelper.parse(jsonToUse);
|
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(),
|
final JsonCommand command = JsonCommand.from(jsonToUse, parsedCommand, this.fromApiJsonHelper, wrapper.getEntityName(),
|
||||||
entityId, wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getApptableId(),
|
wrapper.getEntityId(), wrapper.getSubentityId(), wrapper.getGroupId(), wrapper.getClientId(), wrapper.getLoanId(), wrapper.getCodeId(), wrapper.getSupportedEntityType(), wrapper.getSupportedEntityId(), wrapper.getTransactionId());
|
||||||
wrapper.getDatatableId(), wrapper.getCodeId(), wrapper.getSupportedEntityType(), wrapper.getSupportedEntityId(), wrapper.getTransactionId());
|
|
||||||
|
|
||||||
result = this.processAndLogCommandService.logCommand(wrapper, command);
|
result = this.processAndLogCommandService.logCommand(wrapper, command);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-16
@@ -38,8 +38,6 @@ public final class JsonCommand {
|
|||||||
private final Long clientId;
|
private final Long clientId;
|
||||||
private final Long loanId;
|
private final Long loanId;
|
||||||
private final String entityName;
|
private final String entityName;
|
||||||
private final Long apptableId;
|
|
||||||
private final Long datatableId;
|
|
||||||
private final Long codeId;
|
private final Long codeId;
|
||||||
private final String supportedEntityType;
|
private final String supportedEntityType;
|
||||||
private final Long supportedEntityId;
|
private final Long supportedEntityId;
|
||||||
@@ -47,21 +45,21 @@ public final class JsonCommand {
|
|||||||
|
|
||||||
public static JsonCommand from(final String jsonCommand, final JsonElement parsedCommand, final FromJsonHelper fromApiJsonHelper,
|
public static JsonCommand from(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 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 codeId, final String supportedEntityType,
|
||||||
final Long supportedEntityId, final String transactionId) {
|
final Long supportedEntityId, final String transactionId) {
|
||||||
return new JsonCommand(null, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId, clientId, loanId,
|
return new JsonCommand(null, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, groupId, clientId, loanId,
|
||||||
apptableId, datatableId, codeId, supportedEntityType, supportedEntityId, transactionId);
|
codeId, supportedEntityType, supportedEntityId, transactionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, null, null, null, null,
|
return new JsonCommand(commandId, jsonCommand, parsedCommand, fromApiJsonHelper, entityName, resourceId, subresourceId, null, null, null, null,
|
||||||
null, null, null, null, null);
|
null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 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 Long clientId, final Long loanId, final Long codeId,
|
||||||
final String supportedEntityType, final Long supportedEntityId, final String transactionId) {
|
final String supportedEntityType, final Long supportedEntityId, final String transactionId) {
|
||||||
this.commandId = commandId;
|
this.commandId = commandId;
|
||||||
this.jsonCommand = jsonCommand;
|
this.jsonCommand = jsonCommand;
|
||||||
@@ -73,8 +71,6 @@ public final class JsonCommand {
|
|||||||
this.groupId = groupId;
|
this.groupId = groupId;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
this.loanId = loanId;
|
this.loanId = loanId;
|
||||||
this.apptableId = apptableId;
|
|
||||||
this.datatableId = datatableId;
|
|
||||||
this.codeId = codeId;
|
this.codeId = codeId;
|
||||||
this.supportedEntityType = supportedEntityType;
|
this.supportedEntityType = supportedEntityType;
|
||||||
this.supportedEntityId = supportedEntityId;
|
this.supportedEntityId = supportedEntityId;
|
||||||
@@ -126,14 +122,6 @@ public final class JsonCommand {
|
|||||||
return this.loanId;
|
return this.loanId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getApptableId() {
|
|
||||||
return this.apptableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDatatableId() {
|
|
||||||
return this.datatableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCodeId() {
|
public Long getCodeId() {
|
||||||
return this.codeId;
|
return this.codeId;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user