001/*-
002 * #%L
003 * Smile CDR - CDR
004 * %%
005 * Copyright (C) 2016 - 2026 Smile CDR, Inc.
006 * %%
007 * All rights reserved.
008 * #L%
009 */
010package ca.cdr.api.pub.cdaexchange.model;
011
012import ca.cdr.api.camel.ICdaCamelConversionResultJson;
013import com.fasterxml.jackson.annotation.JsonCreator;
014import com.fasterxml.jackson.annotation.JsonProperty;
015import com.fasterxml.jackson.annotation.JsonPropertyOrder;
016import org.hl7.fhir.instance.model.api.IBaseBundle;
017import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
018
019import static ca.cdr.api.camel.ICdaCamelConversionResultJson.BUNDLE;
020import static ca.cdr.api.camel.ICdaCamelConversionResultJson.MODIFIABLE_DOCUMENT;
021import static ca.cdr.api.pub.cdaexchange.model.CdaToFhirConversionResultJson.DO_PROCESS;
022import static ca.cdr.api.pub.cdaexchange.model.CdaToFhirConversionResultJson.OPERATION_OUTCOME;
023import static ca.cdr.api.pub.cdaexchange.model.CdaToFhirConversionResultJson.ORIGINAL_DOCUMENT;
024
025/**
026 * Contains all the relevant data involved in the conversion of a CDA document to a FHIR IBaseBundle resource.
027 */
028@JsonPropertyOrder({ORIGINAL_DOCUMENT, MODIFIABLE_DOCUMENT, BUNDLE, DO_PROCESS, OPERATION_OUTCOME})
029public class CdaToFhirConversionResultJson implements ICdaCamelConversionResultJson {
030
031        public static final String ORIGINAL_DOCUMENT = "originalDocument";
032        public static final String DO_PROCESS = "doProcess";
033        public static final String OPERATION_OUTCOME = "operationOutcome";
034
035        /**
036         * The original CDA Exchange document before any customizations have been applied.
037         */
038        @JsonProperty(ORIGINAL_DOCUMENT)
039        private final String myOriginalDocument;
040
041        /**
042         * The CDA Exchange document which customizations can be applied to.
043         */
044        @JsonProperty(MODIFIABLE_DOCUMENT)
045        private String myModifiableDocument;
046
047        /**
048         * A bundle resource that has been created from the modifiableDocument.
049         */
050        @JsonProperty(BUNDLE)
051        private IBaseBundle myBundle;
052
053        /**
054         * A flag to indicate whether a given document should be processed.
055         */
056        @JsonProperty(DO_PROCESS)
057        private boolean myDoProcess;
058
059        /**
060         * The information, warnings, or errors that result from a conversion process.
061         */
062        @JsonProperty(OPERATION_OUTCOME)
063        private IBaseOperationOutcome myOperationOutcome;
064
065        @JsonCreator
066        public CdaToFhirConversionResultJson(@JsonProperty(ORIGINAL_DOCUMENT) String theOriginalDocument) {
067                myOriginalDocument = theOriginalDocument;
068                myModifiableDocument = theOriginalDocument;
069                myDoProcess = true;
070        }
071
072        /**
073         * @return A copy of the original CDA Exchange document before any customizations have been applied.
074         */
075        public String getOriginalDocument() {
076                return myOriginalDocument;
077        }
078
079        /**
080         * @return The CDA Exchange document which customizations can be applied to.
081         */
082        public String getModifiableDocument() {
083                return myModifiableDocument;
084        }
085
086        /**
087         * Sets the CDA Exchange document which customizations can be applied to.
088         * @param theModifiableDocument The modifiable document
089         */
090        public void setModifiableDocument(String theModifiableDocument) {
091                myModifiableDocument = theModifiableDocument;
092        }
093
094        /**
095         * @return A bundle resource that has been created from the modifiable CDA Exchange document.
096         */
097        @Override
098        public IBaseBundle getBundle() {
099                return myBundle;
100        }
101
102        /**
103         * Sets the bundle resource that has been created from the modifiable CDA Exchange document.
104         * @param theBundle The bundle resource
105         */
106        public void setBundle(IBaseBundle theBundle) {
107                myBundle = theBundle;
108        }
109
110        /**
111         * @return Whether the modifiable CDA Exchange document should be processed.
112         */
113        public boolean isDoProcess() {
114                return myDoProcess;
115        }
116
117        /**
118         * Sets a flag to indicate whether the modifiable CDA Exchange document should be processed.
119         * @param theDoProcess The value of the flag
120         */
121        public void setDoProcess(boolean theDoProcess) {
122                myDoProcess = theDoProcess;
123        }
124
125        /**
126         * Set the operation outcome resource.
127         *
128         * @param theOperationOutcome the operation outcome
129         */
130        public void setOperationOutcome(IBaseOperationOutcome theOperationOutcome) {
131                myOperationOutcome = theOperationOutcome;
132        }
133
134        /**
135         * @return The operation outcome resource.
136         */
137        public IBaseOperationOutcome getOperationOutcome() {
138                return myOperationOutcome;
139        }
140}