Placeholder extension moved to resource body from meta; tests passing.
This commit is contained in:
parent
35645999d7
commit
a195eebdec
|
@ -1071,7 +1071,7 @@ public class DaoConfig {
|
|||
* as they are never allowed to be client supplied in HAPI FHIR JPA.
|
||||
*
|
||||
* All placeholder resources created in this way have a meta extension
|
||||
* with the URL {@link HapiExtensions#EXT_RESOURCE_META_PLACEHOLDER} and the value "true".
|
||||
* with the URL {@link HapiExtensions#EXT_RESOURCE_PLACEHOLDER} and the value "true".
|
||||
* </p>
|
||||
*/
|
||||
public boolean isAutoCreatePlaceholderReferenceTargets() {
|
||||
|
@ -1095,7 +1095,7 @@ public class DaoConfig {
|
|||
* as they are never allowed to be client supplied in HAPI FHIR JPA.
|
||||
*
|
||||
* All placeholder resources created in this way have a meta extension
|
||||
* with the URL {@link HapiExtensions#EXT_RESOURCE_META_PLACEHOLDER} and the value "true".
|
||||
* with the URL {@link HapiExtensions#EXT_RESOURCE_PLACEHOLDER} and the value "true".
|
||||
* </p>
|
||||
*/
|
||||
public void setAutoCreatePlaceholderReferenceTargets(boolean theAutoCreatePlaceholderReferenceTargets) {
|
||||
|
|
|
@ -41,7 +41,6 @@ import ca.uhn.fhir.util.HapiExtensions;
|
|||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseMetaType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
@ -123,11 +122,9 @@ public class DaoResourceLinkResolver implements IResourceLinkResolver {
|
|||
@SuppressWarnings("unchecked")
|
||||
T newResource = (T) missingResourceDef.newInstance();
|
||||
|
||||
// FIXME: DM 2021-03-04 - This is where the placeholder extension is added; should be in resource body instead of meta?
|
||||
IBaseMetaType meta = newResource.getMeta();
|
||||
if (meta instanceof IBaseHasExtensions) {
|
||||
IBaseExtension<?, ?> extension = ((IBaseHasExtensions) meta).addExtension();
|
||||
extension.setUrl(HapiExtensions.EXT_RESOURCE_META_PLACEHOLDER);
|
||||
if (newResource instanceof IBaseHasExtensions) {
|
||||
IBaseExtension<?, ?> extension = ((IBaseHasExtensions) newResource).addExtension();
|
||||
extension.setUrl(HapiExtensions.EXT_RESOURCE_PLACEHOLDER);
|
||||
extension.setValue(myContext.getPrimitiveBoolean(true));
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,6 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test {
|
|||
assertEquals("Patient/999999999999999", outcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless().getValue());
|
||||
}
|
||||
|
||||
// FIXME: DM 2021-03-04 - This test fails; extension isn't being created correctly.
|
||||
@Test
|
||||
public void testCreatePlaceholderExtension_WithUpdateToTarget() {
|
||||
myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true);
|
||||
|
@ -201,7 +200,7 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test {
|
|||
ourLog.info("\nPlaceholder Patient created:\n" + myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(placeholderPat));
|
||||
assertEquals(0, placeholderPat.getIdentifier().size());
|
||||
Extension extension = placeholderPat.getExtensionByUrl(HapiExtensions.EXT_RESOURCE_PLACEHOLDER);
|
||||
assertNotNull(extension); // FIXME: DM 2021-03-04 - This assertion fails for now.
|
||||
assertNotNull(extension);
|
||||
assertTrue(extension.hasValue());
|
||||
assertTrue(((BooleanType) extension.getValue()).booleanValue());
|
||||
|
||||
|
|
Loading…
Reference in New Issue