1 package org.kuali.ole.describe.controller;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import org.kuali.ole.docstore.model.enums.DocCategory;
7 import org.kuali.ole.docstore.model.enums.DocFormat;
8 import org.kuali.ole.docstore.model.enums.DocType;
9
10
11
12
13
14
15 public class DocumentEditorFactory {
16 private static DocumentEditorFactory documentEditorFactory = new DocumentEditorFactory();
17
18 private Map<String, DocumentEditor> documentEditorMap = new HashMap<String, DocumentEditor>();
19
20 public static DocumentEditorFactory getInstance() {
21 return documentEditorFactory;
22 }
23
24 private DocumentEditorFactory() {
25 initDocumentEditorMap();
26 }
27
28 private void initDocumentEditorMap() {
29 String key = DocCategory.WORK.getCode() + DocType.BIB.getDescription() + DocFormat.MARC.getCode();
30 documentEditorMap.put(key, WorkBibMarcEditor.getInstance());
31
32 key = DocCategory.WORK.getCode() + DocType.INSTANCE.getCode() + DocFormat.OLEML.getCode();
33 documentEditorMap.put(key, WorkInstanceOlemlEditor.getInstance());
34
35 key = DocCategory.WORK.getCode() + DocType.HOLDINGS.getCode() + DocFormat.OLEML.getCode();
36 documentEditorMap.put(key, WorkInstanceOlemlEditor.getInstance());
37
38 key = DocCategory.WORK.getCode() + DocType.SOURCEHOLDINGS.getCode() + DocFormat.OLEML.getCode();
39 documentEditorMap.put(key, WorkInstanceOlemlEditor.getInstance());
40
41 key = DocCategory.WORK.getCode() + DocType.ITEM.getCode() + DocFormat.OLEML.getCode();
42 documentEditorMap.put(key, WorkInstanceOlemlEditor.getInstance());
43 }
44
45 public DocumentEditor getDocumentEditor(String docCategory, String docType, String docFormat) {
46 return documentEditorMap.get(docCategory + docType + docFormat);
47 }
48
49 }