public String getResourcePackage() { if (BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()) { return "org.hl7.fhir." + version + ".model"; } return "ca.uhn.fhir.model." + version + ".resource"; }
public static Integer findIdParameterIndex(Method theMethod, FhirContext theContext) { Integer index = findParamAnnotationIndex(theMethod, IdParam.class); if (index != null) { Class<?> paramType = theMethod.getParameterTypes()[index]; if (IIdType.class.equals(paramType)) { return index; } boolean isRi = theContext.getVersion().getVersion().isRi(); boolean usesHapiId = IdDt.class.equals(paramType); if (isRi == usesHapiId) { throw new ConfigurationException("Method uses the wrong Id datatype (IdDt / IdType) for the given context FHIR version: " + theMethod.toString()); } } return index; }
if (determineVersionEnum().isRi()) { packageSuffix = "." + myVersion; ctx.put("versionEnumName", determineVersionEnum().name()); ctx.put("esc", new EscapeTool()); ctx.put("isRi", determineVersionEnum().isRi()); ctx.put("package_suffix", packageSuffix); String capitalize = WordUtils.capitalize(myVersion);
ctx.put("package_suffix", packageSuffix); ctx.put("esc", new EscapeTool()); if (BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()) { ctx.put("resourcePackage", "org.hl7.fhir." + version + ".model"); } else {
@SuppressWarnings("unchecked") @Override public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) { if (getContext().getVersion().getVersion().isRi()) { if (IDatatype.class.isAssignableFrom(theParameterType)) { throw new ConfigurationException("Incorrect use of type " + theParameterType.getSimpleName() + " as parameter type for method when context is for version " + getContext().getVersion().getVersion().name() + " in method: " + theMethod.toString());
@SuppressWarnings("unchecked") @Override public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) { if (getContext().getVersion().getVersion().isRi()) { if (IDatatype.class.isAssignableFrom(theParameterType)) { throw new ConfigurationException("Incorrect use of type " + theParameterType.getSimpleName() + " as parameter type for method when context is for version " + getContext().getVersion().getVersion().name() + " in method: " + theMethod.toString());
public static IPrimitiveType<?> createString(FhirContext theContext, String theValue) { IPrimitiveType<?> value; if (theContext.getVersion().getVersion().isRi()) { value = (IPrimitiveType<?>) theContext.getElementDefinition("string").newInstance(theValue); } else { value = new StringDt(theValue); } return value; }
ctx.put("targetFolder", targetFolder); ctx.put("version", version); ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()); ctx.put("hash", "#"); ctx.put("esc", new EscapeTool()); if (BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()) { ctx.put("resourcePackage", "org.hl7.fhir." + version + ".model"); } else {
for (Class<? extends IElement> nextType : childAnnotation.type()) { if (IBaseReference.class.isAssignableFrom(nextType)) { refTypesList.add(myContext.getVersion().getVersion().isRi() ? IAnyResource.class : IResource.class); continue; } else if (IBaseResource.class.isAssignableFrom(nextType) == false) {
ctx.put("targetFolder", targetFolder); ctx.put("version", version); ctx.put("isRi", BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()); ctx.put("hash", "#"); ctx.put("esc", new EscapeTool()); if (BaseStructureSpreadsheetParser.determineVersionEnum(version).isRi()) { ctx.put("resourcePackage", "org.hl7.fhir." + version + ".model"); } else {
protected List<? extends IBase> preProcessValues(BaseRuntimeChildDefinition theMetaChildUncast, IBaseResource theResource, List<? extends IBase> theValues, CompositeChildElement theCompositeChildElement) { if (myContext.getVersion().getVersion().isRi()) {
private DaoMethodOutcome toMethodOutcome(@Nonnull final ResourceTable theEntity, @Nonnull IBaseResource theResource) { DaoMethodOutcome outcome = new DaoMethodOutcome(); IIdType id = null; if (theResource.getIdElement().getValue() != null) { id = theResource.getIdElement(); } if (id == null) { id = theEntity.getIdDt(); if (getContext().getVersion().getVersion().isRi()) { id = getContext().getVersion().newIdType().setValue(id.getValue()); } } outcome.setId(id); outcome.setResource(theResource); outcome.setEntity(theEntity); return outcome; }
/** * @param theResourceType * May be null */ static <T extends IBaseResource> ParserState<T> getPreResourceInstance(IParser theParser, Class<T> theResourceType, FhirContext theContext, boolean theJsonMode, IParserErrorHandler theErrorHandler) throws DataFormatException { ParserState<T> retVal = new ParserState<T>(theParser, theContext, theJsonMode, theErrorHandler); if (theResourceType == null) { if (theContext.getVersion().getVersion().isRi()) { retVal.push(retVal.new PreResourceStateHl7Org(theResourceType)); } else { retVal.push(retVal.new PreResourceStateHapi(theResourceType)); } } else { if (IResource.class.isAssignableFrom(theResourceType)) { retVal.push(retVal.new PreResourceStateHapi(theResourceType)); } else { retVal.push(retVal.new PreResourceStateHl7Org(theResourceType)); } } return retVal; }
protected void updateResourceMetadata(IBaseResourceEntity theEntity, IBaseResource theResource) { IIdType id = theEntity.getIdDt(); if (getContext().getVersion().getVersion().isRi()) { id = getContext().getVersion().newIdType().setValue(id.getValue()); } if (id.hasResourceType() == false) { id = id.withResourceType(theEntity.getResourceType()); } theResource.setId(id); if (theResource instanceof IResource) { ResourceMetadataKeyEnum.VERSION.put((IResource) theResource, id.getVersionIdPart()); ResourceMetadataKeyEnum.UPDATED.put((IResource) theResource, theEntity.getUpdated()); } else { IBaseMetaType meta = theResource.getMeta(); meta.setVersionId(id.getVersionIdPart()); meta.setLastUpdated(theEntity.getUpdatedDate()); } }
public static Integer findIdParameterIndex(Method theMethod, FhirContext theContext) { Integer index = findParamAnnotationIndex(theMethod, IdParam.class); if (index != null) { Class<?> paramType = theMethod.getParameterTypes()[index]; if (IIdType.class.equals(paramType)) { return index; } boolean isRi = theContext.getVersion().getVersion().isRi(); boolean usesHapiId = IdDt.class.equals(paramType); if (isRi == usesHapiId) { throw new ConfigurationException("Method uses the wrong Id datatype (IdDt / IdType) for the given context FHIR version: " + theMethod.toString()); } } return index; }
public static IPrimitiveType<?> createString(FhirContext theContext, String theValue) { IPrimitiveType<?> value; if (theContext.getVersion().getVersion().isRi()) { value = (IPrimitiveType<?>) theContext.getElementDefinition("string").newInstance(theValue); } else { value = new StringDt(theValue); } return value; }
private DaoMethodOutcome toMethodOutcome(@Nonnull final ResourceTable theEntity, @Nonnull IBaseResource theResource) { DaoMethodOutcome outcome = new DaoMethodOutcome(); IIdType id = null; if (theResource.getIdElement().getValue() != null) { id = theResource.getIdElement(); } if (id == null) { id = theEntity.getIdDt(); if (getContext().getVersion().getVersion().isRi()) { id = getContext().getVersion().newIdType().setValue(id.getValue()); } } outcome.setId(id); outcome.setResource(theResource); outcome.setEntity(theEntity); return outcome; }
protected void updateResourceMetadata(IBaseResourceEntity theEntity, IBaseResource theResource) { IIdType id = theEntity.getIdDt(); if (getContext().getVersion().getVersion().isRi()) { id = getContext().getVersion().newIdType().setValue(id.getValue()); } if (id.hasResourceType() == false) { id = id.withResourceType(theEntity.getResourceType()); } theResource.setId(id); if (theResource instanceof IResource) { ResourceMetadataKeyEnum.VERSION.put((IResource) theResource, id.getVersionIdPart()); ResourceMetadataKeyEnum.UPDATED.put((IResource) theResource, theEntity.getUpdated()); } else { IBaseMetaType meta = theResource.getMeta(); meta.setVersionId(id.getVersionIdPart()); meta.setLastUpdated(theEntity.getUpdatedDate()); } }