Add string mimetype to resourceoperationemssage

This commit is contained in:
Tadgh 2021-01-25 11:25:47 -05:00
parent 86ea0d60ef
commit 4c9df3f7b4
4 changed files with 19 additions and 2 deletions

View File

@ -55,7 +55,7 @@ public class SubscriptionDeliveringEmailSubscriber extends BaseSubscriptionDeliv
@Override
public void handleMessage(ResourceDeliveryMessage theMessage) throws Exception {
CanonicalSubscription subscription = theMessage.getSubscription();
// The Subscription.endpoint is treated as the email "to"
String endpointUrl = subscription.getEndpointUrl();
List<String> destinationAddresses = new ArrayList<>();

View File

@ -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,

View File

@ -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() {
}

View File

@ -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);