View Javadoc

1   /*
2    * Copyright 2005-2008 The Kuali Foundation
3    *
4    *
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.opensource.org/licenses/ecl2.php
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
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.kew.doctype.bo.DocumentType;
27  import org.kuali.rice.kew.doctype.service.DocumentTypeService;
28  import org.kuali.rice.kew.dto.DocumentTypeDTO;
29  import org.kuali.rice.kew.export.ExportDataSet;
30  import org.kuali.rice.kew.postprocessor.PostProcessor;
31  import org.kuali.rice.kew.rule.bo.RuleAttribute;
32  
33  
34  public class MockDocumentTypeServiceImpl implements DocumentTypeService {
35  
36      public DocumentType setDocumentTypeVersion(DocumentType documentType, boolean currentInd) {
37          return null;
38      }
39      public DocumentType getMostRecentDocType(String docTypeName) {
40          return null;
41      }
42      public boolean isLockedForRouting(DocumentType documentType) {
43          return false;
44      }
45      private Map documentsById = new HashMap();
46      private Map documentsByName = new HashMap();
47      private Map postProcessors = new HashMap();
48  
49      public void makeCurrent(List documentTypes) {
50          throw new UnsupportedOperationException("not yet implmeneted");
51      }
52  
53      public void addDocumentType(DocumentType documentType, PostProcessor postProcessor) {
54          documentsById.put(documentType.getDocumentTypeId(), documentType);
55          documentsByName.put(documentType.getName(), documentType);
56          postProcessors.put(documentType.getDocumentTypeId(), postProcessor);
57      }
58  
59      public DocumentType findByDocumentId(Long documentId) {
60  		throw new UnsupportedOperationException("not yet implemented");
61  	}
62  
63      public Integer getMaxVersionNumber(String name){
64          return new Integer(0);
65      }
66      public DocumentType findById(Long documentTypeId) {
67          return (DocumentType) documentsById.get(documentTypeId);
68      }
69  
70      public DocumentType findByName(String name) {
71          return (DocumentType) documentsByName.get(name);
72      }
73  
74      public DocumentType findByNameCaseInsensitive(String name) {
75          return (DocumentType) documentsByName.get(name);
76      }
77  
78      public void versionAndSave(DocumentType documentType) {
79          addDocumentType(documentType, new MockPostProcessor(true));
80      }
81  
82      public PostProcessor getPostProcessor(Long documentTypeId) {
83          return (PostProcessor) postProcessors.get(documentTypeId);
84      }
85  
86      public Collection findRouteLevels(Long documentTypeId) {
87          return (Collection) ((DocumentType)documentsById.get(documentTypeId)).getRouteLevels();
88      }
89  
90      public Collection find(DocumentType documentType, String docGroupName, boolean climbHiearchy) {
91          throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl");
92      }
93  
94      public void delete(DocumentType documentType) {
95          documentsById.remove(documentType.getDocumentTypeId());
96          documentsByName.remove(documentType.getName());
97      }
98  
99      public List findByRouteHeaderId(Long routeHeaderId) {
100         throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl");
101     }
102     public void makeCurrent(Long routeHeaderId) {
103         throw new UnsupportedOperationException("not implemented in MockDocumentTypeServiceImpl");
104     }
105 
106     public List findAllCurrentRootDocuments() {
107         return null;
108     }
109     public DocumentType getMostRecentDocType(Long documentTypeId) {
110         return null;
111     }
112     /* (non-Javadoc)
113      * @see org.kuali.rice.kew.doctype.DocumentTypeService#getDocumentTypeVO(java.lang.Long)
114      */
115     public DocumentTypeDTO getDocumentTypeVO(Long documentTypeId) {
116         return null;
117     }
118     /* (non-Javadoc)
119      * @see org.kuali.rice.kew.doctype.DocumentTypeService#getDocumentTypeVO(java.lang.String)
120      */
121     public DocumentTypeDTO getDocumentTypeVO(String documentTypeName) {
122         return null;
123     }
124     /* (non-Javadoc)
125      * @see org.kuali.rice.kew.doctype.DocumentTypeService#getRootDocumentType(org.kuali.rice.kew.doctype.DocumentType)
126      */
127     public DocumentType findRootDocumentType(DocumentType docType) {
128         return null;
129     }
130     public void loadXml(InputStream inputStream, String principalId) {
131         throw new UnsupportedOperationException("Mock document type service can't load xml");
132     }
133     public Element export(ExportDataSet dataSet) {
134         return null;
135     }
136     public List findAllCurrent() {
137         return null;
138     }
139 	public List getChildDocumentTypes(Long documentTypeId) {
140 		return null;
141 	}
142 	public DocumentType findByNameIgnoreCache(Long documentTypeId) {
143 		return null;
144 	}
145 	public void save(DocumentType documentType) {
146 
147 	}
148     public void save(DocumentType documentType, boolean flushCache) {
149 
150     }
151     public void flushCache() {
152 
153     }
154 	public void clearCacheForAttributeUpdate(RuleAttribute ruleAttribute) {
155 
156 	}
157 	public Integer getDocumentTypeCount() {
158 		return null;
159 	}
160     public List<DocumentType> findPreviousInstances(String documentTypeName) {
161         return null;
162     }
163 
164 }