001package org.hl7.fhir.convertors.advisors.interfaces;
002
003import org.hl7.fhir.exceptions.FHIRException;
004import org.hl7.fhir.instance.model.api.IBaseExtension;
005import org.hl7.fhir.r5.model.*;
006
007import javax.annotation.Nonnull;
008import java.util.ArrayList;
009import java.util.List;
010
011public abstract class BaseAdvisor50<T extends IBaseExtension> extends BaseAdvisor {
012  private final List<CodeSystem> cslist = new ArrayList<>();
013
014  public final List<CodeSystem> getCslist() {
015    return this.cslist;
016  }
017
018  public void handleCodeSystem(@Nonnull CodeSystem tgtcs,
019                               @Nonnull ValueSet source) {
020    tgtcs.setId(source.getId());
021    tgtcs.setValueSet(source.getUrl());
022    this.cslist.add(tgtcs);
023  }
024
025  public boolean ignoreEntry(@Nonnull Bundle.BundleEntryComponent src,
026                             @Nonnull FhirPublication targetVersion) {
027    return false;
028  }
029
030  public CodeSystem getCodeSystem(@Nonnull ValueSet src) throws FHIRException {
031    return null;
032  }
033
034  public boolean ignoreExtension(@Nonnull String path,
035                                 @Nonnull Extension ext) throws FHIRException {
036    return ((ext.getUrl() != null) && (this.ignoreExtension(path, ext.getUrl()))
037      || (this.ignoreType(path, ext.getValue())));
038  }
039
040  public boolean ignoreExtension(@Nonnull String path,
041                                 @Nonnull T ext) throws FHIRException {
042    return ((ext.getUrl() != null) && this.ignoreExtension(path, ext.getUrl()))
043      || (this.ignoreType(path, ext.getValue()));
044  }
045
046  public boolean ignoreExtension(@Nonnull String path,
047                                 @Nonnull String url) throws FHIRException {
048    return false;
049  }
050
051  public boolean ignoreType(@Nonnull String path,
052                            @Nonnull DataType type) throws FHIRException {
053    return false;
054  }
055
056  public boolean ignoreType(@Nonnull String path,
057                            @Nonnull Object type) throws FHIRException {
058    return false;
059  }
060
061  public boolean useAdvisorForExtension(@Nonnull String path,
062                                        @Nonnull Extension ext) throws FHIRException {
063    return false;
064  }
065
066  public boolean useAdvisorForExtension(@Nonnull String path,
067                                        @Nonnull T ext) throws FHIRException {
068    return false;
069  }
070
071  public void handleExtension(@Nonnull String path,
072                              @Nonnull Extension src,
073                              @Nonnull T tgt) throws FHIRException {
074  }
075
076  public void handleExtension(@Nonnull String path,
077                              @Nonnull T src,
078                              @Nonnull Extension tgt) throws FHIRException {
079  }
080}