001package org.hl7.fhir.convertors.advisors.impl;
002
003import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor50;
004import org.hl7.fhir.exceptions.FHIRException;
005
006import javax.annotation.Nonnull;
007import java.util.Arrays;
008import java.util.Collections;
009import java.util.List;
010
011public class BaseAdvisor_30_50 extends BaseAdvisor50<org.hl7.fhir.dstu3.model.Extension> {
012
013  final List<String> valueSetIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/StructureDefinition/valueset-extensible");
014  final List<String> capabilityStatementIgnoredUrls = Arrays.asList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
015    "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.profile");
016
017  public BaseAdvisor_30_50() {
018  }
019
020  public BaseAdvisor_30_50(Boolean failFast) {
021    this.failFast = failFast;
022  }
023
024  @Override
025  public boolean ignoreExtension(@Nonnull String path,
026                                 @Nonnull String url) throws FHIRException {
027    List<String> paths = Arrays.asList(path.split(","));
028    if ((paths.get(paths.size() - 1).equals("ValueSet")) && (valueSetIgnoredUrls.contains(url))) {
029      return true;
030    } else
031      return (paths.get(paths.size() - 1).equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
032  }
033}