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


Java IBaseResource.getIdElement方法代码示例

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


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

示例1: of

import org.hl7.fhir.instance.model.api.IBaseResource; //导入方法依赖的package包/类
/**
 * Retrieves the ID from the given resource instance
 */
public static IdType of(IBaseResource theResouce) {
  if (theResouce == null) {
    throw new NullPointerException("theResource can not be null");
  } else {
    IIdType retVal = theResouce.getIdElement();
    if (retVal == null) {
      return null;
    } else if (retVal instanceof IdType) {
      return (IdType) retVal;
    } else {
      return new IdType(retVal.getValue());
    }
  }
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:18,代码来源:IdType.java

示例2: of

import org.hl7.fhir.instance.model.api.IBaseResource; //导入方法依赖的package包/类
/**
 * Retrieves the ID from the given resource instance
 */
public static IdDt of(IBaseResource theResouce) {
	if (theResouce == null) {
		throw new NullPointerException("theResource can not be null");
	}
	IIdType retVal = theResouce.getIdElement();
	if (retVal == null) {
		return null;
	} else if (retVal instanceof IdDt) {
		return (IdDt) retVal;
	} else {
		return new IdDt(retVal.getValue());
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:17,代码来源:IdDt.java

示例3: initializeBundleFromBundleProvider

import org.hl7.fhir.instance.model.api.IBaseResource; //导入方法依赖的package包/类
@Override
public void initializeBundleFromBundleProvider(IRestfulServer<?> theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl,
		boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set<Include> theIncludes) {
	int numToReturn;
	String searchId = null;
	List<IBaseResource> resourceList;
	Integer numTotalResults = theResult.size();
	if (theServer.getPagingProvider() == null) {
		numToReturn = numTotalResults;
		resourceList = theResult.getResources(0, numToReturn);
		RestfulServerUtils.validateResourceListNotNull(resourceList);

	} else {
		IPagingProvider pagingProvider = theServer.getPagingProvider();
		if (theLimit == null || theLimit.equals(Integer.valueOf(0))) {
			numToReturn = pagingProvider.getDefaultPageSize();
		} else {
			numToReturn = Math.min(pagingProvider.getMaximumPageSize(), theLimit);
		}

		if (numTotalResults != null) {
			numToReturn = Math.min(numToReturn, numTotalResults - theOffset);
		}
		
		resourceList = theResult.getResources(theOffset, numToReturn + theOffset);
		RestfulServerUtils.validateResourceListNotNull(resourceList);

		if (theSearchId != null) {
			searchId = theSearchId;
		} else {
			if (numTotalResults == null || numTotalResults > numToReturn) {
				searchId = pagingProvider.storeResultList(theResult);
				Validate.notNull(searchId, "Paging provider returned null searchId");
			}
		}
	}

	for (IBaseResource next : resourceList) {
		if (next.getIdElement() == null || next.getIdElement().isEmpty()) {
			if (!(next instanceof BaseOperationOutcome)) {
				throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)");
			}
		}
		if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) {
			addProfileIfNeeded(theServer, theServerBase, next);
		}
	}


	addResourcesToBundle(new ArrayList<IBaseResource>(resourceList), theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes);
	addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, numTotalResults, theBundleType, theResult.getPublished());

	if (theServer.getPagingProvider() != null) {
		int limit;
		limit = theLimit != null ? theLimit : theServer.getPagingProvider().getDefaultPageSize();
		limit = Math.min(limit, theServer.getPagingProvider().getMaximumPageSize());

		if (searchId != null) {
			if (numTotalResults == null || theOffset + numToReturn < numTotalResults) {
				myBundle.getLinkNext()
						.setValue(RestfulServerUtils.createPagingLink(theIncludes, theServerBase, searchId, theOffset + numToReturn, numToReturn, theResponseEncoding, thePrettyPrint, theBundleType));
			}
			if (theOffset > 0) {
				int start = Math.max(0, theOffset - limit);
				myBundle.getLinkPrevious().setValue(RestfulServerUtils.createPagingLink(theIncludes, theServerBase, searchId, start, limit, theResponseEncoding, thePrettyPrint, theBundleType));
			}
		}
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:70,代码来源:Dstu1BundleFactory.java

示例4: ActionRequestDetails

import org.hl7.fhir.instance.model.api.IBaseResource; //导入方法依赖的package包/类
public ActionRequestDetails(RequestDetails theRequestDetails, FhirContext theContext, IBaseResource theResource) {
	this(theRequestDetails, theContext, theContext.getResourceDefinition(theResource).getName(), theResource.getIdElement());
	myResource = theResource;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:5,代码来源:IServerInterceptor.java

示例5: invokeServer

import org.hl7.fhir.instance.model.api.IBaseResource; //导入方法依赖的package包/类
@Override
public IBundleProvider invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException {
	if (myIdParamIndex != null) {
		theMethodParams[myIdParamIndex] = theRequest.getId();
	}

	Object response = invokeServerMethod(theServer, theRequest, theMethodParams);

	final IBundleProvider resources = toResourceList(response);
	
	/*
	 * We wrap the response so we can verify that it has the ID and version set,
	 * as is the contract for history
	 */
	return new IBundleProvider() {
		
		@Override
		public IPrimitiveType<Date> getPublished() {
			return resources.getPublished();
		}
		
		@Override
		public List<IBaseResource> getResources(int theFromIndex, int theToIndex) {
			List<IBaseResource> retVal = resources.getResources(theFromIndex, theToIndex);
			int index = theFromIndex;
			for (IBaseResource nextResource : retVal) {
				if (nextResource.getIdElement() == null || isBlank(nextResource.getIdElement().getIdPart())) {
					throw new InternalErrorException("Server provided resource at index " + index + " with no ID set (using IResource#setId(IdDt))");
				}
				if (isBlank(nextResource.getIdElement().getVersionIdPart()) && nextResource instanceof IResource) {
					//TODO: Use of a deprecated method should be resolved.
					IdDt versionId = (IdDt) ResourceMetadataKeyEnum.VERSION_ID.get((IResource) nextResource);
					if (versionId == null || versionId.isEmpty()) {
						throw new InternalErrorException("Server provided resource at index " + index + " with no Version ID set (using IResource#setId(IdDt))");
					}
				}
				index++;
			}
			return retVal;
		}
		
		@Override
		public Integer size() {
			return resources.size();
		}

		@Override
		public Integer preferredPageSize() {
			return resources.preferredPageSize();
		}

		@Override
		public String getUuid() {
			return resources.getUuid();
		}
	};
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:58,代码来源:HistoryMethodBinding.java


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