View Javadoc
1   package org.kuali.ole.utility.callnumber;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   /**
7    * Created with IntelliJ IDEA.
8    * User: ?
9    * Date: 20/2/13
10   * Time: 7:29 PM
11   * To change this template use File | Settings | File Templates.
12   */
13  public class CallNumberFactory {
14      private static CallNumberFactory callNumberFactory = new CallNumberFactory();
15      private Map<String, CallNumber> callNumberMap = new HashMap<String, CallNumber>();
16  
17      public static CallNumberFactory getInstance() {
18          return callNumberFactory;
19      }
20  
21      private CallNumberFactory() {
22          initCallNumberMap();
23      }
24  
25      private void initCallNumberMap() {
26          String key = CallNumberType.LCC.getCode();
27          callNumberMap.put(key, LCCallNumber.getInstance());
28  
29          key = CallNumberType.DDC.getCode();
30          callNumberMap.put(key, DDCallNumber.getInstance());
31  
32          key = CallNumberType.NLM.getCode();
33          callNumberMap.put(key, NLMCallNumber.getInstance());
34  
35          key = CallNumberType.SuDoc.getCode();
36          callNumberMap.put(key, SuDocCallNumber.getInstance());
37  
38          key = CallNumberType.FOUR.getCode();
39          callNumberMap.put(key, OtherCallNumber.getInstance());
40  
41          key = CallNumberType.FIVE.getCode();
42          callNumberMap.put(key, OtherCallNumber.getInstance());
43  
44          key = CallNumberType.SIX.getCode();
45          callNumberMap.put(key, OtherCallNumber.getInstance());
46  
47          key = CallNumberType.SEVEN.getCode();
48          callNumberMap.put(key, OtherCallNumber.getInstance());
49  
50          key = CallNumberType.EIGHT.getCode();
51          callNumberMap.put(key, OtherCallNumber.getInstance());
52  
53      }
54  
55  
56      public CallNumber getCallNumber(String callNumberType) {
57          if (callNumberMap.get(callNumberType) == null) {
58              return OtherCallNumber.getInstance();
59          }
60          return callNumberMap.get(callNumberType);
61      }
62  }