1 package org.kuali.ole.docstore.document.rdbms;
2
3 import org.kuali.ole.docstore.document.DocumentManager;
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 import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument;
8
9 import java.util.HashMap;
10 import java.util.Map;
11
12
13
14
15
16
17
18
19 public class RdbmsDocumentManagerFactory {
20 private static RdbmsDocumentManagerFactory documentManagerFactory = new RdbmsDocumentManagerFactory();
21 private Map<String, DocumentManager> documentManagerMap = new HashMap<String, DocumentManager>();
22
23 public static RdbmsDocumentManagerFactory getInstance() {
24 return documentManagerFactory;
25 }
26
27 private RdbmsDocumentManagerFactory() {
28 initDocumentManagerMap();
29 }
30
31 private void initDocumentManagerMap() {
32 String key = DocCategory.WORK.getCode() + DocType.BIB.getCode() + DocFormat.MARC.getCode();
33 documentManagerMap.put(key, RdbmsWorkBibMarcDocumentManager.getInstance());
34
35 key = DocCategory.WORK.getCode() + DocType.BIB.getCode() + DocFormat.DUBLIN_CORE.getCode();
36 documentManagerMap.put(key, RdbmsWorkBibDocumentManager.getInstance());
37
38 key = DocCategory.WORK.getCode() + DocType.BIB.getCode() + DocFormat.DUBLIN_UNQUALIFIED.getCode();
39 documentManagerMap.put(key, RdbmsWorkBibDocumentManager.getInstance());
40
41 key = DocCategory.WORK.getCode() + DocType.INSTANCE.getCode() + DocFormat.OLEML.getCode();
42 documentManagerMap.put(key, RdbmsWorkInstanceDocumentManager.getInstance());
43
44 key = DocCategory.WORK.getCode() + DocType.ITEM.getCode() + DocFormat.OLEML.getCode();
45 documentManagerMap.put(key, RdbmsWorkItemDocumentManager.getInstance());
46
47 key = DocCategory.WORK.getCode() + DocType.HOLDINGS.getCode() + DocFormat.OLEML.getCode();
48 documentManagerMap.put(key, RdbmsWorkHoldingsDocumentManager.getInstance());
49
50 key = DocCategory.WORK.getCode() + DocType.EINSTANCE.getCode() + DocFormat.OLEML.getCode();
51 documentManagerMap.put(key, RdbmsWorkEInstanceDocumentManager.getInstance());
52
53 key = DocCategory.WORK.getCode() + DocType.EHOLDINGS.getCode() + DocFormat.OLEML.getCode();
54 documentManagerMap.put(key, RdbmsWorkEHoldingsDocumentManager.getInstance());
55
56 }
57
58 public DocumentManager getDocumentManager(String docCategory, String docType, String docFormat) {
59 return documentManagerMap.get(docCategory + docType + docFormat);
60 }
61
62 public DocumentManager getDocumentManager(RequestDocument requestDocument) {
63 return documentManagerMap
64 .get(requestDocument.getCategory() + requestDocument.getType() + requestDocument.getFormat());
65 }
66 }