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 */
016package mocks;
017
018import org.jdom.Element;
019import org.kuali.rice.core.api.impex.ExportDataSet;
020import org.kuali.rice.kew.doctype.bo.DocumentType;
021import org.kuali.rice.kew.doctype.service.DocumentTypeService;
022
023import java.io.InputStream;
024import java.util.Collection;
025import java.util.HashMap;
026import java.util.List;
027import java.util.Map;
028
029
030public 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    @Override
112    public String findParentNameByName(String documentTypeName) {
113        return null;
114    }
115
116    private void addDocumentType(DocumentType documentType) {
117        documentsById.put(documentType.getDocumentTypeId(), documentType);
118        documentsByName.put(documentType.getName(), documentType);
119    }
120
121}