001package org.hl7.fhir.convertors.advisors.impl;
002
003import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor50;
004import org.hl7.fhir.r5.model.DataType;
005import org.hl7.fhir.r5.model.Expression;
006
007import javax.annotation.Nonnull;
008import java.util.ArrayList;
009import java.util.Arrays;
010import java.util.Collections;
011import java.util.List;
012
013public class BaseAdvisor_10_50 extends BaseAdvisor50<org.hl7.fhir.dstu2.model.Extension> {
014  final List<String> conformanceIgnoredUrls = Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown");
015  private final List<Class<?>> ignoredExtensionTypes = new ArrayList<>(Collections.singletonList(Expression.class));
016
017  public BaseAdvisor_10_50() {
018  }
019
020  public BaseAdvisor_10_50(Boolean failFast) {
021    this.failFast = failFast;
022  }
023
024  public boolean ignoreExtension(@Nonnull String path,
025                                 @Nonnull String url) {
026    List<String> paths = Arrays.asList(path.split(","));
027    return (paths.get(paths.size() - 1).equals("Conformance")) && (conformanceIgnoredUrls.contains(url));
028  }
029
030  public boolean ignoreType(@Nonnull String path,
031                            @Nonnull DataType type) {
032    return ignoredExtensionTypes.contains(type.getClass());
033  }
034}