class OperationsApiServiceImpl implements OperationsApiService {

    @Override
    public ResponseEntity<Void> executeOperationAction(HttpServletRequest request, String spaceGuid, String operationId, String actionId) {
        Operation operation = getOperation(operationId);
        List<String> availableOperations = getAvailableActions(operation);
        if (!availableOperations.contains(actionId)) {
            throw new IllegalArgumentException(MessageFormat.format(Messages.ACTION_0_CANNOT_BE_EXECUTED_OVER_OPERATION_1_IN_STATE_2,
                                                                    actionId, operationId, operation.getState()));
        }
        ProcessAction action = processActionRegistry.getAction(Action.fromString(actionId));
        action.execute(getAuthenticatedUser(request), operationId);
        AuditLoggingProvider.getFacade()
                            .logAboutToStart(MessageFormat.format("{0} over operation with id {1}", action, operation.getProcessId()));
        return ResponseEntity.accepted()
                             .header("Location", getLocationHeader(operationId, spaceGuid))
                             .build();
    }

}