
Package ca.uhn.fhir.rest.api
Class MethodOutcome
java.lang.Object
ca.uhn.fhir.rest.api.MethodOutcome
- All Implemented Interfaces:
- IHasHeaders
- 
Constructor SummaryConstructorsConstructorDescriptionConstructorMethodOutcome(IBaseOperationOutcome theOperationOutcome) ConstructorMethodOutcome(IIdType theId) ConstructorMethodOutcome(IIdType theId, Boolean theCreated) ConstructorMethodOutcome(IIdType theId, IBaseOperationOutcome theBaseOperationOutcome) ConstructorMethodOutcome(IIdType theId, IBaseOperationOutcome theBaseOperationOutcome, Boolean theCreated) Constructor
- 
Method SummaryModifier and TypeMethodDescriptionvoidFires callbacks registered toregisterResourceViewCallback(Runnable)and then clears the list of registered callbacks.This will be set toBoolean.TRUEfor instance of MethodOutcome which are returned to client instances, if the server has responded with an HTTP 201 Created.getFirstResponseHeader(String theHeader) getId()Returns theIBaseOperationOutcomeresource to return to the client ornullif none.From a client response: If the method returned an actual resource body (e.g. a create/update with "Prefer: return=representation") this field will be populated with the resource itself.Gets the headers for the HTTP responseintprotected booleanbooleanvoidregisterResourceViewCallback(Runnable theCallback) Registers a callback to be invoked before the resource in this object gets returned to the client.setCreated(Boolean theCreated) If not null, indicates whether the resource was created (as opposed to being updated).voidsetCreatedUsingStatusCode(int theResponseStatusCode) setOperationOutcome(IBaseOperationOutcome theBaseOperationOutcome) Sets theIBaseOperationOutcomeresource to return to the client.setResource(IBaseResource theResource) In a server response: This field may be populated in server code with the final resource for operations where a resource body is being created/updated.voidsetResponseHeaders(Map<String, List<String>> theResponseHeaders) Sets the headers for the HTTP responsevoidsetResponseStatusCode(int theResponseStatusCode) 
- 
Constructor Details- 
MethodOutcomepublic MethodOutcome()Constructor
- 
MethodOutcomeConstructor- Parameters:
- theId- The ID of the created/updated resource
- theCreated- If not null, indicates whether the resource was created (as opposed to being updated). This is generally not needed, since the server can assume based on the method being called whether the result was a creation or an update. However, it can be useful if you are implementing an update method that does a create if the ID doesn't already exist.
 
- 
MethodOutcomeConstructor- Parameters:
- theId- The ID of the created/updated resource
- theBaseOperationOutcome- The operation outcome to return with the response (or null for none)
 
- 
MethodOutcomepublic MethodOutcome(IIdType theId, IBaseOperationOutcome theBaseOperationOutcome, Boolean theCreated) Constructor- Parameters:
- theId- The ID of the created/updated resource
- theBaseOperationOutcome- The operation outcome to return with the response (or null for none)
- theCreated- If not null, indicates whether the resource was created (as opposed to being updated). This is generally not needed, since the server can assume based on the method being called whether the result was a creation or an update. However, it can be useful if you are implementing an update method that does a create if the ID doesn't already exist.
 
- 
MethodOutcomeConstructor- Parameters:
- theId- The ID of the created/updated resource
 
- 
MethodOutcomeConstructor- Parameters:
- theOperationOutcome- The operation outcome resource to return
 
 
- 
- 
Method Details- 
getCreatedThis will be set toBoolean.TRUEfor instance of MethodOutcome which are returned to client instances, if the server has responded with an HTTP 201 Created.
- 
setCreatedIf not null, indicates whether the resource was created (as opposed to being updated). This is generally not needed, since the server can assume based on the method being called whether the result was a creation or an update. However, it can be useful if you are implementing an update method that does a create if the ID doesn't already exist.Users of HAPI should only interact with this method in Server applications - Parameters:
- theCreated- If not null, indicates whether the resource was created (as opposed to being updated). This is generally not needed, since the server can assume based on the method being called whether the result was a creation or an update. However, it can be useful if you are implementing an update method that does a create if the ID doesn't already exist.
- Returns:
- Returns a reference to thisfor easy method chaining
 
- 
getId
- 
setId- Parameters:
- theId- The ID of the created/updated resource
- Returns:
- Returns a reference to thisfor easy method chaining
 
- 
getOperationOutcomeReturns theIBaseOperationOutcomeresource to return to the client ornullif none.- Returns:
- This method will return null, unlike many methods in the API.
 
- 
setOperationOutcomeSets theIBaseOperationOutcomeresource to return to the client. Set tonull(which is the default) if none.- Returns:
- Returns a reference to thisfor easy method chaining
 
- 
getResourceFrom a client response: If the method returned an actual resource body (e.g. a create/update with "Prefer: return=representation") this field will be populated with the resource itself.
- 
setResourceIn a server response: This field may be populated in server code with the final resource for operations where a resource body is being created/updated. E.g. for an update method, this field could be populated with the resource after the update is applied, with the new version ID, lastUpdate time, etc.This field is optional, but if it is populated the server will return the resource body if requested to do so via the HTTP Prefer header. - Returns:
- Returns a reference to thisfor easy method chaining
- See Also:
 
- 
getResponseHeadersGets the headers for the HTTP response- Specified by:
- getResponseHeadersin interface- IHasHeaders
 
- 
setResponseHeadersSets the headers for the HTTP response
- 
getFirstResponseHeader
- 
registerResourceViewCallbackRegisters a callback to be invoked before the resource in this object gets returned to the client. Note that this is an experimental API and may change.- Parameters:
- theCallback- The callback
- Since:
- 4.0.0
 
- 
fireResourceViewCallbacksFires callbacks registered toregisterResourceViewCallback(Runnable)and then clears the list of registered callbacks.- Since:
- 4.0.0
 
- 
setCreatedUsingStatusCode
- 
hasResource
- 
setResponseStatusCode
- 
getResponseStatusCode
- 
isResponseStatusCodeSet
 
-