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


Java JSONResource.getHTTPStatus方法代码示例

本文整理汇总了Java中us.monoid.web.JSONResource.getHTTPStatus方法的典型用法代码示例。如果您正苦于以下问题:Java JSONResource.getHTTPStatus方法的具体用法?Java JSONResource.getHTTPStatus怎么用?Java JSONResource.getHTTPStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在us.monoid.web.JSONResource的用法示例。


在下文中一共展示了JSONResource.getHTTPStatus方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isTokenValid

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
private boolean isTokenValid(String token) {
	if (token == null) {
		return false;
	}
	boolean isValid = false;
	try {
		JSONObject jsonObject = new JSONObject();
		jsonObject.put(TOKEN, token);
		JSONResource response = resty.json(urlHelper.getTokenAuthenticationUrl(), RestyHelper.content(jsonObject,APPLICATION_JSON));
		if (response != null) {
			if (HttpStatus.SC_OK == (response.getHTTPStatus())) {
				isValid = true;
			} else {
				LOGGER.info("Inavlid token with failure reason from id server:" + response.get(MESSAGE));
			}
		}
	} catch (Exception e) {
		LOGGER.error("Failed to valid token:" + token, e);
	}
	return isValid;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:22,代码来源:IdServiceRestClientImpl.java

示例2: isServiceRunning

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
private boolean isServiceRunning() {
	JSONResource response;
	try {
		response = resty.json(urlHelper.getTestServiceUrl());
		if (response != null && HttpStatus.SC_OK == response.getHTTPStatus()) {
			return true;
		}
	} catch (IOException e) {
		LOGGER.error("Error when testing service", e);
	}
	return false;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:13,代码来源:IdServiceRestClientImpl.java

示例3: getOrCreateSctId

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public Long getOrCreateSctId(UUID componentUuid, Integer namespaceId, String partitionId, String comment) throws RestClientException {
	Long result = null;
	int attempt = 1;
	while (result == null) {
			try {
				JSONObject requestData = new JSONObject();
				requestData.put(NAMESPACE, namespaceId.intValue());
				requestData.put(PARTITION_ID, partitionId);
				requestData.put(SYSTEM_ID, componentUuid.toString());
				requestData.put(SOFTWARE, SRS);
				requestData.put(GENERATE_LEGACY_IDS, "false");
				requestData.put(COMMENT, comment);
				JSONResource response = resty.json(urlHelper.getSctIdGenerateUrl(token), RestyHelper.content((requestData),APPLICATION_JSON));
				if ( response != null && HttpStatus.SC_OK == (response.getHTTPStatus()) ){
					 result = new Long((String)response.get(SCTID));
				} else {
					throw new RestClientException(getFailureMessage(response));
				}
			} catch (Exception e) {
				
				if (attempt < maxTries) {
					LOGGER.warn("Id service failed on attempt {}. Waiting {} seconds before retrying.", attempt, retryDelaySeconds, e);
					attempt++;
					try {
						Thread.sleep(retryDelaySeconds * 1000);
					} catch (InterruptedException ie) {
						LOGGER.warn("Retry dealy interrupted.",e);
					}
				} else {
					throw new RestClientException("Failed to create sctId for uuid:" + componentUuid.toString(), e);
				}
			}
	}
	
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:38,代码来源:IdServiceRestClientImpl.java

示例4: getStatusForSchemeIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public Map<String, String> getStatusForSchemeIds(SchemeIdType schemeType, Collection<String> legacyIds) throws RestClientException {
	Map<String,String> result = new HashMap<>();
	if (legacyIds == null || legacyIds.isEmpty()) {
		return result;
	}
	int attempt = 1;
	boolean isDone = false;
	while (!isDone) {
			JSONResource response = null;
			try {
				response = resty.json(urlHelper.getSchemeIdBulkUrl(token, schemeType, legacyIds));
				if ( response != null && HttpStatus.SC_OK == (response.getHTTPStatus()) ){
					JSONArray items = response.array();
					for (int i =0;i < items.length();i++) {
						result.put((String)items.getJSONObject(i).get(SCHEME_ID), (String)items.getJSONObject(i).get(STATUS));
					}
				} else {
					String errorMsg = (response != null) ? ("http status code is:" + response.getHTTPStatus() + " message:" + response.get(MESSAGE)) : "No response received!";
					throw new RestClientException(errorMsg);
				}
				isDone = true;
			} catch (Exception e) {
				
				if (attempt < maxTries) {
					LOGGER.warn("Id service failed on attempt {}. Waiting {} seconds before retrying.", attempt, retryDelaySeconds, e);
					attempt++;
					try {
						Thread.sleep(retryDelaySeconds * 1000);
					} catch (InterruptedException ie) {
						LOGGER.warn("Retry delay interrupted.",e);
					}
				} else {
					throw new RestClientException("Failed to get scheme Ids for batch size:" + legacyIds.size(), e);
				}
			}
	}
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:40,代码来源:IdServiceRestClientImpl.java

示例5: getSctIdRecords

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
public Map<Long,JSONObject> getSctIdRecords(Collection<Long> sctIds) throws RestClientException {
	Map<Long,JSONObject> result = new HashMap<>();
	if (sctIds == null || sctIds.isEmpty()) {
		return result;
	}
	int attempt = 1;
	boolean isDone = false;
	while (!isDone) {
			JSONResource response = null;
			try {
				response = resty.json(urlHelper.getSctIdBulkUrl(token, sctIds));
				if ( response != null && HttpStatus.SC_OK == (response.getHTTPStatus()) ){
					JSONArray items = response.array();
					for (int i =0;i < items.length();i++) {
						result.put(new Long((String)items.getJSONObject(i).get(SCTID)), items.getJSONObject(i));
					}
				} else {
					String errorMsg = (response != null) ? "http status code is:" + response.getHTTPStatus() : "No response received.";
					throw new RestClientException(errorMsg);
				}
				isDone = true;
			} catch (Exception e) {
				if (attempt < maxTries) {
					LOGGER.warn("Id service failed on attempt {}. Waiting {} seconds before retrying.", attempt, retryDelaySeconds, e);
					attempt++;
					try {
						Thread.sleep(retryDelaySeconds * 1000);
					} catch (InterruptedException ie) {
						LOGGER.warn("Retry delay interrupted.",e);
					}
				} else {
					throw new RestClientException("Failed to get sctIds for batch size:" + sctIds.size(), e);
				}
			}
	}
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:38,代码来源:IdServiceRestClientImpl.java

示例6: getSchemeIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
public Map<String, JSONObject> getSchemeIds(SchemeIdType schemeType, Collection<String> legacyIds) throws RestClientException {
	Map<String,JSONObject> result = new HashMap<>();
	if (legacyIds == null || legacyIds.isEmpty()) {
		return result;
	}
	int attempt = 1;
	boolean isDone = false;
	while (!isDone) {
			JSONResource response = null;
			try {
				response = resty.json(urlHelper.getSchemeIdBulkUrl(token, schemeType, legacyIds));
				if ( response != null && HttpStatus.SC_OK == (response.getHTTPStatus()) ){
					JSONArray items = response.array();
					for (int i =0;i < items.length();i++) {
						result.put((String)items.getJSONObject(i).get(SCHEME_ID), items.getJSONObject(i));
					}
				} else {
					throw new RestClientException("http status code is:" + response.getHTTPStatus());
				}
				isDone = true;
			} catch (Exception e) {
				
				if (attempt < maxTries) {
					LOGGER.warn("Id service failed on attempt {}. Waiting {} seconds before retrying.", attempt, retryDelaySeconds, e);
					attempt++;
					try {
						Thread.sleep(retryDelaySeconds * 1000);
					} catch (InterruptedException ie) {
						LOGGER.warn("Retry delay interrupted.",e);
					}
				} else {
					throw new RestClientException("Failed to get sctIds for batch size:" + legacyIds.size(), e);
				}
			}
	}
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:38,代码来源:IdServiceRestClientImpl.java

示例7: reserveSctIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public List<Long> reserveSctIds(Integer namespaceId, int totalToReserve, String partitionId, String comment) throws RestClientException {
	long startTime = new Date().getTime();
	List<Long> result = new ArrayList<>();
	try {
		JSONObject requestData = new JSONObject();
		requestData.put(NAMESPACE, namespaceId.intValue());
		requestData.put(SOFTWARE, SRS);
		requestData.put(QUANTITY, totalToReserve);
		requestData.put(PARTITION_ID, partitionId);
		requestData.put(COMMENT, comment);
		JSONResource response = resty.json(urlHelper.getSctIdBulkReserveUrl(token), RestyHelper.content((requestData),APPLICATION_JSON));
		if ( HttpStatus.SC_OK == response.getHTTPStatus()) {
			String jobId =  response.get("id").toString();
			LOGGER.info("Bulk job id:" + jobId + " with batch size:" + totalToReserve);
			if (BULK_JOB_STATUS.COMPLETED_WITH_SUCCESS.getCode() == waitForCompleteStatus(jobId, getTimeOutInSeconds())) {
				JSONArray items = resty.json(urlHelper.getBulkJobResultUrl(jobId, token)).array();
				for (int i =0;i < items.length();i++) {
					
					result.add(new Long((String)items.getJSONObject(i).get(SCTID)));
				}
			}
		} else {
			String statusMsg = getFailureMessage(response);
			LOGGER.error(statusMsg);
			throw new RestClientException(statusMsg);
		}
	} catch (Exception e) {
		String message = "Bulk reserving sctIds job failed.";
		LOGGER.error(message, e);
		throw new RestClientException(message,e);
	}
	LOGGER.debug("End reserving sctIds with batch size {} for namespace {}", totalToReserve, namespaceId);
	LOGGER.info("Time taken in seconds:" + (new Date().getTime() - startTime) /1000);
	
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:38,代码来源:IdServiceRestClientImpl.java

示例8: generateSctIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public List<Long> generateSctIds(Integer namespaceId, int totalToGenerate, String partitionId, String comment) throws RestClientException {
	long startTime = new Date().getTime();
	List<Long> result = new ArrayList<>();
	try {
		JSONObject requestData = new JSONObject();
		requestData.put(NAMESPACE, namespaceId.intValue());
		requestData.put(SOFTWARE, SRS);
		requestData.put(QUANTITY, totalToGenerate);
		requestData.put(PARTITION_ID, partitionId);
		requestData.put(GENERATE_LEGACY_IDS, "false");
		requestData.put(COMMENT, comment);
		JSONResource response = resty.json(urlHelper.getSctIdBulkGenerateUrl(token), RestyHelper.content((requestData),APPLICATION_JSON));
		if ( HttpStatus.SC_OK == response.getHTTPStatus()) {
			String jobId =  response.get("id").toString();
			LOGGER.info("Bulk job id:" + jobId + " with batch size:" + totalToGenerate);
			if (BULK_JOB_STATUS.COMPLETED_WITH_SUCCESS.getCode() == waitForCompleteStatus(jobId, getTimeOutInSeconds())) {
				JSONArray items = resty.json(urlHelper.getBulkJobResultUrl(jobId, token)).array();
				for (int i =0;i < items.length();i++) {
					result.add(new Long((String)items.getJSONObject(i).get(SCTID)));
				}
			}
		} else {
			String statusMsg = getFailureMessage(response);
			LOGGER.error(statusMsg);
			throw new RestClientException(statusMsg);
		}
	} catch (Exception e) {
		String message = "Bulk generating sctIds job failed.";
		LOGGER.error(message, e);
		throw new RestClientException(message,e);
	}
	
	LOGGER.debug("End generating sctIds with batch size {} for namespace {}", totalToGenerate, namespaceId);
	LOGGER.info("Time taken in seconds:" + (new Date().getTime() - startTime) /1000);
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:38,代码来源:IdServiceRestClientImpl.java

示例9: getStatusForSctIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public Map<Long,String> getStatusForSctIds(Collection<Long> sctIds) throws RestClientException {
	Map<Long,String> result = new HashMap<>();
	if (sctIds == null || sctIds.isEmpty()) {
		return result;
	}
	StringBuilder scdStrList = new StringBuilder();
	boolean isFirst = true;
	for (Long id : sctIds) {
		if (!isFirst) {
			scdStrList.append(",");
		}
		if (isFirst) {
			isFirst = false;
		}
		scdStrList.append(id.toString());
	}
	int attempt = 1;
	boolean isDone = false;
	while (!isDone) {
			try {
				JSONObject requestData = new JSONObject();
				requestData.put(SCTIDS, scdStrList.toString());
				JSONResource response = resty.json(urlHelper.getSctIdBulkUrl(token),RestyHelper.content(requestData, APPLICATION_JSON));
				if ( response != null && HttpStatus.SC_OK == (response.getHTTPStatus()) ){
					JSONArray items = response.array();
					for (int i =0; i < items.length();i++) {
						result.put(new Long((String)items.getJSONObject(i).get(SCTID)), (String)items.getJSONObject(i).get(STATUS));
					}
				} else {
					throw new RestClientException(getFailureMessage(response));
				}
				isDone = true;
			} catch (Exception e) {
				
				if (attempt < maxTries) {
					LOGGER.warn("Id service failed on attempt {}. Waiting {} seconds before retrying.", attempt, retryDelaySeconds, e);
					attempt++;
					try {
						Thread.sleep(retryDelaySeconds * 1000);
					} catch (InterruptedException ie) {
						LOGGER.warn("Retry dealy interrupted.",e);
					}
				} else {
					throw new RestClientException("Failed to get sctIds for batch size:" + sctIds.size(), e);
				}
			}
	}
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:51,代码来源:IdServiceRestClientImpl.java

示例10: getOrCreateSctIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public HashMap<UUID,Long> getOrCreateSctIds(List<UUID> uuids,Integer namespaceId,String partitionId, String comment) throws RestClientException {
	LOGGER.debug("Start creating sctIds with batch size {} for namespace {} and partitionId {}", uuids.size(), namespaceId, partitionId);
	HashMap<UUID, Long> result = new HashMap<>();
	if (uuids == null || uuids.isEmpty()) {
		LOGGER.warn("Empty UUIDs submitted for requesting sctIds");
		return result;
	}
	long startTime = new Date().getTime();
	List<String> batchJob = null;
	int counter=0;
	for (UUID uuid : uuids) {
		if (batchJob == null) {
			batchJob = new ArrayList<>();
		}
		batchJob.add(uuid.toString());
		counter++;
		if (counter % batchSize == 0 || counter == uuids.size()) {
			try {
				JSONObject requestData = new JSONObject();
				requestData.put(NAMESPACE, namespaceId.intValue());
				requestData.put(PARTITION_ID, partitionId);
				requestData.put(QUANTITY,batchJob.size());
				requestData.put(SYSTEM_IDS, batchJob.toArray());
				requestData.put(SOFTWARE, SRS);
				requestData.put(GENERATE_LEGACY_IDS, "false");
				requestData.put(COMMENT, comment);
				JSONResource response = resty.json(urlHelper.getSctIdBulkGenerateUrl(token), RestyHelper.content((requestData),APPLICATION_JSON));
				if ( HttpStatus.SC_OK == response.getHTTPStatus()) {
					String jobId =  response.get("id").toString();
					LOGGER.info("Bulk job id:" + jobId + " with batch size:" + batchJob.size());
					if (BULK_JOB_STATUS.COMPLETED_WITH_SUCCESS.getCode() == waitForCompleteStatus(jobId, getTimeOutInSeconds())) {
						JSONArray items = resty.json(urlHelper.getBulkJobResultUrl(jobId, token)).array();
						for (int i =0;i < items.length();i++) {
							result.put(UUID.fromString((String)items.getJSONObject(i).get(SYSTEM_ID)), new Long((String)items.getJSONObject(i).get(SCTID)));
						}
					}
				} else {
					String statusMsg = getFailureMessage(response);
					LOGGER.error(statusMsg);
					throw new RestClientException(statusMsg);
				}
			} catch (Exception e) {
				String message = "Bulk getOrCreateSctIds job failed.";
				LOGGER.error(message, e);
				throw new RestClientException(message,e);
			}
			batchJob = null;
		}
	}
	LOGGER.debug("End creating sctIds with batch size {} for namespace {} and partitionId {}", uuids.size(), namespaceId, partitionId);
	LOGGER.info("Time taken in seconds:" + (new Date().getTime() - startTime) /1000);
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:55,代码来源:IdServiceRestClientImpl.java

示例11: getOrCreateSchemeIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public Map<UUID, String> getOrCreateSchemeIds(List<UUID> uuids, SchemeIdType schemeType, String comment) throws RestClientException {
	LOGGER.debug("Start creating scheme id {} with batch size {} ", schemeType, uuids.size());
	HashMap<UUID, String> result = new HashMap<>();
	if (uuids == null || uuids.isEmpty()) {
		LOGGER.warn("Empty UUIDs submitted for requesting schemeIdType:" + schemeType);
		return result;
	}
	long startTime = new Date().getTime();
	List<String> batchJob = null;
	int counter=0;
	for (UUID uuid : uuids) {
		if (batchJob == null) {
			batchJob = new ArrayList<>();
		}
		batchJob.add(uuid.toString());
		counter++;
		if (counter % batchSize == 0 || counter == uuids.size()) {
			//processing batch
			try {
				JSONObject requestData = new JSONObject();
				requestData.put(QUANTITY,batchJob.size());
				requestData.put(SYSTEM_IDS, batchJob.toArray());
				requestData.put(SOFTWARE, SRS);
				requestData.put(COMMENT, comment);
				JSONResource response = resty.json(urlHelper.getSchemeIdBulkGenerateUrl(token, schemeType), RestyHelper.content((requestData),APPLICATION_JSON));
				if ( HttpStatus.SC_OK == response.getHTTPStatus()) {
					String jobId =  response.get("id").toString();
					LOGGER.info("Scheme ids bulk job id:" + jobId + " with batch size:" + batchJob.size());
					if (BULK_JOB_STATUS.COMPLETED_WITH_SUCCESS.getCode() == waitForCompleteStatus(jobId, getTimeOutInSeconds())) {
						JSONArray items = resty.json(urlHelper.getBulkJobResultUrl(jobId, token)).array();
						for (int i =0;i < items.length();i++) {
							result.put(UUID.fromString((String)items.getJSONObject(i).get(SYSTEM_ID)), (String)items.getJSONObject(i).get(SCHEME_ID));
						}
					}
				} else {
					throw new RestClientException(getFailureMessage(response));
				}
			} catch (Exception e) {
				String message = "Bulk job getOrCreateSchemeIds failed for schemetype:" + schemeType;
				LOGGER.error(message, e);
				throw new RestClientException(message, e);
			}
			batchJob = null;
		}
	}
	LOGGER.debug("End creating scheme id {} with batch size {} ", schemeType, uuids.size());
	LOGGER.info("Time taken in seconds:" + (new Date().getTime() - startTime) /1000);
	return result;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:51,代码来源:IdServiceRestClientImpl.java

示例12: getFailureMessage

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
private String getFailureMessage(JSONResource response) throws Exception {
	return "Received Http status from id service:" + response.getHTTPStatus() + " message:" + response.get(MESSAGE);
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:4,代码来源:IdServiceRestClientImpl.java

示例13: publishSctIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public boolean publishSctIds(List<Long> sctIds, Integer namespaceId, String comment) throws RestClientException {
	LOGGER.debug("Start publishing sctIds with batch size {} for namespace {}", sctIds.size(), namespaceId);
	if (sctIds == null || sctIds.isEmpty()) {
		return true;
	}
	boolean isPublished = false;
	long startTime = new Date().getTime();
	List<String> batchJob = null;
	int counter=0;
	for (Long sctId : sctIds) {
		if (batchJob == null) {
			batchJob = new ArrayList<>();
		}
		batchJob.add(String.valueOf(sctId));
		counter++;
		if (counter % batchSize == 0 || counter == sctIds.size()) {
			//processing batch
			try {
				JSONObject requestData = new JSONObject();
				requestData.put(SCTIDS, batchJob.toArray());
				requestData.put(NAMESPACE, namespaceId.intValue());
				requestData.put(SOFTWARE, SRS);
				requestData.put(COMMENT, comment);
				JSONResource response = resty.put(urlHelper.getSctIdBulkPublishingUrl(token), requestData, APPLICATION_JSON);
				if ( HttpStatus.SC_OK == response.getHTTPStatus()) {
					String jobId =  response.get("id").toString();
					LOGGER.info("Bulk job id:" + jobId + " for publishing sctIds with batch size:" + batchJob.size());
					if (BULK_JOB_STATUS.COMPLETED_WITH_SUCCESS.getCode() == waitForCompleteStatus(jobId, getTimeOutInSeconds())) {
						isPublished = true;
					}
				} else {
					String statusMsg = "Received http status code from id service:" + response.getHTTPStatus();
					LOGGER.error(statusMsg);
					throw new RestClientException(statusMsg);
				}
			} catch (Exception e) {
				String message = "Bulk publishSctIds job failed.";
				LOGGER.error(message, e);
				throw new RestClientException(message, e);
			}
			batchJob = null;
		}
	}
	LOGGER.debug("End publishing sctIds with batch size {} for namespace {}", sctIds.size(), namespaceId);
	LOGGER.info("Time taken in seconds:" + (new Date().getTime() - startTime) /1000);
	return isPublished;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:49,代码来源:IdServiceRestClientImpl.java

示例14: publishSchemeIds

import us.monoid.web.JSONResource; //导入方法依赖的package包/类
@Override
public boolean publishSchemeIds(List<String> schemeIds, SchemeIdType schemeType, String comment) throws RestClientException {
	LOGGER.debug("Start publishing scheme ids with batch size {} for scheme type {}", schemeIds.size(), schemeType);
	if (schemeIds == null || schemeIds.isEmpty()) {
		return true;
	}
	boolean isPublished = false;
	long startTime = new Date().getTime();
	List<String> batchJob = null;
	int counter=0;
	for (String schemeId : schemeIds) {
		if (batchJob == null) {
			batchJob = new ArrayList<>();
		}
		batchJob.add(schemeId);
		counter++;
		if (counter % batchSize == 0 || counter == schemeIds.size()) {
			//processing batch
			try {
				JSONObject requestData = new JSONObject();
				requestData.put(SCHEME_IDS, batchJob.toArray());
				requestData.put(SOFTWARE, SRS);
				requestData.put(COMMENT, comment);
				JSONResource response = resty.put(urlHelper.getSchemeIdBulkPublishingUrl(schemeType,token), requestData, APPLICATION_JSON);
				if ( HttpStatus.SC_OK == response.getHTTPStatus()) {
					String jobId =  response.get("id").toString();
					LOGGER.info("Bulk job id:" + jobId + " for publishing scheme ids with batch size:" + batchJob.size());
					if (BULK_JOB_STATUS.COMPLETED_WITH_SUCCESS.getCode() == waitForCompleteStatus(jobId, getTimeOutInSeconds())){
						isPublished = true;
					}
				} else {
					String statusMsg = "Received http status code from id service:" + response.getHTTPStatus() + " message:" + response.get(MESSAGE);
					LOGGER.error(statusMsg);
					throw new RestClientException(statusMsg);
				}
			} catch (Exception e) {
				String message = "Bulk publish scheme ids job failed.";
				LOGGER.error(message, e);
				throw new RestClientException(message, e);
			}
			batchJob = null;
		}
	}
	LOGGER.debug("End publishing scheme ids with batch size {}", schemeIds.size());
	LOGGER.info("Time taken in seconds:" + (new Date().getTime() - startTime) /1000);
	return isPublished;
}
 
开发者ID:IHTSDO,项目名称:snomed-release-service,代码行数:48,代码来源:IdServiceRestClientImpl.java


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