/*
(non-Javadoc)

@see
mtas.solr.handler.component.util.MtasSolrComponent#modifyRequest(org.apache
.solr.handler.component.ResponseBuilder,
org.apache.solr.handler.component.SearchComponent,
org.apache.solr.handler.component.ShardRequest)
976321
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
      ShardRequest sreq) {
    if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)) {
      if (sreq.params.getBool(PARAM_MTAS_TERMVECTOR, false)) {
        // compute keys
        Set<String> keys = MtasSolrResultUtil
            .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_TERMVECTOR);
        if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
          for (String key : keys) {
            String oldNumber = sreq.params.get(PARAM_MTAS_TERMVECTOR + "." + key
                + "." + NAME_MTAS_TERMVECTOR_NUMBER);
            int number;
            if (oldNumber != null) {
              int oldNumberValue = Integer.parseInt(oldNumber);
              number = (oldNumberValue >= 0)
                  ? oldNumberValue * SHARD_NUMBER_MULTIPLIER : oldNumberValue;
            } else {
              number = DEFAULT_NUMBER * SHARD_NUMBER_MULTIPLIER;
            }
            sreq.params.add(
                PARAM_MTAS_TERMVECTOR + "." + key + "."
                    + NAME_MTAS_TERMVECTOR_NUMBER_SHARDS,
                String.valueOf(number));
          }
        } else {
          sreq.params.remove(PARAM_MTAS_TERMVECTOR);
          for (String key : keys) {
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_FIELD);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_KEY);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_PREFIX);
            Set<String> distanceKeys = MtasSolrResultUtil
                .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_TERMVECTOR
                    + "." + key + "." + NAME_MTAS_TERMVECTOR_DISTANCE);
            for (String distanceKey : distanceKeys) {
              sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE + "." + distanceKey + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE_KEY);
              sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE + "." + distanceKey + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE_TYPE);
              sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE + "." + distanceKey + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE_BASE);
              sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE + "." + distanceKey + "."
                  + NAME_MTAS_TERMVECTOR_DISTANCE_MAXIMUM);
              Set<String> distanceParameters = MtasSolrResultUtil
                  .getIdsFromParameters(rb.req.getParams(),
                      PARAM_MTAS_TERMVECTOR + "." + key + "."
                          + NAME_MTAS_TERMVECTOR_DISTANCE + "." + distanceKey
                          + "." + NAME_MTAS_TERMVECTOR_DISTANCE_PARAMETER);
              for (String distanceParameter : distanceParameters) {
                sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                    + NAME_MTAS_TERMVECTOR_DISTANCE + "." + distanceKey + "."
                    + NAME_MTAS_TERMVECTOR_DISTANCE_PARAMETER + "."
                    + distanceParameter);
              }
            }
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_REGEXP);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_FULL);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_SORT_TYPE);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_SORT_DIRECTION);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_NUMBER);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_NUMBER_SHARDS);
            Set<String> functionKeys = MtasSolrResultUtil
                .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_TERMVECTOR
                    + "." + key + "." + NAME_MTAS_TERMVECTOR_FUNCTION);
            for (String functionKey : functionKeys) {
              sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                  + NAME_MTAS_TERMVECTOR_FUNCTION + "." + functionKey + "."
                  + NAME_MTAS_TERMVECTOR_FUNCTION_EXPRESSION);
              sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                  + NAME_MTAS_TERMVECTOR_FUNCTION + "." + functionKey + "."
                  + NAME_MTAS_TERMVECTOR_FUNCTION_KEY);
              sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                  + NAME_MTAS_TERMVECTOR_FUNCTION + "." + functionKey + "."
                  + NAME_MTAS_TERMVECTOR_FUNCTION_TYPE);
            }
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_BOUNDARY);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_LIST);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_LIST_REGEXP);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_IGNORE_REGEXP);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_IGNORE_LIST);
            sreq.params.remove(PARAM_MTAS_TERMVECTOR + "." + key + "."
                + NAME_MTAS_TERMVECTOR_IGNORE_REGEXP);
          }
        }
      }
    }
  }
179496
protected void appendRequestHandler(SolrQuery solrQuery, @Nullable String requestHandler) {
		if (StringUtils.isNotBlank(requestHandler)) {
			solrQuery.add(CommonParams.QT, requestHandler);
		}
	}
394700
public void modifyInstanceGroups(ModifyInstanceGroupsRequest request) {
        checkNotNull(request, "request should not be null.");
        checkStringNotEmpty(request.getClusterId(), "The clusterId should not be null or empty string.");
        checkNotNull(request.getInstanceGroups(), "The instanceGroups should not be null.");
        StringWriter writer = new StringWriter();
        try {
            JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer);
            jsonGenerator.writeStartObject();
            jsonGenerator.writeArrayFieldStart("instanceGroups");
            for (ModifyInstanceGroupConfig instanceGroup : request.getInstanceGroups()) {
                checkStringNotEmpty(instanceGroup.getId(),
                        "The instanceGroupId should not be null or empty string.");
                jsonGenerator.writeStartObject();
                jsonGenerator.writeStringField("id", instanceGroup.getId());
                jsonGenerator.writeNumberField("instanceCount", instanceGroup.getInstanceCount());
                jsonGenerator.writeEndObject();
            }
            jsonGenerator.writeEndArray();
            jsonGenerator.writeEndObject();
            jsonGenerator.close();
        } catch (IOException e) {
            throw new BceClientException("Fail to generate json", e);
        }

        byte[] json = null;
        try {
            json = writer.toString().getBytes(DEFAULT_ENCODING);
        } catch (UnsupportedEncodingException e) {
            throw new BceClientException("Fail to get UTF-8 bytes", e);
        }
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, CLUSTER,
                request.getClusterId(), INSTANCE_GROUP);
        internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length));
        internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json");
        internalRequest.setContent(RestartableInputStream.wrap(json));

        if (request.getClientToken() != null) {
            internalRequest.addParameter("clientToken", request.getClientToken());
        }
        this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
1374918
@Override
    public Request<ModifyInstancePlacementRequest> getDryRunRequest() {
        Request<ModifyInstancePlacementRequest> request = new ModifyInstancePlacementRequestMarshaller().marshall(this);
        request.addParameter("DryRun", Boolean.toString(true));
        return request;
    }
1294971
public static void updateDirectEditFlagInSession(ServletRequest request) {

        String disabledParam = request.getParameter(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(disabledParam)) {
            if (Boolean.parseBoolean(disabledParam)) {
                ((HttpServletRequest)request).getSession().setAttribute(
                    CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT,
                    Boolean.TRUE);
                String buttonLeft = request.getParameter(CmsGwtConstants.PARAM_BUTTON_LEFT);
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(buttonLeft)) {
                    Integer left = null;
                    try {
                        left = Integer.valueOf(buttonLeft);
                        if (left.intValue() > 0) {
                            ((HttpServletRequest)request).getSession().setAttribute(
                                CmsGwtConstants.PARAM_BUTTON_LEFT,
                                left);
                        }
                    } catch (NumberFormatException e) {
                        // malformed parameter, ignore
                    }
                }
            } else {
                ((HttpServletRequest)request).getSession().removeAttribute(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
            }
        }
    }
417368
private void handleSortRequest(final Request request) {
		String sortColStr = request.getParameter(getId() + ".sort");
		String sortDescStr = request.getParameter(getId() + ".sortDesc");

		if (sortColStr != null) {
			if ("".equals(sortColStr)) {
				// Reset sort
				setSort(-1, false);
				getOrCreateComponentModel().rowIndexMapping = null;
			} else {
				try {
					int sortCol = Integer.parseInt(sortColStr);
					// Allow for column order
					int[] cols = getColumnOrder();
					if (cols != null) {
						sortCol = cols[sortCol];
					}
					boolean sortAsc = !"true".equalsIgnoreCase(sortDescStr);

					// Only process the sort request if it differs from the current sort order
					if (sortCol != getSortColumnIndex() || sortAsc != isSortAscending()) {
						sort(sortCol, sortAsc);
						setFocussed();
					}
				} catch (NumberFormatException e) {
					LOG.warn("Invalid sort column: " + sortColStr);
				}
			}
		}
	}
3628
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
      ShardRequest sreq) {
    if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
        && sreq.params.getBool(PARAM_MTAS_LIST, false)) {
      // compute keys
      Set<String> keys = MtasSolrResultUtil
          .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_LIST);
      if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
        for (String key : keys) {
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_PREFIX);
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_START);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_NUMBER);
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_LEFT);
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_RIGHT);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_OUTPUT);
          // don't get data
          sreq.params.add(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_NUMBER, "0");
        }
      } else {
        sreq.params.remove(PARAM_MTAS_LIST);
        for (String key : keys) {
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_FIELD);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_VALUE);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_TYPE);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_PREFIX);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_QUERY_IGNORE);
          sreq.params.remove(PARAM_MTAS_LIST + "." + key + "."
              + NAME_MTAS_LIST_QUERY_MAXIMUM_IGNORE_LENGTH);
          Set<String> subKeys = MtasSolrResultUtil
              .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_LIST + "."
                  + key + "." + NAME_MTAS_LIST_QUERY_VARIABLE);
          for (String subKey : subKeys) {
            sreq.params.remove(PARAM_MTAS_LIST + "." + key + "."
                + NAME_MTAS_LIST_QUERY_VARIABLE + "." + subKey + "."
                + SUBNAME_MTAS_LIST_QUERY_VARIABLE_NAME);
            sreq.params.remove(PARAM_MTAS_LIST + "." + key + "."
                + NAME_MTAS_LIST_QUERY_VARIABLE + "." + subKey + "."
                + SUBNAME_MTAS_LIST_QUERY_VARIABLE_VALUE);
          }
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_KEY);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_PREFIX);
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_START);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_NUMBER);
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_LEFT);
          sreq.params
              .remove(PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_RIGHT);
          sreq.params.remove(
              PARAM_MTAS_LIST + "." + key + "." + NAME_MTAS_LIST_OUTPUT);
        }
      }
    }
  }
183879
private void addQueryParams(final Request request) {
        if (status != null) {
            request.addQueryParam("Status", status.toString());
        }

        if (identity != null) {
            request.addQueryParam("Identity", identity);
        }

        if (dateCreatedAfter != null) {
            request.addQueryParam("DateCreatedAfter", dateCreatedAfter.toString());
        }

        if (dateCreatedBefore != null) {
            request.addQueryParam("DateCreatedBefore", dateCreatedBefore.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
526495
private void handleExpansionRequest(final Request request) {
		String[] paramValue = request.getParameterValues(getId() + ".expanded");

		if (paramValue == null) {
			paramValue = new String[0];
		}

		String[] expandedRows = removeEmptyStrings(paramValue);

		List<Integer> oldExpansions = getExpandedRows();
		List<Integer> expansions;

		TableDataModel model = getDataModel();

		if (model.getRowCount() == 0) {
			setExpandedRows(new ArrayList<Integer>());
			return;
		} else if (getPaginationMode() == PaginationMode.NONE
				|| getPaginationMode() == PaginationMode.CLIENT
				|| oldExpansions == null) {
			expansions = new ArrayList<>(expandedRows.length);
		} else {
			// row expansions only apply to the current page
			expansions = new ArrayList<>(oldExpansions);

			int startRow = getCurrentPageStartRow();
			int endRow = getCurrentPageEndRow();
			expansions.removeAll(getRowIds(startRow, endRow));
		}

		for (String expandedRow : expandedRows) {
			try {
				expansions.add(Integer.parseInt(expandedRow));
			} catch (NumberFormatException e) {
				LOG.warn("Invalid row id for expansion: " + expandedRow);
			}
		}

		// For tree tables, we also have to tell the nodes to expand themselves
		if (model instanceof TreeTableDataModel) {
			TreeTableDataModel treeModel = (TreeTableDataModel) model;

			// We need the expanded indices sorted, as expanding/collapsing sections alters row indices
			Collections.sort(expansions);

			for (int row = 0; row < treeModel.getRowCount(); row++) {
				for (Iterator<TreeNode> i = treeModel.getNodeAtLine(row).depthFirst(); i.hasNext();) {
					TableTreeNode node = (TableTreeNode) i.next();
					node.setExpanded(false);
				}
			}

			for (int i = expansions.size() - 1; i >= 0; i--) {
				treeModel.getNodeAtLine(expansions.get(i)).setExpanded(true);
			}
		}

		setExpandedRows(expansions);
	}
394618
private void addQueryParams(final Request request) {
        if (log != null) {
            request.addQueryParam("Log", log.toString());
        }

        if (absoluteMessageDate != null) {
            request.addQueryParam("MessageDate", absoluteMessageDate.toString(Request.QUERY_STRING_DATE_FORMAT));
        } else if (rangeMessageDate != null) {
            request.addQueryDateRange("MessageDate", rangeMessageDate);
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
465172
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
      ShardRequest sreq) {
    // System.out.println(
    // "collection: " + System.nanoTime() + " - " +
    // Thread.currentThread().getId()
    // + " - " + rb.req.getParams().getBool("isShard", false)
    // + " MODIFYREQUEST " + rb.stage + " " + rb.req.getParamString());
    if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
        && sreq.params.getBool(PARAM_MTAS_COLLECTION, false)) {
      if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
        // do nothing
      } else {
        // remove for other requests
        Set<String> keys = MtasSolrResultUtil
            .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_COLLECTION);
        sreq.params.remove(PARAM_MTAS_COLLECTION);
        for (String key : keys) {
          sreq.params.remove(PARAM_MTAS_COLLECTION + "." + key + "."
              + NAME_MTAS_COLLECTION_ACTION);
          sreq.params.remove(PARAM_MTAS_COLLECTION + "." + key + "."
              + NAME_MTAS_COLLECTION_ID);
          sreq.params.remove(PARAM_MTAS_COLLECTION + "." + key + "."
              + NAME_MTAS_COLLECTION_FIELD);
          sreq.params.remove(PARAM_MTAS_COLLECTION + "." + key + "."
              + NAME_MTAS_COLLECTION_POST);
          sreq.params.remove(PARAM_MTAS_COLLECTION + "." + key + "."
              + NAME_MTAS_COLLECTION_KEY);
          sreq.params.remove(PARAM_MTAS_COLLECTION + "." + key + "."
              + NAME_MTAS_COLLECTION_URL);
          sreq.params.remove(PARAM_MTAS_COLLECTION + "." + key + "."
              + NAME_MTAS_COLLECTION_COLLECTION);
        }
      }
    }
  }
196799
@Override
  public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws IOException {
    String action;
    if ((action = req.getParams().get(PARAM_ACTION)) != null) {
      // generate list of files
      if (action.equals(ACTION_CONFIG_FILES)) {
        String configDir = req.getCore().getResourceLoader().getConfigDir();
        rsp.add(ACTION_CONFIG_FILES, getFiles(configDir, null));
        // get file
      } else if (action.equals(ACTION_CONFIG_FILE)) {
        String file = req.getParams().get(PARAM_CONFIG_FILE, null);
        if (file != null && !file.contains("..") && !file.startsWith("/")) {
          InputStream is;
          try {
            is = req.getCore().getResourceLoader().openResource(file);
            rsp.add(ACTION_CONFIG_FILE, IOUtils.toString(is, StandardCharsets.UTF_8));
          } catch (IOException e) {
            log.debug(e);
            rsp.add(MESSAGE_ERROR, e.getMessage());
          }
        }
        // test mapping
      } else if (action.equals(ACTION_MAPPING)) {
        String configuration = null;
        String document = null;
        String documentUrl = null;
        if (req.getContentStreams() != null) {
          Iterator<ContentStream> it = req.getContentStreams().iterator();
          if (it.hasNext()) {
            ContentStream cs = it.next();
            Map<String, String> params = new HashMap<>();
            getParamsFromJSON(params, IOUtils.toString(cs.getReader()));
            configuration = params.get(PARAM_MAPPING_CONFIGURATION);
            document = params.get(PARAM_MAPPING_DOCUMENT);
            documentUrl = params.get(PARAM_MAPPING_DOCUMENT_URL);
          }
        } else {
          configuration = req.getParams().get(PARAM_MAPPING_CONFIGURATION);
          document = req.getParams().get(PARAM_MAPPING_DOCUMENT);
          documentUrl = req.getParams().get(PARAM_MAPPING_DOCUMENT_URL);
        }
        if (configuration != null && documentUrl != null) {
          InputStream stream = IOUtils.toInputStream(configuration, StandardCharsets.UTF_8);
          try (MtasTokenizer tokenizer = new MtasTokenizer(stream);) {
            MtasFetchData fetchData = new MtasFetchData(new StringReader(documentUrl));
            rsp.add(ACTION_MAPPING, tokenizer.getList(fetchData.getUrl(null, null)));
            tokenizer.close();
          } catch (IOException | MtasParserException e) {
            log.debug(e);
            rsp.add(MESSAGE_ERROR, e.getMessage());
          } finally {
            stream.close();
          }
        } else if (configuration != null && document != null) {
          InputStream stream = IOUtils.toInputStream(configuration, StandardCharsets.UTF_8);
          try (MtasTokenizer tokenizer = new MtasTokenizer(stream);) {
            rsp.add(ACTION_MAPPING, tokenizer.getList(new StringReader(document)));
            tokenizer.close();
          } catch (IOException e) {
            log.debug(e);
            rsp.add(MESSAGE_ERROR, e.getMessage());
          } finally {
            stream.close();
          }
        }
      } else if (action.equals(ACTION_RUNNING) || action.equals(ACTION_HISTORY) || action.equals(ACTION_ERROR)) {
        boolean shardRequests = req.getParams().getBool(PARAM_SHARDREQUESTS, false);
        int number;
        try {
          number = Integer.parseInt(req.getParams().get(PARAM_NUMBER));
        } catch (NumberFormatException e) {
          number = defaultNumber;
        }
        if (action.equals(ACTION_RUNNING)) {
          rsp.add(ACTION_RUNNING, running.createListOutput(shardRequests, number));
        } else if (action.equals(ACTION_HISTORY)) {
          rsp.add(ACTION_HISTORY, history.createListOutput(shardRequests, number));
        } else if (action.equals(ACTION_ERROR)) {
          rsp.add(ACTION_ERROR, error.createListOutput(shardRequests, number));
        }
      } else if (action.equals(ACTION_STATUS)) {
        String key = req.getParams().get(PARAM_KEY, null);
        String abort = req.getParams().get(PARAM_ABORT, null);
        MtasSolrStatus solrStatus = null;
        if ((solrStatus = history.get(key)) != null || (solrStatus = running.get(key)) != null
            || (solrStatus = error.get(key)) != null) {
          if (abort != null && !solrStatus.finished()) {
            solrStatus.setError(abort);
          }
          rsp.add(ACTION_STATUS, solrStatus.createItemOutput());
        } else {
          rsp.add(ACTION_STATUS, null);
        }
      }
    }
  }
1280708
@Override
  public ListenableFuture<Table> modifyColumnFamilyAsync(ModifyColumnFamiliesRequest request) {
    return createUnaryListener(request, modifyColumnFamilyRpc, request.getName()).getAsyncResult();
  }
2339
function updateReqBucketRegion(request, region) {
    var httpRequest = request.httpRequest;
    if (typeof region === 'string' && region.length) {
      httpRequest.region = region;
    }
    if (!httpRequest.endpoint.host.match(/s3(?!-accelerate).*\.amazonaws\.com$/)) {
      return;
    }
    var service = request.service;
    var s3Config = service.config;
    var s3BucketEndpoint = s3Config.s3BucketEndpoint;
    if (s3BucketEndpoint) {
      delete s3Config.s3BucketEndpoint;
    }
    var newConfig = AWS.util.copy(s3Config);
    delete newConfig.endpoint;
    newConfig.region = httpRequest.region;

    httpRequest.endpoint = (new AWS.S3(newConfig)).endpoint;
    service.populateURI(request);
    s3Config.s3BucketEndpoint = s3BucketEndpoint;
    httpRequest.headers.Host = httpRequest.endpoint.host;

    if (request._asm.currentState === 'validate') {
      request.removeListener('build', service.populateURI);
      request.addListener('build', service.removeVirtualHostedBucketFromPath);
    }
  }
1163353
public void modifyRequest(ResponseBuilder rb, SearchComponent who,
      ShardRequest sreq) {
    if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
        && sreq.params.getBool(PARAM_MTAS_FACET, false)) {
      if ((sreq.purpose & ShardRequest.PURPOSE_GET_TOP_IDS) != 0) {
        // do nothing
      } else {
        // remove prefix for other requests
        Set<String> keys = MtasSolrResultUtil
            .getIdsFromParameters(rb.req.getParams(), PARAM_MTAS_FACET);
        sreq.params.remove(PARAM_MTAS_FACET);
        for (String key : keys) {
          sreq.params.remove(
              PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_FIELD);
          sreq.params
              .remove(PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_KEY);
          Set<String> subKeys = MtasSolrResultUtil.getIdsFromParameters(
              rb.req.getParams(),
              PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY);
          for (String subKey : subKeys) {
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_QUERY_TYPE);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_QUERY_VALUE);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_QUERY_PREFIX);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_QUERY_IGNORE);
            sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."
                + NAME_MTAS_FACET_QUERY + "." + subKey + "."
                + SUBNAME_MTAS_FACET_QUERY_MAXIMUM_IGNORE_LENGTH);
            Set<String> subSubKeys = MtasSolrResultUtil
                .getIdsFromParameters(rb.req.getParams(),
                    PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_QUERY
                        + "." + subKey + "."
                        + SUBNAME_MTAS_FACET_QUERY_VARIABLE);
            for (String subSubKey : subSubKeys) {
              sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."
                  + NAME_MTAS_FACET_QUERY + "." + subKey + "."
                  + SUBNAME_MTAS_FACET_QUERY_VARIABLE + "." + subSubKey + "."
                  + SUBNAME_MTAS_FACET_QUERY_VARIABLE_NAME);
              sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."
                  + NAME_MTAS_FACET_QUERY + "." + subKey + "."
                  + SUBNAME_MTAS_FACET_QUERY_VARIABLE + "." + subSubKey + "."
                  + SUBNAME_MTAS_FACET_QUERY_VARIABLE_VALUE);
            }
          }
          subKeys = MtasSolrResultUtil.getIdsFromParameters(rb.req.getParams(),
              PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE);
          for (String subKey : subKeys) {
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_FIELD);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_TYPE);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_RANGE + "."
                    + SUBNAME_MTAS_FACET_BASE_RANGE_SIZE);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_RANGE + "."
                    + SUBNAME_MTAS_FACET_BASE_RANGE_BASE);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_MAXIMUM);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_MINIMUM);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_NUMBER);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_SORT_DIRECTION);
            sreq.params.remove(
                PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE + "."
                    + subKey + "." + SUBNAME_MTAS_FACET_BASE_SORT_TYPE);
            Set<String> subSubKeys = MtasSolrResultUtil
                .getIdsFromParameters(rb.req.getParams(),
                    PARAM_MTAS_FACET + "." + key + "." + NAME_MTAS_FACET_BASE
                        + "." + subKey + "."
                        + SUBNAME_MTAS_FACET_BASE_FUNCTION);
            for (String subSubKey : subSubKeys) {
              sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."
                  + NAME_MTAS_FACET_BASE + "." + subKey + "."
                  + SUBNAME_MTAS_FACET_BASE_FUNCTION + "." + subSubKey + "."
                  + SUBNAME_MTAS_FACET_BASE_FUNCTION_EXPRESSION);
              sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."
                  + NAME_MTAS_FACET_BASE + "." + subKey + "."
                  + SUBNAME_MTAS_FACET_BASE_FUNCTION + "." + subSubKey + "."
                  + SUBNAME_MTAS_FACET_BASE_FUNCTION_KEY);
              sreq.params.remove(PARAM_MTAS_FACET + "." + key + "."
                  + NAME_MTAS_FACET_BASE + "." + subKey + "."
                  + SUBNAME_MTAS_FACET_BASE_FUNCTION + "." + subSubKey + "."
                  + SUBNAME_MTAS_FACET_BASE_FUNCTION_TYPE);
            }
          }
        }
      }
    }
  }
1012146
public void modifySubnetAttributes(ModifySubnetAttributesRequest modifySubnetAttributesRequest) {
        checkNotNull(modifySubnetAttributesRequest, "request should not be null.");
        checkStringNotEmpty(modifySubnetAttributesRequest.getSubnetId(), "request subnetId should not be empty.");
        checkStringNotEmpty(modifySubnetAttributesRequest.getName(), "request name should not be empty.");
        if (Strings.isNullOrEmpty(modifySubnetAttributesRequest.getClientToken())) {
            modifySubnetAttributesRequest.setClientToken(this.generateClientToken());
        }
        InternalRequest internalRequest = this.createRequest(
                modifySubnetAttributesRequest, HttpMethodName.PUT,
                SUBNET_PREFIX, modifySubnetAttributesRequest.getSubnetId());
        fillPayload(internalRequest, modifySubnetAttributesRequest);
        internalRequest.addParameter(NetworkAction.modifyAttribute.name(), null);
        internalRequest.addParameter("clientToken", modifySubnetAttributesRequest.getClientToken());
        this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
1241703
private void addQueryParams(final Request request) {
        if (recurring != null) {
            request.addQueryParam("Recurring", recurring.toString());
        }

        if (triggerBy != null) {
            request.addQueryParam("TriggerBy", triggerBy.toString());
        }

        if (usageCategory != null) {
            request.addQueryParam("UsageCategory", usageCategory.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }