Merge pull request #76 from lmckenzi/2016may-pattern-support

Add pattern support to 2016may
This commit is contained in:
Grahame Grieve 2019-09-07 17:21:33 +10:00 committed by GitHub
commit a80710242f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -3640,6 +3640,8 @@ public class ProfileUtilities extends TranslatingUtilities {
public static ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator) { public static ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator) {
if (discriminator.endsWith("@pattern"))
return makeDiscriminator(DiscriminatorType.PATTERN, discriminator.length() == 8 ? "" : discriminator.substring(0,discriminator.length()-9));
if (discriminator.endsWith("@profile")) if (discriminator.endsWith("@profile"))
return makeDiscriminator(DiscriminatorType.PROFILE, discriminator.length() == 8 ? "" : discriminator.substring(discriminator.length()-9)); return makeDiscriminator(DiscriminatorType.PROFILE, discriminator.length() == 8 ? "" : discriminator.substring(discriminator.length()-9));
if (discriminator.endsWith("@type")) if (discriminator.endsWith("@type"))
@ -3656,6 +3658,7 @@ public class ProfileUtilities extends TranslatingUtilities {
public static String buildR2Discriminator(ElementDefinitionSlicingDiscriminatorComponent t) throws FHIRException { public static String buildR2Discriminator(ElementDefinitionSlicingDiscriminatorComponent t) throws FHIRException {
switch (t.getType()) { switch (t.getType()) {
case PROFILE: return t.getPath()+"/@profile"; case PROFILE: return t.getPath()+"/@profile";
case PATTERN: return t.getPath()+"/@pattern";
case TYPE: return t.getPath()+"/@type"; case TYPE: return t.getPath()+"/@type";
case VALUE: return t.getPath(); case VALUE: return t.getPath();
case EXISTS: return t.getPath(); // determination of value vs. exists is based on whether there's only 2 slices - one with minOccurs=1 and other with maxOccur=0 case EXISTS: return t.getPath(); // determination of value vs. exists is based on whether there's only 2 slices - one with minOccurs=1 and other with maxOccur=0

View File

@ -4679,6 +4679,7 @@ public class ProfileUtilities extends TranslatingUtilities {
public static String buildR2Discriminator(ElementDefinitionSlicingDiscriminatorComponent t) throws FHIRException { public static String buildR2Discriminator(ElementDefinitionSlicingDiscriminatorComponent t) throws FHIRException {
switch (t.getType()) { switch (t.getType()) {
case PROFILE: return t.getPath()+"/@profile"; case PROFILE: return t.getPath()+"/@profile";
case PATTERN: return t.getPath()+"/@pattern";
case TYPE: return t.getPath()+"/@type"; case TYPE: return t.getPath()+"/@type";
case VALUE: return t.getPath(); case VALUE: return t.getPath();
case EXISTS: return t.getPath(); // determination of value vs. exists is based on whether there's only 2 slices - one with minOccurs=1 and other with maxOccur=0 case EXISTS: return t.getPath(); // determination of value vs. exists is based on whether there's only 2 slices - one with minOccurs=1 and other with maxOccur=0