001package org.hl7.fhir.r5.utils.validation;
002
003import java.util.HashMap;
004import java.util.Map;
005
006import org.hl7.fhir.r5.context.IWorkerContext;
007import org.hl7.fhir.utilities.MarkedToMoveToAdjunctPackage;
008import org.hl7.fhir.utilities.UUIDUtilities;
009
010/**
011 * Used by the validation infrastructure to cache internal infrastructure that
012 * will be cast away when the session is closed by the application
013 */
014@MarkedToMoveToAdjunctPackage
015public class ValidatorSession {
016
017  public static final String VIEW_DEFINITION_CONTEXT = "VIEW_DEFINITION_CONTEXT";
018  
019  private Map<String, Object> objects = new HashMap<>();
020  protected String sessionId;
021  private Map<String, IWorkerContext> otherVersions;
022  
023  public ValidatorSession() {
024    super();
025    sessionId = UUIDUtilities.makeUuidLC();
026  }
027
028  public String getSessionId() {
029    return sessionId;
030  }
031
032  public Map<String, Object> getObjects() {
033    return objects;
034  }
035
036  public void close() {
037    objects.clear();
038  }
039
040  public Map<String, IWorkerContext> getOtherVersions() {
041    if (otherVersions == null) {
042      otherVersions = new HashMap<String, IWorkerContext>();
043    }
044    return otherVersions;
045  }
046  
047  
048}