error msg when commandId not found for maker-checker approvals
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
package org.mifosplatform.commands.exception;
|
||||
|
||||
import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
|
||||
/**
|
||||
* A {@link RuntimeException} thrown when client resources are not found.
|
||||
*/
|
||||
public class CommandNotFoundException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public CommandNotFoundException(Long id) {
|
||||
super("error.msg.command.id.invalid", "Command with identifier " + id + " does not exist", id);
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -14,6 +14,7 @@ import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
||||
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.portfolio.client.exception.ClientNotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -86,7 +87,8 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
|
||||
public CommandProcessingResult approveEntry(final Long commandId) {
|
||||
|
||||
final CommandSource commandSourceInput = this.commandSourceRepository.findOne(commandId);
|
||||
|
||||
if (commandSourceInput == null) {throw new ClientNotFoundException(commandId);}
|
||||
|
||||
context.authenticatedUser().validateHasCheckerPermissionTo(commandSourceInput.getPermissionCode());
|
||||
|
||||
final CommandWrapper wrapper = CommandWrapper.fromExistingCommand(commandId, commandSourceInput.getActionName(),
|
||||
|
||||
Reference in New Issue
Block a user