View Javadoc
1   package org.kuali.ole.docstore.indexer.solr;
2   
3   import org.kuali.ole.docstore.model.enums.DocCategory;
4   import org.kuali.ole.docstore.model.enums.DocFormat;
5   import org.kuali.ole.docstore.model.enums.DocType;
6   
7   import java.util.HashMap;
8   import java.util.Map;
9   
10  /**
11   * Created with IntelliJ IDEA.
12   * User: mjagan
13   * Date: 7/2/13
14   * Time: 4:24 PM
15   * To change this template use File | Settings | File Templates.
16   */
17  public class DocumentIndexerManagerFactory {
18  
19      private static DocumentIndexerManagerFactory documentIndexerManagerFactory = new DocumentIndexerManagerFactory();
20      private Map<String, IndexerService> indexerManagerMap = new HashMap<String, IndexerService>();
21  
22      public static DocumentIndexerManagerFactory getInstance() {
23          return documentIndexerManagerFactory;
24      }
25  
26      private DocumentIndexerManagerFactory() {
27          initDocumentManagerMap();
28      }
29  
30      private void initDocumentManagerMap() {
31          String key = DocCategory.WORK.getCode() + DocType.BIB.getDescription() + DocFormat.MARC.getCode();
32          indexerManagerMap.put(key, WorkBibMarcDocumentIndexer.getInstance());
33  
34          key = DocCategory.WORK.getCode() + DocType.BIB.getDescription() + DocFormat.DUBLIN_CORE.getCode();
35          indexerManagerMap.put(key, WorkBibDocumentIndexer.getInstance());
36  
37          key = DocCategory.WORK.getCode() + DocType.BIB.getDescription() + DocFormat.DUBLIN_UNQUALIFIED.getCode();
38          indexerManagerMap.put(key, WorkBibDocumentIndexer.getInstance());
39  
40          key = DocCategory.WORK.getCode() + DocType.INSTANCE.getCode() + DocFormat.OLEML.getCode();
41          indexerManagerMap.put(key, WorkInstanceDocumentIndexer.getInstance());
42  
43          key = DocCategory.WORK.getCode() + DocType.HOLDINGS.getCode() + DocFormat.OLEML.getCode();
44          indexerManagerMap.put(key, WorkHoldingsDocumentIndexer.getInstance());
45  
46          key = DocCategory.WORK.getCode() + DocType.ITEM.getCode() + DocFormat.OLEML.getCode();
47          indexerManagerMap.put(key, WorkItemDocumentIndexer.getInstance());
48  
49          key = DocCategory.WORK.getCode() + DocType.SOURCEHOLDINGS.getCode() + DocFormat.OLEML.getCode();
50          indexerManagerMap.put(key, WorkInstanceDocumentIndexer.getInstance());
51  
52          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.ONIXPL.getCode();
53          indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance());
54  
55          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.PDF.getCode();
56          indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance());
57  
58          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.DOC.getCode();
59          indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance());
60  
61          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.XSLT.getCode();
62          indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance());
63  
64          key = DocCategory.WORK.getCode() + DocType.EINSTANCE.getCode() + DocFormat.OLEML.getCode();
65          indexerManagerMap.put(key, WorkEInstanceDocumentIndexer.getInstance());
66  
67          key = DocCategory.WORK.getCode() + DocType.EHOLDINGS.getCode() + DocFormat.OLEML.getCode();
68          indexerManagerMap.put(key, WorkEInstanceDocumentIndexer.getInstance());
69  
70      }
71  
72      public IndexerService getDocumentIndexManager(String docCategory, String docType, String docFormat) {
73          return indexerManagerMap.get(docCategory + docType + docFormat);
74      }
75  
76  
77  }