View Javadoc
1   package org.kuali.ole.docstore.engine.factory;
2   
3   import org.kuali.ole.docstore.engine.service.storage.rdbms.*;
4   import org.kuali.ole.docstore.model.enums.DocCategory;
5   import org.kuali.ole.docstore.model.enums.DocFormat;
6   import org.kuali.ole.docstore.model.enums.DocType;
7   
8   import java.util.HashMap;
9   import java.util.Map;
10  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: sambasivam
14   * Date: 12/17/13
15   * Time: 2:53 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class DocumentManagerFactory {
19      private static DocumentManagerFactory documentManagerFactory = new DocumentManagerFactory();
20      private Map<String, DocumentManager> documentManagerMap = new HashMap<String, DocumentManager>();
21  
22      public static DocumentManagerFactory getInstance() {
23          return documentManagerFactory;
24      }
25  
26      private DocumentManagerFactory() {
27          initDocumentManagerMap();
28      }
29  
30      private void initDocumentManagerMap() {
31          String key = DocCategory.WORK.getCode() + DocType.BIB.getCode() + DocFormat.MARC.getCode();
32          documentManagerMap.put(key, RdbmsBibMarcDocumentManager.getInstance());
33  
34          key = DocCategory.WORK.getCode() + DocType.BIB.getCode() + DocFormat.DUBLIN_CORE.getCode();
35          documentManagerMap.put(key, RdbmsBibDocumentManager.getInstance());
36  
37          key = DocCategory.WORK.getCode() + DocType.BIB.getCode() + DocFormat.DUBLIN_UNQUALIFIED.getCode();
38          documentManagerMap.put(key, RdbmsBibDocumentManager.getInstance());
39  
40  //        key = DocCategory.WORK.getCode() + DocType.INSTANCE.getCode() + DocFormat.OLEML.getCode();
41  //        documentManagerMap.put(key, RdbmsWorkInstanceDocumentManager.getInstance());
42  //
43          key = DocCategory.WORK.getCode() + DocType.ITEM.getCode() + DocFormat.OLEML.getCode();
44          documentManagerMap.put(key, RdbmsItemDocumentManager.getInstance());
45  //
46          key = DocCategory.WORK.getCode() + DocType.HOLDINGS.getCode() + DocFormat.OLEML.getCode();
47          documentManagerMap.put(key, RdbmsHoldingsDocumentManager.getInstance());
48  //
49          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.ONIXPL.getCode();
50          documentManagerMap.put(key, RdbmsLicenseOnixplDocumentManager.getInstance());
51          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.PDF.getCode();
52          documentManagerMap.put(key, RdbmsLicenseAttachmentDocumentManager.getInstance());
53          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.XSLT.getCode();
54          documentManagerMap.put(key, RdbmsLicenseAttachmentDocumentManager.getInstance());
55          key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.DOC.getCode();
56          documentManagerMap.put(key, RdbmsLicenseAttachmentDocumentManager.getInstance());
57  
58  //        key = DocCategory.WORK.getCode() + DocType.EINSTANCE.getCode() + DocFormat.OLEML.getCode();
59  //        documentManagerMap.put(key, RdbmsWorkEInstanceDocumentManager.getInstance());
60  //
61  //        key = DocCategory.WORK.getCode() + DocType.EHOLDINGS.getCode() + DocFormat.OLEML.getCode();
62  //        documentManagerMap.put(key, RdbmsWorkEHoldingsDocumentManager.getInstance());
63  
64      }
65  
66      public DocumentManager getDocumentManager(String docCategory, String docType, String docFormat) {
67          return documentManagerMap.get(docCategory + docType + docFormat);
68      }
69  
70  }