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