1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 private void addDocumentType(DocumentType documentType) {
112 documentsById.put(documentType.getDocumentTypeId(), documentType);
113 documentsByName.put(documentType.getName(), documentType);
114 }
115
116 }