Add string mimetype to resourceoperationemssage
This commit is contained in:
parent
86ea0d60ef
commit
4c9df3f7b4
|
@ -24,6 +24,7 @@ package ca.uhn.fhir.rest.server.messaging;
|
|||
|
||||
import ca.uhn.fhir.model.api.IModelJson;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.net.MediaType;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -43,6 +44,9 @@ public abstract class BaseResourceMessage implements IResourceMessage, IModelJso
|
|||
@JsonProperty("transactionId")
|
||||
private String myTransactionId;
|
||||
|
||||
@JsonProperty("mimeType")
|
||||
private String myMimeType;
|
||||
|
||||
/**
|
||||
* Returns an attribute stored in this message.
|
||||
* <p>
|
||||
|
@ -145,6 +149,14 @@ public abstract class BaseResourceMessage implements IResourceMessage, IModelJso
|
|||
myTransactionId = theTransactionId;
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return myMimeType;
|
||||
}
|
||||
|
||||
public void setMimeType(String theMimeType) {
|
||||
myMimeType = theMimeType;
|
||||
}
|
||||
|
||||
public enum OperationTypeEnum {
|
||||
CREATE,
|
||||
UPDATE,
|
||||
|
|
|
@ -25,6 +25,8 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
|
|||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
public class ResourceOperationMessage extends BaseResourceModifiedMessage {
|
||||
|
||||
|
||||
public ResourceOperationMessage() {
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package ca.uhn.fhir.rest.server.messaging;
|
|||
import ca.uhn.fhir.rest.server.messaging.json.ResourceOperationJsonMessage;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.net.MediaType;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static ca.uhn.fhir.rest.server.messaging.json.HapiMessageHeaders.FIRST_FAILURE_KEY;
|
||||
|
@ -17,7 +18,9 @@ class ResourceOperationMessageTest {
|
|||
@Test
|
||||
public void testSerializationAndDeserializationOfResourceModifiedMessage() throws JsonProcessingException {
|
||||
ResourceOperationJsonMessage jsonMessage = new ResourceOperationJsonMessage();
|
||||
jsonMessage.setPayload(new ResourceOperationMessage());
|
||||
ResourceOperationMessage payload = new ResourceOperationMessage();
|
||||
payload.setMimeType("application/json+fhir");
|
||||
jsonMessage.setPayload(payload);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String serialized = mapper.writeValueAsString(jsonMessage);
|
||||
jsonMessage = mapper.readValue(serialized, ResourceOperationJsonMessage.class);
|
||||
|
|
Loading…
Reference in New Issue