public IFhirVersion getVersionImplementation() { if (!isPresentOnClasspath()) { throw new IllegalStateException("Version " + name() + " is not present on classpath"); } if (myVersionImplementation == null) { try { myVersionImplementation = (IFhirVersion) Class.forName(myVersionClass).newInstance(); } catch (Exception e) { throw new InternalErrorException("Failed to instantiate FHIR version " + name(), e); } } return myVersionImplementation; }
@Override protected void addFhirVersionOption(Options theOptions) { String versions = Arrays.stream(FhirVersionEnum.values()) .filter(t -> t != FhirVersionEnum.DSTU2_1 && t != FhirVersionEnum.DSTU2_HL7ORG && t != FhirVersionEnum.DSTU2) .map(t -> t.name().toLowerCase()) .sorted() .collect(Collectors.joining(", ")); addRequiredOption(theOptions, FHIR_VERSION_PARAM, FHIR_VERSION_PARAM_LONGOPT, FHIR_VERSION_PARAM_NAME, FHIR_VERSION_PARAM_DESC + versions); }
protected void addFhirVersionOption(Options theOptions) { String versions = Arrays.stream(FhirVersionEnum.values()) .filter(t -> t != FhirVersionEnum.DSTU2_1 && t != FhirVersionEnum.DSTU2_HL7ORG) .map(t -> t.name().toLowerCase()) .sorted() .collect(Collectors.joining(", ")); addRequiredOption(theOptions, FHIR_VERSION_PARAM, FHIR_VERSION_PARAM_LONGOPT, FHIR_VERSION_PARAM_NAME, FHIR_VERSION_PARAM_DESC + versions); }
public static String createUserAgentString(FhirContext theContext, String theClientType) { StringBuilder b = new StringBuilder(); b.append("HAPI-FHIR/"); b.append(VersionUtil.getVersion()); b.append(" (FHIR Client; FHIR "); b.append(theContext.getVersion().getVersion().getFhirVersionString()); b.append('/'); b.append(theContext.getVersion().getVersion().name()); b.append("; "); b.append(theClientType); b.append(")"); return b.toString(); }
private void scanBlock(Class<? extends IBase> theClass) { ourLog.debug("Scanning resource block class: {}", theClass.getName()); String resourceName = theClass.getCanonicalName(); if (isBlank(resourceName)) { throw new ConfigurationException("Block type @" + Block.class.getSimpleName() + " annotation contains no name: " + theClass.getCanonicalName()); } // Just in case someone messes up when upgrading from DSTU2 if (myContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) { if (BaseIdentifiableElement.class.isAssignableFrom(theClass)) { throw new ConfigurationException("@Block class for version " + myContext.getVersion().getVersion().name() + " should not extend " + BaseIdentifiableElement.class.getSimpleName() + ": " + theClass.getName()); } } RuntimeResourceBlockDefinition blockDef = new RuntimeResourceBlockDefinition(resourceName, theClass, isStandardType(theClass), myContext, myClassToElementDefinitions); blockDef.populateScanAlso(myScanAlso); myClassToElementDefinitions.put(theClass, blockDef); }
@Initialize public void initialize(RestfulServer theServer) { ourLog.trace("Initializing GraphQL provider"); if (theServer.getFhirContext().getVersion().getVersion() != FhirVersionEnum.R4) { throw new ConfigurationException("Can not use " + getClass().getName() + " provider on server with FHIR " + theServer.getFhirContext().getVersion().getVersion().name() + " context"); } }
protected List<String> createPoweredByAttributes() { return Lists.newArrayList("FHIR Server", "FHIR " + myFhirContext.getVersion().getVersion().getFhirVersionString() + "/" + myFhirContext.getVersion().getVersion().name()); }
context.setVariable("fhirVersion", myContext.getVersion().getVersion().name()); context.setVariable("resource", value);
ctx.put("nameToDatatypeClass", myNameToDatatypeClass); ctx.put("version", myVersion.replace(".", "")); ctx.put("versionEnumName", determineVersionEnum().name()); ctx.put("esc", new EscapeTool()); ctx.put("isRi", determineVersionEnum().isRi());
ctx.put("profile", theResource.getProfile()); ctx.put("version", myVersion.replace(".", "")); ctx.put("versionEnumName", determineVersionEnum().name()); ctx.put("id", StringUtils.defaultString(theResource.getId())); if (theResource.getDeclaringClassNameComplete() != null) {
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());
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());
Context context = new Context(); context.setVariable("resource", theResource); context.setVariable("fhirVersion", theContext.getVersion().getVersion().name());
b.append(theEntity.getId()); b.append(", version "); b.append(theEntity.getFhirVersion().name()); b.append("): "); b.append(e.getMessage());
ourLog.info("Initializing HAPI FHIR restful server running in " + getFhirContext().getVersion().getVersion().name() + " mode");
public IFhirVersion getVersionImplementation() { if (!isPresentOnClasspath()) { throw new IllegalStateException("Version " + name() + " is not present on classpath"); } if (myVersionImplementation == null) { try { myVersionImplementation = (IFhirVersion) Class.forName(myVersionClass).newInstance(); } catch (Exception e) { throw new InternalErrorException("Failed to instantiate FHIR version " + name(), e); } } return myVersionImplementation; }
public static String createUserAgentString(FhirContext theContext, String theClientType) { StringBuilder b = new StringBuilder(); b.append("HAPI-FHIR/"); b.append(VersionUtil.getVersion()); b.append(" (FHIR Client; FHIR "); b.append(theContext.getVersion().getVersion().getFhirVersionString()); b.append('/'); b.append(theContext.getVersion().getVersion().name()); b.append("; "); b.append(theClientType); b.append(")"); return b.toString(); }
@Initialize public void initialize(RestfulServer theServer) { ourLog.trace("Initializing GraphQL provider"); if (theServer.getFhirContext().getVersion().getVersion() != FhirVersionEnum.R4) { throw new ConfigurationException("Can not use " + getClass().getName() + " provider on server with FHIR " + theServer.getFhirContext().getVersion().getVersion().name() + " context"); } }
protected List<String> createPoweredByAttributes() { return Lists.newArrayList("FHIR Server", "FHIR " + myFhirContext.getVersion().getVersion().getFhirVersionString() + "/" + myFhirContext.getVersion().getVersion().name()); }