private DateTimeType conformanceDate() { IPrimitiveType<Date> buildDate = getServerConfiguration().getConformanceDate(); if (buildDate != null && buildDate.getValue() != null) { try { return new DateTimeType(buildDate.getValueAsString()); } catch (DataFormatException e) { // fall through } } return DateTimeType.now(); }
RuntimeResourceDefinition targetDef = getServerConfiguration().getFhirContext().getResourceDefinition(nextTarget); if (targetDef != null) { ResourceType code;
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() { Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<>(); for (ResourceBinding next : getServerConfiguration().getResourceBindings()) { String resourceName = next.getResourceName(); for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) { if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } } for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) { String resourceName = ""; if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } return resourceToMethods; }
/** * Constructor allowing the description, servername and server to be set * * @param ctx * the {@link FhirContext} instance. * @param implementationDescription * the implementation description. If null, "" is used * @param serverName * the server name. If null, "" is used * @param serverVersion * the server version. If null, "" is used */ protected AbstractJaxRsConformanceProvider(FhirContext ctx, String implementationDescription, String serverName, String serverVersion) { super(ctx); serverConfiguration.setFhirContext(ctx); serverConfiguration.setImplementationDescription(StringUtils.defaultIfEmpty(implementationDescription, "")); serverConfiguration.setServerName(StringUtils.defaultIfEmpty(serverName, "")); serverConfiguration.setServerVersion(StringUtils.defaultIfEmpty(serverVersion, "")); }
public RestulfulServerConfiguration createConfiguration() { RestulfulServerConfiguration result = new RestulfulServerConfiguration(); result.setResourceBindings(getResourceBindings()); result.setServerBindings(getServerBindings()); result.setImplementationDescription(getImplementationDescription()); result.setServerVersion(getServerVersion()); result.setServerName(getServerName()); result.setFhirContext(getFhirContext()); result.setServerAddressStrategy(myServerAddressStrategy); try (InputStream inputStream = getClass().getResourceAsStream("/META-INF/MANIFEST.MF")) { if (inputStream != null) { Manifest manifest = new Manifest(inputStream); String value = manifest.getMainAttributes().getValue("Build-Time"); result.setConformanceDate(new InstantDt(value)); } } catch (Exception e) { // fall through } return result; }
String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest); retVal .getImplementation() .setUrl(serverBase) .setDescription(getServerConfiguration().getImplementationDescription()); retVal.getSoftware().setName(getServerConfiguration().getServerName()); retVal.getSoftware().setVersion(getServerConfiguration().getServerVersion()); retVal.addFormat(Constants.CT_FHIR_XML); retVal.addFormat(Constants.CT_FHIR_JSON); ConformanceRestResourceComponent resource = rest.addResource(); String resourceName = nextEntry.getKey(); RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName); resource.getTypeElement().setValue(def.getName()); resource.getProfile().setReference((def.getResourceProfile(serverBase)));
String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest); retVal .getImplementation() .setUrl(serverBase) .setDescription(getServerConfiguration().getImplementationDescription()); retVal.getSoftware().setName(getServerConfiguration().getServerName()); retVal.getSoftware().setVersion(getServerConfiguration().getServerVersion()); retVal.addFormat(Constants.CT_FHIR_XML_NEW); retVal.addFormat(Constants.CT_FHIR_JSON_NEW); CapabilityStatementRestResourceComponent resource = rest.addResource(); String resourceName = nextEntry.getKey(); RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName); resource.getTypeElement().setValue(def.getName()); resource.getProfileElement().setValue((def.getResourceProfile(serverBase)));
public RestulfulServerConfiguration createConfiguration() { RestulfulServerConfiguration result = new RestulfulServerConfiguration(); result.setResourceBindings(getResourceBindings()); result.setServerBindings(getServerBindings()); result.setImplementationDescription(getImplementationDescription()); result.setServerVersion(getServerVersion()); result.setServerName(getServerName()); result.setFhirContext(getFhirContext()); result.setServerAddressStrategy(myServerAddressStrategy); try (InputStream inputStream = getClass().getResourceAsStream("/META-INF/MANIFEST.MF")) { if (inputStream != null) { Manifest manifest = new Manifest(inputStream); String value = manifest.getMainAttributes().getValue("Build-Time"); result.setConformanceDate(new InstantDt(value)); } } catch (Exception e) { // fall through } return result; }
/** * Constructor allowing the description, servername and server to be set * * @param implementationDescription * the implementation description. If null, "" is used * @param serverName * the server name. If null, "" is used * @param serverVersion * the server version. If null, "" is used */ protected AbstractJaxRsConformanceProvider(String implementationDescription, String serverName, String serverVersion) { serverConfiguration.setFhirContext(getFhirContext()); serverConfiguration.setImplementationDescription(StringUtils.defaultIfEmpty(implementationDescription, "")); serverConfiguration.setServerName(StringUtils.defaultIfEmpty(serverName, "")); serverConfiguration.setServerVersion(StringUtils.defaultIfEmpty(serverVersion, "")); }
retVal.getImplementation().setDescription(getServerConfiguration().getImplementationDescription()); retVal.setKind(ConformanceStatementKind.INSTANCE); retVal.getSoftware().setName(getServerConfiguration().getServerName()); retVal.getSoftware().setVersion(getServerConfiguration().getServerVersion()); retVal.addFormat(Constants.CT_FHIR_XML); retVal.addFormat(Constants.CT_FHIR_JSON); ConformanceRestResourceComponent resource = rest.addResource(); String resourceName = nextEntry.getKey(); RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName); resource.getTypeElement().setValue(def.getName()); ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE)); String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest); resource.getProfile().setReference((def.getResourceProfile(serverBase)));
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() { Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>(); for (ResourceBinding next : getServerConfiguration().getResourceBindings()) { String resourceName = next.getResourceName(); for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) { if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } } for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) { String resourceName = ""; if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } return resourceToMethods; }
private DateTimeType conformanceDate() { IPrimitiveType<Date> buildDate = getServerConfiguration().getConformanceDate(); if (buildDate != null && buildDate.getValue() != null) { try { return new DateTimeType(buildDate.getValueAsString()); } catch (DataFormatException e) { // fall through } } return DateTimeType.now(); }
RuntimeResourceDefinition targetDef = getServerConfiguration().getFhirContext().getResourceDefinition(nextTarget); if (targetDef != null) { ResourceType code;
retVal.setAcceptUnknown(false); // TODO: make this configurable - this is a fairly big effort since the parser needs to be modified to actually allow it retVal.getImplementation().setDescription(myServerConfiguration.getImplementationDescription()); retVal.getSoftware().setName(myServerConfiguration.getServerName()); retVal.getSoftware().setVersion(myServerConfiguration.getServerVersion()); retVal.addFormat(Constants.CT_FHIR_XML); retVal.addFormat(Constants.CT_FHIR_JSON); List<ResourceBinding> bindings = new ArrayList<ResourceBinding>(myServerConfiguration.getResourceBindings()); Collections.sort(bindings, new Comparator<ResourceBinding>() { @Override RuntimeResourceDefinition def = myServerConfiguration.getFhirContext().getResourceDefinition(resourceName); resource.getType().setValue(def.getName()); ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE)); String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest); resource.getProfile().setReference(new IdDt(def.getResourceProfile(serverBase)));
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() { Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>(); for (ResourceBinding next : getServerConfiguration().getResourceBindings()) { String resourceName = next.getResourceName(); for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) { if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } } for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) { String resourceName = ""; if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } return resourceToMethods; }
private DateTimeType conformanceDate() { IPrimitiveType<Date> buildDate = getServerConfiguration().getConformanceDate(); if (buildDate != null && buildDate.getValue() != null) { try { return new DateTimeType(buildDate.getValueAsString()); } catch (DataFormatException e) { // fall through } } return DateTimeType.now(); }
RuntimeResourceDefinition targetDef = getServerConfiguration().getFhirContext().getResourceDefinition(nextTarget); if (targetDef != null) { ResourceType code;
String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest); retVal .getImplementation() .setUrl(serverBase) .setDescription(getServerConfiguration().getImplementationDescription()); retVal.getSoftware().setName(getServerConfiguration().getServerName()); retVal.getSoftware().setVersion(getServerConfiguration().getServerVersion()); retVal.addFormat(Constants.CT_FHIR_XML); retVal.addFormat(Constants.CT_FHIR_JSON); RestResource resource = rest.addResource(); String resourceName = nextEntry.getKey(); RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName); resource.getTypeElement().setValue(def.getName()); resource.getProfile().setReference(new IdDt(def.getResourceProfile(serverBase)));
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() { Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>(); for (ResourceBinding next : getServerConfiguration().getResourceBindings()) { String resourceName = next.getResourceName(); for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) { if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } } for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) { String resourceName = ""; if (resourceToMethods.containsKey(resourceName) == false) { resourceToMethods.put(resourceName, new ArrayList<>()); } resourceToMethods.get(resourceName).add(nextMethodBinding); } return resourceToMethods; }
private DateTimeDt conformanceDate() { String buildDate = myServerConfiguration.getConformanceDate(); if (buildDate != null) { try { return new DateTimeDt(buildDate); } catch (DataFormatException e) { // fall through } } return DateTimeDt.withCurrentTime(); }