001 /** 002 * Copyright 2005-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package mocks; 017 018 import org.jdom.Element; 019 import org.kuali.rice.core.api.impex.ExportDataSet; 020 import org.kuali.rice.kew.doctype.bo.DocumentType; 021 import org.kuali.rice.kew.doctype.service.DocumentTypeService; 022 023 import java.io.InputStream; 024 import java.util.Collection; 025 import java.util.HashMap; 026 import java.util.List; 027 import java.util.Map; 028 029 030 public class MockDocumentTypeServiceImpl implements DocumentTypeService { 031 032 private Map<String, DocumentType> documentsById = new HashMap<String, DocumentType>(); 033 private Map<String, DocumentType> documentsByName = new HashMap<String, DocumentType>(); 034 035 @Override 036 public DocumentType findByDocumentId(String documentId) { 037 throw new UnsupportedOperationException("not yet implemented"); 038 } 039 040 @Override 041 public DocumentType findById(String documentTypeId) { 042 return documentsById.get(documentTypeId); 043 } 044 045 @Override 046 public DocumentType findByName(String name) { 047 return documentsByName.get(name); 048 } 049 050 @Override 051 public DocumentType findByNameCaseInsensitive(String name) { 052 return documentsByName.get(name); 053 } 054 055 @Override 056 public DocumentType versionAndSave(DocumentType documentType) { 057 addDocumentType(documentType); 058 return documentType; 059 } 060 061 @Override 062 public Collection<DocumentType> find(DocumentType documentType, String docGroupName, boolean climbHiearchy) { 063 throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl"); 064 } 065 066 @Override 067 public List<DocumentType> findAllCurrentRootDocuments() { 068 return null; 069 } 070 071 @Override 072 public DocumentType findRootDocumentType(DocumentType docType) { 073 return null; 074 } 075 076 @Override 077 public void loadXml(InputStream inputStream, String principalId) { 078 throw new UnsupportedOperationException("Mock document type service can't load xml"); 079 } 080 081 @Override 082 public Element export(ExportDataSet dataSet) { 083 return null; 084 } 085 086 @Override 087 public boolean supportPrettyPrint() { 088 return true; 089 } 090 091 @Override 092 public List<DocumentType> findAllCurrent() { 093 return null; 094 } 095 096 @Override 097 public List<DocumentType> getChildDocumentTypes(String documentTypeId) { 098 return null; 099 } 100 101 @Override 102 public DocumentType save(DocumentType documentType) { 103 return null; 104 } 105 106 @Override 107 public List<DocumentType> findPreviousInstances(String documentTypeName) { 108 return null; 109 } 110 111 private void addDocumentType(DocumentType documentType) { 112 documentsById.put(documentType.getDocumentTypeId(), documentType); 113 documentsByName.put(documentType.getName(), documentType); 114 } 115 116 }