001package org.kuali.ole.docstore.indexer.solr; 002 003import org.kuali.ole.docstore.model.enums.DocCategory; 004import org.kuali.ole.docstore.model.enums.DocFormat; 005import org.kuali.ole.docstore.model.enums.DocType; 006 007import java.util.HashMap; 008import java.util.Map; 009 010/** 011 * Created with IntelliJ IDEA. 012 * User: mjagan 013 * Date: 7/2/13 014 * Time: 4:24 PM 015 * To change this template use File | Settings | File Templates. 016 */ 017public class DocumentIndexerManagerFactory { 018 019 private static DocumentIndexerManagerFactory documentIndexerManagerFactory = new DocumentIndexerManagerFactory(); 020 private Map<String, IndexerService> indexerManagerMap = new HashMap<String, IndexerService>(); 021 022 public static DocumentIndexerManagerFactory getInstance() { 023 return documentIndexerManagerFactory; 024 } 025 026 private DocumentIndexerManagerFactory() { 027 initDocumentManagerMap(); 028 } 029 030 private void initDocumentManagerMap() { 031 String key = DocCategory.WORK.getCode() + DocType.BIB.getDescription() + DocFormat.MARC.getCode(); 032 indexerManagerMap.put(key, WorkBibMarcDocumentIndexer.getInstance()); 033 034 key = DocCategory.WORK.getCode() + DocType.BIB.getDescription() + DocFormat.DUBLIN_CORE.getCode(); 035 indexerManagerMap.put(key, WorkBibDocumentIndexer.getInstance()); 036 037 key = DocCategory.WORK.getCode() + DocType.BIB.getDescription() + DocFormat.DUBLIN_UNQUALIFIED.getCode(); 038 indexerManagerMap.put(key, WorkBibDocumentIndexer.getInstance()); 039 040 key = DocCategory.WORK.getCode() + DocType.INSTANCE.getCode() + DocFormat.OLEML.getCode(); 041 indexerManagerMap.put(key, WorkInstanceDocumentIndexer.getInstance()); 042 043 key = DocCategory.WORK.getCode() + DocType.HOLDINGS.getCode() + DocFormat.OLEML.getCode(); 044 indexerManagerMap.put(key, WorkHoldingsDocumentIndexer.getInstance()); 045 046 key = DocCategory.WORK.getCode() + DocType.ITEM.getCode() + DocFormat.OLEML.getCode(); 047 indexerManagerMap.put(key, WorkItemDocumentIndexer.getInstance()); 048 049 key = DocCategory.WORK.getCode() + DocType.SOURCEHOLDINGS.getCode() + DocFormat.OLEML.getCode(); 050 indexerManagerMap.put(key, WorkInstanceDocumentIndexer.getInstance()); 051 052 key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.ONIXPL.getCode(); 053 indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance()); 054 055 key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.PDF.getCode(); 056 indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance()); 057 058 key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.DOC.getCode(); 059 indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance()); 060 061 key = DocCategory.WORK.getCode() + DocType.LICENSE.getCode() + DocFormat.XSLT.getCode(); 062 indexerManagerMap.put(key, WorkLicenseDocumentIndexer.getInstance()); 063 064 key = DocCategory.WORK.getCode() + DocType.EINSTANCE.getCode() + DocFormat.OLEML.getCode(); 065 indexerManagerMap.put(key, WorkEInstanceDocumentIndexer.getInstance()); 066 067 key = DocCategory.WORK.getCode() + DocType.EHOLDINGS.getCode() + DocFormat.OLEML.getCode(); 068 indexerManagerMap.put(key, WorkEInstanceDocumentIndexer.getInstance()); 069 070 } 071 072 public IndexerService getDocumentIndexManager(String docCategory, String docType, String docFormat) { 073 return indexerManagerMap.get(docCategory + docType + docFormat); 074 } 075 076 077}