FINERACT-1971: Minor bug-fixes and enhancements

This commit is contained in:
jmarta
2023-09-28 18:11:29 +02:00
committed by Adam Saghy
parent 3f088e9c2a
commit f7f41d3e3c
20 changed files with 228 additions and 327 deletions
@@ -177,11 +177,11 @@ public class CommandStrategyProvider {
commandStrategies.put(
CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.method(POST).build(),
"adjustTransactionCommandStrategy");
"adjustLoanTransactionCommandStrategy");
commandStrategies.put(
CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(),
"adjustTransactionByExternalIdCommandStrategy");
"adjustLoanTransactionByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/clients\\/" + NUMBER_REGEX + "\\?command=activate").method(POST).build(),
"activateClientCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
@@ -196,9 +196,11 @@ public class CommandStrategyProvider {
"approveLoanRescheduleCommandStrategy");
commandStrategies.put(
CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX).method(GET).build(),
"getTransactionByIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(), "getTransactionByExternalIdCommandStrategy");
"getLoanTransactionByIdCommandStrategy");
commandStrategies.put(
CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getLoanTransactionByExternalIdCommandStrategy");
commandStrategies.put(CommandContext.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX)
.method(POST).build(), "createDatatableEntryCommandStrategy");
commandStrategies.put(CommandContext
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
import static org.apache.http.HttpStatus.SC_NOT_IMPLEMENTED;
import jakarta.ws.rs.core.UriInfo;
import org.apache.fineract.batch.command.CommandStrategy;
import org.apache.fineract.batch.domain.BatchRequest;
@@ -35,15 +37,8 @@ public class UnknownCommandStrategy implements CommandStrategy {
@Override
public BatchResponse execute(BatchRequest batchRequest, @SuppressWarnings("unused") UriInfo uriInfo) {
final BatchResponse batchResponse = new BatchResponse();
batchResponse.setRequestId(batchRequest.getRequestId());
batchResponse.setStatusCode(501);
batchResponse.setBody("Resource with method " + batchRequest.getMethod() + " and relativeUrl " + batchRequest.getRelativeUrl()
+ " doesn't exist");
return batchResponse;
return new BatchResponse().setRequestId(batchRequest.getRequestId()).setStatusCode(SC_NOT_IMPLEMENTED)
.setBody("Resource with method " + batchRequest.getMethod() + " and relativeUrl " + batchRequest.getRelativeUrl()
+ " doesn't exist");
}
}
@@ -128,7 +128,7 @@ public class CommandProcessingResultBuilder {
}
public CommandProcessingResultBuilder setRollbackTransaction(final boolean rollbackTransaction) {
this.rollbackTransaction = this.rollbackTransaction || rollbackTransaction;
this.rollbackTransaction |= rollbackTransaction;
return this;
}