public static ActionRequestValidationException addValidationError(String error, ActionRequestValidationException validationException) { if (validationException == null) { validationException = new ActionRequestValidationException(); } validationException.addValidationError(error); return validationException; } }
public static ActionRequestValidationException addValidationError(String error, ActionRequestValidationException validationException) { if (validationException == null) { validationException = new ActionRequestValidationException(); } validationException.addValidationError(error); return validationException; } }
public static ActionRequestValidationException addValidationError(String error, ActionRequestValidationException validationException) { if (validationException == null) { validationException = new ActionRequestValidationException(); } validationException.addValidationError(error); return validationException; } }
public static ActionRequestValidationException addValidationError(String error, ActionRequestValidationException validationException) { if (validationException == null) { validationException = new ActionRequestValidationException(); } validationException.addValidationError(error); return validationException; } }
public static ActionRequestValidationException addValidationError(String error, ActionRequestValidationException validationException) { if (validationException == null) { validationException = new ActionRequestValidationException(); } validationException.addValidationError(error); return validationException; } }
@Override public ActionRequestValidationException validate() { ActionRequestValidationException exception = null; if (template == null) { exception = new ActionRequestValidationException(); exception.addValidationError("template must not be null"); } return exception; }
public static CFMetaData getCFMetaData(final String ksName, final String cfName) throws ActionRequestValidationException { CFMetaData metadata = Schema.instance.getCFMetaData(ksName, cfName); if (metadata == null) { ActionRequestValidationException arve = new ActionRequestValidationException(); arve.addValidationError(ksName+"."+cfName+" table does not exists");; throw arve; } return metadata; }
@Override public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { final GetRequest getRequest = new GetRequest(request.param("index"), request.param("type"), request.param("id")); getRequest.refresh(request.paramAsBoolean("refresh", getRequest.refresh())); getRequest.routing(request.param("routing")); getRequest.parent(request.param("parent")); getRequest.preference(request.param("preference")); getRequest.realtime(request.paramAsBoolean("realtime", getRequest.realtime())); getRequest.fetchSourceContext(FetchSourceContext.parseFromRestRequest(request)); return channel -> { if (getRequest.fetchSourceContext() != null && !getRequest.fetchSourceContext().fetchSource()) { final ActionRequestValidationException validationError = new ActionRequestValidationException(); validationError.addValidationError("fetching source can not be disabled"); channel.sendResponse(new BytesRestResponse(channel, validationError)); } else { client.get(getRequest, new RestGetSourceResponseListener(channel, request)); } }; }
/** * Throws an ActionRequestValidationException if the request tries to index * back into the same index or into an index that points to two indexes. * This cannot be done during request validation because the cluster state * isn't available then. Package private for testing. */ static String validateAgainstAliases(SearchRequest source, IndexRequest destination, IndexNameExpressionResolver indexNameExpressionResolver, AutoCreateIndex autoCreateIndex, ClusterState clusterState) { String target = destination.index(); if (false == autoCreateIndex.shouldAutoCreate(target, clusterState)) { /* * If we're going to autocreate the index we don't need to resolve * it. This is the same sort of dance that TransportIndexRequest * uses to decide to autocreate the index. */ target = indexNameExpressionResolver.concreteIndices(clusterState, destination)[0]; } for (String sourceIndex: indexNameExpressionResolver.concreteIndices(clusterState, source)) { if (sourceIndex.equals(target)) { ActionRequestValidationException e = new ActionRequestValidationException(); e.addValidationError("reindex cannot write into an index its reading from [" + target + ']'); throw e; } } return target; }
/** * Throws an ActionRequestValidationException if the request tries to index * back into the same index or into an index that points to two indexes. * This cannot be done during request validation because the cluster state * isn't available then. Package private for testing. */ static String validateAgainstAliases(SearchRequest source, IndexRequest destination, IndexNameExpressionResolver indexNameExpressionResolver, AutoCreateIndex autoCreateIndex, ClusterState clusterState) { String target = destination.index(); if (false == autoCreateIndex.shouldAutoCreate(target, clusterState)) { /* * If we're going to autocreate the index we don't need to resolve * it. This is the same sort of dance that TransportIndexRequest * uses to decide to autocreate the index. */ target = indexNameExpressionResolver.concreteIndices(clusterState, destination)[0]; } for (String sourceIndex: indexNameExpressionResolver.concreteIndices(clusterState, source)) { if (sourceIndex.equals(target)) { ActionRequestValidationException e = new ActionRequestValidationException(); e.addValidationError("reindex cannot write into an index its reading from [" + target + ']'); throw e; } } return target; }
/** * Throws an ActionRequestValidationException if the request tries to index * back into the same index or into an index that points to two indexes. * This cannot be done during request validation because the cluster state * isn't available then. Package private for testing. */ static void validateAgainstAliases(SearchRequest source, IndexRequest destination, RemoteInfo remoteInfo, IndexNameExpressionResolver indexNameExpressionResolver, AutoCreateIndex autoCreateIndex, ClusterState clusterState) { if (remoteInfo != null) { return; } String target = destination.index(); if (false == autoCreateIndex.shouldAutoCreate(target, clusterState)) { /* * If we're going to autocreate the index we don't need to resolve * it. This is the same sort of dance that TransportIndexRequest * uses to decide to autocreate the index. */ target = indexNameExpressionResolver.concreteIndexNames(clusterState, destination)[0]; } for (String sourceIndex : indexNameExpressionResolver.concreteIndexNames(clusterState, source)) { if (sourceIndex.equals(target)) { ActionRequestValidationException e = new ActionRequestValidationException(); e.addValidationError("reindex cannot write into an index its reading from [" + target + ']'); throw e; } } }
try { ActionRequestValidationException validationError = new ActionRequestValidationException(); validationError.addValidationError("fetching source can not be disabled"); channel.sendResponse(new BytesRestResponse(channel, validationError)); } catch (IOException e) {
if (getRequest.fetchSourceContext() != null && !getRequest.fetchSourceContext().fetchSource()) { final ActionRequestValidationException validationError = new ActionRequestValidationException(); validationError.addValidationError("fetching source can not be disabled"); channel.sendResponse(new BytesRestResponse(channel, validationError)); } else {
if (getRequest.fetchSourceContext() != null && !getRequest.fetchSourceContext().fetchSource()) { final ActionRequestValidationException validationError = new ActionRequestValidationException(); validationError.addValidationError("fetching source can not be disabled"); channel.sendResponse(new BytesRestResponse(channel, validationError)); } else {
if (getRequest.fetchSourceContext() != null && !getRequest.fetchSourceContext().fetchSource()) { final ActionRequestValidationException validationError = new ActionRequestValidationException(); validationError.addValidationError("fetching source can not be disabled"); channel.sendResponse(new BytesRestResponse(channel, validationError)); } else {