1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package mocks;
18
19 import java.io.InputStream;
20 import java.util.Collection;
21 import java.util.HashMap;
22 import java.util.List;
23 import java.util.Map;
24
25 import org.jdom.Element;
26 import org.kuali.rice.core.api.impex.ExportDataSet;
27 import org.kuali.rice.kew.doctype.bo.DocumentType;
28 import org.kuali.rice.kew.doctype.service.DocumentTypeService;
29 import org.kuali.rice.kew.postprocessor.PostProcessor;
30 import org.kuali.rice.kew.rule.bo.RuleAttribute;
31
32
33 public class MockDocumentTypeServiceImpl implements DocumentTypeService {
34
35 public DocumentType setDocumentTypeVersion(DocumentType documentType, boolean currentInd) {
36 return null;
37 }
38 public DocumentType getMostRecentDocType(String docTypeName) {
39 return null;
40 }
41 public boolean isLockedForRouting(DocumentType documentType) {
42 return false;
43 }
44 private Map<String, DocumentType> documentsById = new HashMap<String, DocumentType>();
45 private Map<String, DocumentType> documentsByName = new HashMap<String, DocumentType>();
46 private Map<String, PostProcessor> postProcessors = new HashMap<String, PostProcessor>();
47
48 public void makeCurrent(List documentTypes) {
49 throw new UnsupportedOperationException("not yet implmeneted");
50 }
51
52 public void addDocumentType(DocumentType documentType, PostProcessor postProcessor) {
53 documentsById.put(documentType.getDocumentTypeId(), documentType);
54 documentsByName.put(documentType.getName(), documentType);
55 postProcessors.put(documentType.getDocumentTypeId(), postProcessor);
56 }
57
58 public DocumentType findByDocumentId(String documentId) {
59 throw new UnsupportedOperationException("not yet implemented");
60 }
61
62 public Integer getMaxVersionNumber(String name){
63 return new Integer(0);
64 }
65 public DocumentType findById(String documentTypeId) {
66 return (DocumentType) documentsById.get(documentTypeId);
67 }
68
69 public DocumentType findByName(String name) {
70 return (DocumentType) documentsByName.get(name);
71 }
72
73 public DocumentType findByNameCaseInsensitive(String name) {
74 return (DocumentType) documentsByName.get(name);
75 }
76
77 public void versionAndSave(DocumentType documentType) {
78 addDocumentType(documentType, new MockPostProcessor(true));
79 }
80
81 public PostProcessor getPostProcessor(String documentTypeId) {
82 return (PostProcessor) postProcessors.get(documentTypeId);
83 }
84
85 public Collection findRouteLevels(String documentTypeId) {
86 return (Collection) ((DocumentType)documentsById.get(documentTypeId)).getRouteLevels();
87 }
88
89 public Collection find(DocumentType documentType, String docGroupName, boolean climbHiearchy) {
90 throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl");
91 }
92
93 public void delete(DocumentType documentType) {
94 documentsById.remove(documentType.getDocumentTypeId());
95 documentsByName.remove(documentType.getName());
96 }
97
98 public List findByRouteHeaderId (String documentId) {
99 throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl");
100 }
101 public void makeCurrent(String documentId) {
102 throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl");
103 }
104
105 public List findAllCurrentRootDocuments() {
106 return null;
107 }
108
109
110
111
112 public DocumentType findRootDocumentType(DocumentType docType) {
113 return null;
114 }
115 public void loadXml(InputStream inputStream, String principalId) {
116 throw new UnsupportedOperationException("Mock document type service can't load xml");
117 }
118 public Element export(ExportDataSet dataSet) {
119 return null;
120 }
121 @Override
122 public boolean supportPrettyPrint() {
123 return true;
124 }
125 public List findAllCurrent() {
126 return null;
127 }
128 public List getChildDocumentTypes(String documentTypeId) {
129 return null;
130 }
131 public DocumentType findByNameIgnoreCache(String documentTypeId) {
132 return null;
133 }
134 public void save(DocumentType documentType) {
135
136 }
137 public void save(DocumentType documentType, boolean flushCache) {
138
139 }
140 public void flushCache() {
141
142 }
143 public void clearCacheForAttributeUpdate(RuleAttribute ruleAttribute) {
144
145 }
146 public Integer getDocumentTypeCount() {
147 return null;
148 }
149 public List<DocumentType> findPreviousInstances(String documentTypeName) {
150 return null;
151 }
152
153 }