View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package mocks;
17  
18  import org.jdom.Element;
19  import org.kuali.rice.core.api.impex.ExportDataSet;
20  import org.kuali.rice.kew.doctype.bo.DocumentType;
21  import org.kuali.rice.kew.doctype.service.DocumentTypeService;
22  
23  import java.io.InputStream;
24  import java.util.Collection;
25  import java.util.HashMap;
26  import java.util.List;
27  import java.util.Map;
28  
29  
30  public class MockDocumentTypeServiceImpl implements DocumentTypeService {
31  
32      private Map<String, DocumentType> documentsById = new HashMap<String, DocumentType>();
33      private Map<String, DocumentType> documentsByName = new HashMap<String, DocumentType>();
34  
35      @Override
36      public DocumentType findByDocumentId(String documentId) {
37  		throw new UnsupportedOperationException("not yet implemented");
38  	}
39  
40      @Override
41      public DocumentType findById(String documentTypeId) {
42          return documentsById.get(documentTypeId);
43      }
44  
45      @Override
46      public DocumentType findByName(String name) {
47          return documentsByName.get(name);
48      }
49  
50      @Override
51      public DocumentType findByNameCaseInsensitive(String name) {
52          return documentsByName.get(name);
53      }
54  
55      @Override
56      public DocumentType versionAndSave(DocumentType documentType) {
57          addDocumentType(documentType);
58          return documentType;
59      }
60  
61      @Override
62      public Collection<DocumentType> find(DocumentType documentType, String docGroupName, boolean climbHiearchy) {
63          throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl");
64      }
65  
66      @Override
67      public List<DocumentType> findAllCurrentRootDocuments() {
68          return null;
69      }
70  
71      @Override
72      public DocumentType findRootDocumentType(DocumentType docType) {
73          return null;
74      }
75  
76      @Override
77      public void loadXml(InputStream inputStream, String principalId) {
78          throw new UnsupportedOperationException("Mock document type service can't load xml");
79      }
80  
81      @Override
82      public Element export(ExportDataSet dataSet) {
83          return null;
84      }
85  
86  	@Override
87  	public boolean supportPrettyPrint() {
88  		return true;
89  	}
90  
91      @Override
92  	public List<DocumentType> findAllCurrent() {
93          return null;
94      }
95  
96      @Override
97  	public List<DocumentType> getChildDocumentTypes(String documentTypeId) {
98  		return null;
99  	}
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 }