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