View Javadoc
1   /**
2    * The contents of this file are subject to the Mozilla Public License Version 1.1
3    * (the "License"); you may not use this file except in compliance with the License.
4    * You may obtain a copy of the License at http://www.mozilla.org/MPL/
5    * Software distributed under the License is distributed on an "AS IS" basis,
6    * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the
7    * specific language governing rights and limitations under the License.
8    *
9    * The Original Code is "CodeStoreRegistry.java".  Description:
10   * "Registry containing CodeStore instances"
11   *
12   * The Initial Developer of the Original Code is University Health Network. Copyright (C)
13   * 2012.  All Rights Reserved.
14   *
15   * Contributor(s): ______________________________________.
16   *
17   * Alternatively, the contents of this file may be used under the terms of the
18   * GNU General Public License (the "GPL"), in which case the provisions of the GPL are
19   * applicable instead of those above.  If you wish to allow use of your version of this
20   * file only under the terms of the GPL and not to allow others to use your version
21   * of this file under the MPL, indicate your decision by deleting  the provisions above
22   * and replace  them with the notice and other provisions required by the GPL License.
23   * If you do not delete the provisions above, a recipient may use your version of
24   * this file under either the MPL or the GPL.
25   *
26   */
27  package ca.uhn.hl7v2.conf.store;
28  
29  /**
30   * Registry containing {@link CodeStore} instances registered for Conformance Profile IDs
31   * or ID patterns.
32   * 
33   * @author Christian Ohr
34   */
35  public interface CodeStoreRegistry {
36  
37      /**
38       * Registers a code store for use with all profiles.
39       */
40      void addCodeStore(CodeStore store);
41      
42      /**
43       * Registers a code store for use with certain profiles. The profiles with which the code store
44       * are used are determined by profileIdPattern, which is a regular expression that will be
45       * matched against profile IDs. For example suppose there are three profiles in the profile
46       * store, with the following IDs:
47       * <ol>
48       * <li>ADT:confsig-UHN-2.4-profile-AL-NE-Immediate</li>
49       * <li>ADT:confsig-CIHI-2.4-profile-AL-NE-Immediate</li>
50       * <li>ADT:confsig-CIHI-2.3-profile-AL-NE-Immediate</li>
51       * </ol>
52       * Then to use a code store with only the first profile, the profileIdPattern would be
53       * "ADT:confsig-UHN-2.4-profile-AL-NE-Immediate". To use a code store with both of the 2.4
54       * profiles, the pattern would be ".*2\\.4.*". To use a code store with all profiles, the
55       * pattern would be '.*". Multiple stores can be registered for use with the same profile. If
56       * this happens, the first one that returned true for knowsCodes(codeSystem) will used. Stores
57       * are searched in the order they are added here.
58       */    
59      void addCodeStore(CodeStore store, String profileID);
60      
61      /**
62       * Returns the first code store that knows the codes in the given code system (as per
63       * CodeStore.knowsCodes) and is registered for the given profile. Code stores are checked in the
64       * order in which they are added (with addCodeStore()).
65       * 
66       * @return null if none are found
67       */    
68      CodeStore getCodeStore(String profileID, String codeSystem);
69      
70  }