当前位置: 首页>>代码示例>>Java>>正文


Java KeyValue类代码示例

本文整理汇总了Java中com.esri.ges.core.http.KeyValue的典型用法代码示例。如果您正苦于以下问题:Java KeyValue类的具体用法?Java KeyValue怎么用?Java KeyValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KeyValue类属于com.esri.ges.core.http包,在下文中一共展示了KeyValue类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performTheUpdate

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
private String performTheUpdate(List<String> featureList) throws IOException
{
	clientUrl = host + "/rest/services/" + featureService + "/FeatureServer/" + layerIndex + "/applyEdits";
	URL url = new URL(clientUrl);
	Collection<KeyValue> params = new ArrayList<KeyValue>();
	params.add(new KeyValue("f", "json"));
	params.add(new KeyValue("updates", makeFeatureListString(featureList)));
	
	if (LOGGER.isDebugEnabled())
		LOGGER.debug("URL_POST_DEBUG", url, paramsToString(params));
	String responseString = postAndGetReply(url, params);
	return responseString;
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:14,代码来源:MLOBIOutboundTransport.java

示例2: performTheInsertOperations

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
private void performTheInsertOperations(List<String> featureList) throws IOException
{
	while (featureList.size() > maxTransactionSize)
		performTheInsertOperations(featureList.subList(0, maxTransactionSize));

	clientUrl = host + "/rest/services/" + featureService + "/FeatureServer/" + layerIndex + "/applyEdits";
	URL url = new URL(clientUrl);
	Collection<KeyValue> params = new ArrayList<KeyValue>();
	String featureString = makeFeatureListString(featureList);
	params.add(new KeyValue("f", "json"));
	params.add(new KeyValue("adds", featureString));
	if (LOGGER.isDebugEnabled())
		LOGGER.debug("URL_POST_DEBUG", url, paramsToString(params));
	String responseString = postAndGetReply(url, params);
	//String responseString = executeGetAndGetReply(url, params);
	//String responseString = postAndGetReply(url, makeFeatureListString(featureList));
	try
	{
		validateResponse(responseString);
	}
	catch(Exception e)
	{
		featureList.clear();
	}
	LOGGER.debug("RESPONSE_HEADER_MSG", responseString);
	featureList.clear();
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:28,代码来源:MLOBIOutboundTransport.java

示例3: paramsToString

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
private String paramsToString(Collection<KeyValue> params)
{
	StringBuilder sb = new StringBuilder();
	for (KeyValue param : params)
	{
		if (sb.length() > 0)
			sb.append('&');
		sb.append(param.getKey());
		sb.append('=');
		sb.append(param.getValue() == null ? "" : param.getValue());
	}
	return sb.toString();
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:14,代码来源:MLOBIOutboundTransport.java

示例4: getDefaultParamsForRequest

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
public Collection<KeyValue> getDefaultParamsForRequest(ArcGISServerConnection agsConnection)
{
  Collection<KeyValue> params = new ArrayList<KeyValue>();
  params.add(new KeyValue("f", "json"));
  String token = agsConnection.getDecryptedToken();
  if (token != null)
    params.add(new KeyValue("token", token));

  return params;
}
 
开发者ID:Esri,项目名称:service-area-calculator-for-geoevent,代码行数:11,代码来源:ServiceAreaCalculator.java

示例5: createPostRequest

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
public HttpPost createPostRequest(URL url, Collection<KeyValue> parameters) throws IOException
{
  List<NameValuePair> formParams = new ArrayList<NameValuePair>();
  if (parameters != null)
  {
    for (KeyValue parameter : parameters)
    {
      formParams.add(new BasicNameValuePair(parameter.getKey(), parameter.getValue()));
      LOGGER.debug("HTTP_ADDING_PARAM", parameter.getKey(), parameter.getValue());
    }
  }
  UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8");

  HttpPost httpPost;
  try
  {
    httpPost = new HttpPost(url.toURI());
  }
  catch (URISyntaxException e)
  {
    throw new RuntimeException(e);
  }
  httpPost.setEntity(entity);
  httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
  httpPost.setHeader("charset", "utf-8");

  return httpPost;
}
 
开发者ID:Esri,项目名称:service-area-calculator-for-geoevent,代码行数:29,代码来源:ServiceAreaCalculator.java

示例6: getAreaAroundPoint

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
public MapGeometry getAreaAroundPoint(MapGeometry point)
{
	ArcGISServerConnection agsConnection = agsConnectionManager.getArcGISServerConnection(naConnectionName);

	Collection<KeyValue> params = new ArrayList<KeyValue>();
	params.addAll(getDefaultParamsForRequest(agsConnection));
   //params.addAll(agsConnection.getDefaultParamsForRequest());
	params.add(new KeyValue("facilities", generateFacilitiesJson(point)));
	params.add(new KeyValue("defaultBreaks", (new Integer(driveTime)).toString()));
	params.add(new KeyValue("travelDirection", "esriNATravelDirectionFromFacility"));

	if (!Validator.isEmpty(outputPolygonType))
		params.add(new KeyValue("outputPolygons", outputPolygonType));

	try (GeoEventHttpClient http = httpService.createNewClient())
	{
		StringBuffer urlString = new StringBuffer();
		urlString.append(agsConnection.getUrl().toExternalForm());
		urlString.append(serviceAreaSolverPath);

		URL url = new URL(urlString.toString());
		//HttpPost postRequest = http.createPostRequest(url, params);
     HttpPost postRequest = createPostRequest(url, params);
		postRequest.addHeader("Referer", agsConnection.getReferer());
		String responseString = http.executeAndReturnBody(postRequest, GeoEventHttpClient.DEFAULT_TIMEOUT);
		/*
		HttpGet getRequest = http.createGetRequest(url, params);
		getRequest.addHeader("Referer", agsConnection.getReferer());
     String responseString = http.executeAndReturnBody(getRequest, GeoEventHttpClient.DEFAULT_TIMEOUT);
		*/
		return parseAreaSolverReply(responseString);
	}
	catch (Exception e)
	{
		LOGGER.debug("SERVICE_AREA_UNABLE_ERROR1", e.getMessage());
		LOGGER.info(e.getMessage(), e);
	}

	return null;
}
 
开发者ID:Esri,项目名称:service-area-calculator-for-geoevent,代码行数:41,代码来源:ServiceAreaCalculator.java

示例7: cleanup

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
private void cleanup()
{
	
	URL url;

	Collection<KeyValue> params = new ArrayList<KeyValue>();
	try
	{
		Date now = new Date();
		Date cutoffDate = DateUtil.addMins(now, (-1 * featureLifeSpan));
		// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		// sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
		// String dateStr = sdf.format(cutoffDate);
		// String whereClause = cleanupTimeField + "<'" +dateStr + "'";
		// String whereClause = cleanupTimeField + " < " + ags.getDateTimeQueryOperand(dateStr);
		String whereClause = cleanupTimeField + " " + "<" + " timestamp '" + formatUTCDate(cutoffDate) + "'";
		clientUrl = host + "/rest/services/" + featureService + "/" + layerIndex +"/deleteFeatures";
		url = new URL(clientUrl);
		params.add(new KeyValue("f", "json"));
		params.add(new KeyValue("where", whereClause));

		String responseString = postAndGetReply(url, params);
		validateResponse(responseString);
		LOGGER.debug("RESPONSE_HEADER_MSG", responseString);
	}
	catch (Exception e)
	{
		LOGGER.error("ERROR_DELETING_FS", featureService, paramsToString(params), e.getMessage());
		LOGGER.info(e.getMessage(), e);
	}
}
 
开发者ID:Esri,项目名称:solutions-geoevent-java,代码行数:32,代码来源:MLOBIOutboundTransport.java

示例8: performMissingOIDQuery

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
private void performMissingOIDQuery(String whereString) throws IOException
{
	Collection<KeyValue> params = new ArrayList<KeyValue>();
	
	params.add(new KeyValue("f", "json"));
	params.add(new KeyValue("outfields", trackIDField + "," + "objectId"));
	params.add(new KeyValue("returnGeometry", "false"));
	params.add(new KeyValue("where", whereString));
	clientUrl = host + "/rest/services/" + featureService + "/FeatureServer/" + layerIndex + "/query";
	URL url = new URL(clientUrl);
	if (LOGGER.isDebugEnabled())
		LOGGER.debug("URL_POST_DEBUG", url, paramsToString(params));
	//String responseString = postAndGetReply(url, params);
	String responseString = executeGetAndGetReply(url, params);
	try
	{
		validateResponse(responseString);
	}
	catch (IOException ex)
	{
		LOGGER.error("URL_POST_ERROR", ex, url, paramsToString(params));
		throw ex;
	}
	LOGGER.debug("RESPONSE_HEADER_MSG", responseString);
	JsonNode response = mapper.readTree(responseString);
	if (!response.has("features"))
		return;
	for (JsonNode feature : response.get("features"))
	{
		JsonNode attributes = feature.get("attributes");
		String oid = String.valueOf(attributes.get("objectId"));
		// String trackID = attributes.get(trackIDField).getTextValue();
		JsonNode tidNode = attributes.get("trackid");
		String trackID = getTrackIdAsString(tidNode);

		if (trackID != null)
		{
			oidCache.put(trackID, oid);
		}
	}
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:42,代码来源:MLOBIOutboundTransport.java

示例9: getIncomingData

import com.esri.ges.core.http.KeyValue; //导入依赖的package包/类
private void getIncomingData()
{
	// String test = "";
	String whereClause = "";
	try
	{
			whereClause = queryDefinition;
			if (getNewFeaturesOnly)
			{
				
					Date cachedDate = new Date(lastTimestamp);
					String format ="yyyy-MM-dd'T'HH:mm:ss.SSS";
					TimeZone tz = TimeZone.getTimeZone("UTC");
					SimpleDateFormat dateFormat = new SimpleDateFormat(format);
					dateFormat.setTimeZone(tz);
					String dateStr = dateFormat.format(cachedDate);
					dateStr = dateStr.substring(0, dateStr.length()-3);
					dateStr += "999999";
					//String dateStr = DateUtil.format(cachedDate, format);
					if (queryDefinition.length() > 0)
					{
						// whereClause = queryDefinition + " and " + newFeaturesTimeFieldName + " > " + agscon.getDateTimeQueryOperand(dateStr);
						whereClause = queryDefinition + " and " + "object-activity-date GT " + dateStr;
					}
					else
					{
						whereClause = "object-activity-date GT " + dateStr;
					}
				
			}
			
			String clientUrl = host + "/rest/services/" + featureService + 	"/FeatureServer/" + layerIndex + "/query";	
			URL url = new URL(clientUrl);
			Collection<KeyValue> params = new ArrayList<KeyValue>();
			params.add(new KeyValue("f", "json"));
			if(!whereClause.isEmpty())
				params.add(new KeyValue("where", whereClause));
			String jsonString = executeGetAndGetReply(url, params);
			JsonNode jsonReply = mapper.readTree(jsonString);
			features = jsonReply.get("features");
			if(features.size() > 0 && getNewFeaturesOnly)
				updateLastTimestamp(jsonReply);
			for(int i = 0; i < features.size(); ++i )
			{
				JsonNode node = features.get(i);
				
				ByteBuffer buffer = charset.encode(node.toString());
				byteListener.receive(buffer, Integer.toString(i));
			}

			
			//features = mapper.readTree(jsonString);
			
		
	}
	catch (Exception e)
	{
		LOGGER.error("FS_FETCH_ERROR", featureService, e.getMessage());
		LOGGER.info(e.getMessage(), e);
	}
}
 
开发者ID:Esri,项目名称:defense-solutions-proofs-of-concept,代码行数:62,代码来源:MLOBIInboundTransport.java


注:本文中的com.esri.ges.core.http.KeyValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。