@SuppressWarnings("unused") private static void operationNoIn() { // START SNIPPET: operationNoIn // Create a client to talk to the HeathIntersections server FhirContext ctx = FhirContext.forDstu2(); IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open"); client.registerInterceptor(new LoggingInterceptor(true)); // Invoke $everything on "Patient/1" Parameters outParams = client .operation() .onInstance(new IdDt("Patient", "1")) .named("$everything") .withNoParameters(Parameters.class) // No input parameters .execute(); // END SNIPPET: operationNoIn }
IBaseParameters response = client .operation() .onServer() .named(UPLOAD_EXTERNAL_CODE_SYSTEM) .withParameters(inputParameters)
@SuppressWarnings("unused") public void processMessage() { // START SNIPPET: processMessage FhirContext ctx = FhirContext.forDstu3(); // Create the client IGenericClient client = ctx.newRestfulGenericClient("http://localhost:9999/fhir"); Bundle bundle = new Bundle(); // ..populate the bundle.. Bundle response = client .operation() .processMessage() // New operation for sending messages .setMessageBundle(bundle) .asynchronous(Bundle.class) .execute(); // END SNIPPET: processMessage }
private IClientExecutable<IOperationUntypedWithInput<Parameters>, ?> getClientExecutable(IGenericClient client, Parameters requestData) { return client.operation() .onType(Patient.class) .named(Iti83Constants.PIXM_OPERATION_NAME) .withParameters(requestData) .useHttpGet(); } }
/** * This operation operates on a specific version of a resource * * @param id Resource version * @param name Operation name * @param parameters The parameters to use as input. May also be <code>null</code> if the operation * does not require any input parameters. * @param outputParameterType The type to use for the output parameters (this should be set to * <code>Parameters.class</code> drawn from the version of the FHIR structures you are using), may be NULL * @param useHttpGet use HTTP GET verb * @param returnType If this operation returns a single resource body as its return type instead of a <code>Parameters</code> * resource, use this method to specify that resource type. This is useful for certain * operations (e.g. <code>Patient/NNN/$everything</code>) which return a bundle instead of * a Parameters resource, may be NULL * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @param <T> extends {@link IBaseParameters} * @return the {@link IBaseResource} */ public <T extends IBaseParameters> IBaseResource onInstanceVersion( IIdType id, String name, T parameters, Class<T> outputParameterType, boolean useHttpGet, Class<IBaseResource> returnType, Map<ExtraParameters, Object> extraParameters) { IOperationUnnamed operationUnnamed = client.operation().onInstanceVersion(id); IOperationUntypedWithInput<? extends IBaseResource> operationUntypedWithInput = processNamedOperationParameters( name, parameters, outputParameterType, useHttpGet, returnType, extraParameters, operationUnnamed); return operationUntypedWithInput.execute(); }
private IClientExecutable<IOperationUntypedWithInput<Parameters>, ?> getClientExecutable(IGenericClient client, Parameters requestData) { return client.operation() .onType(Patient.class) .named(Iti83Constants.PIXM_OPERATION_NAME) .withParameters(requestData) .useHttpGet(); } }
/** * Perform the operation across all versions of a specific resource (by ID and type) on the server. * Note that <code>theId</code> must be populated with both a resource type and a resource ID at * a minimum. * * @param id Resource (version will be stripped) * @param name Operation name * @param parameters The parameters to use as input. May also be <code>null</code> if the operation * does not require any input parameters. * @param outputParameterType The type to use for the output parameters (this should be set to * <code>Parameters.class</code> drawn from the version of the FHIR structures you are using), may be NULL * @param useHttpGet use HTTP GET verb * @param returnType If this operation returns a single resource body as its return type instead of a <code>Parameters</code> * resource, use this method to specify that resource type. This is useful for certain * operations (e.g. <code>Patient/NNN/$everything</code>) which return a bundle instead of * a Parameters resource, may be NULL * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @param <T> extends {@link IBaseParameters} * * @throws IllegalArgumentException If <code>theId</code> does not contain at least a resource type and ID * * @return the {@link IBaseResource} */ public <T extends IBaseParameters> IBaseResource onInstance( IIdType id, String name, T parameters, Class<T> outputParameterType, boolean useHttpGet, Class<IBaseResource> returnType, Map<ExtraParameters, Object> extraParameters) { IOperationUnnamed operationUnnamed = client.operation().onInstanceVersion(id); IOperationUntypedWithInput<? extends IBaseResource> operationUntypedWithInput = processNamedOperationParameters( name, parameters, outputParameterType, useHttpGet, returnType, extraParameters, operationUnnamed); return operationUntypedWithInput.execute(); }
/** * Perform the operation across all versions of all resources of the given type on the server * * @param resourceType The resource type to operate on * @param name Operation name * @param parameters The parameters to use as input. May also be <code>null</code> if the operation * does not require any input parameters. * @param outputParameterType The type to use for the output parameters (this should be set to * <code>Parameters.class</code> drawn from the version of the FHIR structures you are using), may be NULL * @param useHttpGet use HTTP GET verb * @param returnType If this operation returns a single resource body as its return type instead of a <code>Parameters</code> * resource, use this method to specify that resource type. This is useful for certain * operations (e.g. <code>Patient/NNN/$everything</code>) which return a bundle instead of * a Parameters resource, may be NULL * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @param <T> extends {@link IBaseParameters} * @return the {@link IBaseResource} */ public <T extends IBaseParameters> IBaseResource onType(Class<IBaseResource> resourceType, String name, T parameters, Class<T> outputParameterType, boolean useHttpGet, Class<IBaseResource> returnType, Map<ExtraParameters, Object> extraParameters) { IOperationUnnamed operationUnnamed = client.operation().onType(resourceType); IOperationUntypedWithInput<? extends IBaseResource> operationUntypedWithInput = processNamedOperationParameters( name, parameters, outputParameterType, useHttpGet, returnType, extraParameters, operationUnnamed); return operationUntypedWithInput.execute(); }
.onInstance(new IdDt("Patient", "1")) .named("$everything") .withParameters(inParams)
/** * This operation is called <b><a href="https://www.hl7.org/fhir/messaging.html">$process-message</a></b> as defined by the FHIR * specification.<br><br> * @param respondToUri An optional query parameter indicating that responses from the receiving server should be sent to this URI, may be NULL * @param msgBundle Set the Message Bundle to POST to the messaging server * @param asynchronous Whether to process the message asynchronously or synchronously, defaults to synchronous. * @param responseClass the response class * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @param <T> extends {@link IBaseBundle} * @return the {@link IBaseBundle} */ public <T extends IBaseBundle> T processMessage(String respondToUri, IBaseBundle msgBundle, boolean asynchronous, Class<T> responseClass, Map<ExtraParameters, Object> extraParameters) { IOperationProcessMsg operationProcessMsg = client.operation().processMessage(); if (ObjectHelper.isNotEmpty(respondToUri)) { operationProcessMsg.setResponseUrlParam(respondToUri); } IOperationProcessMsgMode<T> operationProcessMsgMode = operationProcessMsg.setMessageBundle(msgBundle); if (asynchronous) { operationProcessMsgMode.asynchronous(responseClass); } else { operationProcessMsgMode.synchronous(responseClass); } ExtraParameters.process(extraParameters, operationProcessMsgMode); return operationProcessMsgMode.execute(); }
/** * Perform the operation across all versions of all resources of all types on the server * * @param name Operation name * @param parameters The parameters to use as input. May also be <code>null</code> if the operation * does not require any input parameters. * @param outputParameterType The type to use for the output parameters (this should be set to * <code>Parameters.class</code> drawn from the version of the FHIR structures you are using), may be NULL * @param useHttpGet use HTTP GET verb * @param returnType If this operation returns a single resource body as its return type instead of a <code>Parameters</code> * resource, use this method to specify that resource type. This is useful for certain * operations (e.g. <code>Patient/NNN/$everything</code>) which return a bundle instead of * a Parameters resource, may be NULL * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @param <T> extends {@link IBaseParameters} * @return the {@link IBaseResource} */ public <T extends IBaseParameters> IBaseResource onServer( String name, T parameters, Class<T> outputParameterType, boolean useHttpGet, Class<IBaseResource> returnType, Map<ExtraParameters, Object> extraParameters) { IOperationUnnamed operationUnnamed = client.operation().onServer(); IOperationUntypedWithInput<? extends IBaseResource> operationUntypedWithInput = processNamedOperationParameters( name, parameters, outputParameterType, useHttpGet, returnType, extraParameters, operationUnnamed); return operationUntypedWithInput.execute(); }
protected Parameters sendManuallyOnType(Parameters queryParameters) { Parameters result = client.operation() .onType(Patient.class) .named(Iti83Constants.PIXM_OPERATION_NAME) .withParameters(queryParameters) .useHttpGet() .execute(); return result; }
@SuppressWarnings("unused") private static void operationHttpGet() { // START SNIPPET: operationHttpGet // Create a client to talk to the HeathIntersections server FhirContext ctx = FhirContext.forDstu2(); IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open"); client.registerInterceptor(new LoggingInterceptor(true)); // Create the input parameters to pass to the server Parameters inParams = new Parameters(); inParams.addParameter().setName("start").setValue(new DateDt("2001-01-01")); inParams.addParameter().setName("end").setValue(new DateDt("2015-03-01")); // Invoke $everything on "Patient/1" Parameters outParams = client .operation() .onInstance(new IdDt("Patient", "1")) .named("$everything") .withParameters(inParams) .useHttpGet() // Use HTTP GET instead of POST .execute(); // END SNIPPET: operationHttpGet }
protected Parameters sendManuallyOnType(Parameters queryParameters) { Parameters result = client.operation() .onType(Patient.class) .named(Iti83Constants.PIXM_OPERATION_NAME) .withParameters(queryParameters) .useHttpGet() .execute(); return result; }
protected Parameters sendManuallyOnInstance(String resourceId, Parameters queryParameters) { Parameters result = client.operation() .onInstance(new IdType("Patient", resourceId)) .named(Iti83Constants.PIXM_OPERATION_NAME) .withParameters(queryParameters) .useHttpGet() .execute(); return result; }
protected Parameters sendManuallyOnInstance(String resourceId, Parameters queryParameters) { Parameters result = client.operation() .onInstance(new IdType("Patient", resourceId)) .named(Iti83Constants.PIXM_OPERATION_NAME) .withParameters(queryParameters) .useHttpGet() .execute(); return result; }