View Javadoc
1   package org.kuali.ole.describe.controller;
2   
3   import org.kuali.ole.OLEConstants;
4   import org.kuali.ole.describe.form.DocumentConfigForm;
5   import org.kuali.ole.docstore.common.client.DocstoreClientLocator;
6   import org.kuali.ole.docstore.common.document.config.*;
7   import org.kuali.ole.sys.context.SpringContext;
8   import org.kuali.rice.krad.service.BusinessObjectService;
9   import org.kuali.rice.krad.service.KRADServiceLocator;
10  import org.kuali.rice.krad.uif.UifParameters;
11  import org.kuali.rice.krad.util.GlobalVariables;
12  import org.kuali.rice.krad.util.KRADConstants;
13  import org.kuali.rice.krad.web.controller.UifControllerBase;
14  import org.kuali.rice.krad.web.form.UifFormBase;
15  import org.slf4j.Logger;
16  import org.slf4j.LoggerFactory;
17  import org.springframework.stereotype.Controller;
18  import org.springframework.validation.BindingResult;
19  import org.springframework.web.bind.annotation.ModelAttribute;
20  import org.springframework.web.bind.annotation.RequestMapping;
21  import org.springframework.web.servlet.ModelAndView;
22  
23  import javax.servlet.http.HttpServletRequest;
24  import javax.servlet.http.HttpServletResponse;
25  import java.util.*;
26  
27  /**
28   * Created with IntelliJ IDEA.
29   * User: chandrasekharag
30   * Date: 4/3/14
31   * Time: 6:40 PM
32   * To change this template use File | Settings | File Templates.
33   */
34  @Controller
35  @RequestMapping(value = "/documentconfigcontroller")
36  public class DocumentConfigController extends UifControllerBase {
37      private static final Logger LOG = LoggerFactory
38              .getLogger(DocumentConfigController.class);
39  
40      private DocstoreClientLocator docstoreClientLocator = null ;
41      public DocstoreClientLocator getDocstoreClientLocator() {
42          if (null == docstoreClientLocator) {
43              return  SpringContext.getBean(DocstoreClientLocator.class);
44          }
45          return docstoreClientLocator;
46      }
47  
48      private BusinessObjectService businessObjectService;
49  
50      public BusinessObjectService getBusinessObjectService() {
51          if (null == businessObjectService) {
52              businessObjectService = KRADServiceLocator.getBusinessObjectService();
53          }
54          return businessObjectService;
55      }
56      @Override
57      protected UifFormBase createInitialForm(HttpServletRequest request) {
58          return new DocumentConfigForm();  //To change body of implemented methods use File | Settings | File Templates.
59      }
60  
61      @Override
62      @RequestMapping(params = "methodToCall=start")
63      public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
64                                HttpServletRequest request, HttpServletResponse response) {
65  
66          DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
67          if (documentConfigForm.getDocTypeConfigList().size() == 0) {
68              List<DocTypeConfig> docTypeConfigList = (List<DocTypeConfig>) getBusinessObjectService().findAll(DocTypeConfig.class);
69              documentConfigForm.setDocTypeConfigList(docTypeConfigList);
70          }
71  
72          if (documentConfigForm.getDocFormatConfigList().size() == 0) {
73              //  List<DocFormatConfig> docFormatConfigList = (List<DocFormatConfig>) getBusinessObjectService().findAll(DocFormatConfig.class);
74              // documentConfigForm.setDocFormatConfigList(docFormatConfigList);
75          }
76  
77          if (documentConfigForm.getDocFieldConfigList().size() == 0) {
78  
79              // List<DocFieldConfig> docFieldConfigList = (List<DocFieldConfig>) getBusinessObjectService().findAll(DocFieldConfig.class);
80              //  documentConfigForm.setDocFieldConfigList(docFieldConfigList);
81  
82          }
83  
84          if (documentConfigForm.getSearchResultPageList().size() == 0) {
85              List<SearchResultPage> searchResultPageList = (List<SearchResultPage>) getBusinessObjectService().findAll(SearchResultPage.class);
86  
87              documentConfigForm.setSearchResultPageList(searchResultPageList);
88  
89          }
90  
91          if (documentConfigForm.getSearchFacetPage() == null) {
92              List<SearchFacetPage> searchFacetPageList = (List<SearchFacetPage>) getBusinessObjectService().findAll(SearchFacetPage.class);
93              if (searchFacetPageList.size() > 0) {
94                  documentConfigForm.setSearchFacetPage(searchFacetPageList.get(0));
95              }
96          }
97          return super.navigate(documentConfigForm, result, request, response);
98      }
99  
100 
101     @Override
102     @RequestMapping(params = "methodToCall=refresh")
103     public ModelAndView refresh(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
104                                 HttpServletRequest request, HttpServletResponse response) {
105 
106         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
107         String docType = documentConfigForm.getDocFormatDocType();
108         HashMap hashMap = new HashMap();
109         hashMap.put("name", docType);
110         DocTypeConfig docTypeConfig = (DocTypeConfig) getBusinessObjectService().findByPrimaryKey(DocTypeConfig.class, hashMap);
111         if (docTypeConfig != null) {
112             Integer docTypeId = docTypeConfig.getId();
113             HashMap hashMapDocFormat = new HashMap();
114             hashMapDocFormat.put("docTypeId", docTypeId);
115             List<DocFormatConfig> docFormatConfigList = (List<DocFormatConfig>) getBusinessObjectService().findMatching(DocFormatConfig.class, hashMapDocFormat);
116             documentConfigForm.setDocFormatConfigList(docFormatConfigList);
117         }
118         return super.navigate(documentConfigForm, result, request, response);
119     }
120 
121     @RequestMapping(params = "methodToCall=saveDocType")
122     public ModelAndView saveDocType(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
123                                     HttpServletRequest request, HttpServletResponse response) {
124 
125         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
126         List<DocTypeConfig> docTypeConfigList = documentConfigForm.getDocTypeConfigList();
127         List<Integer> insertList = new ArrayList<>();
128         List<Integer> deleteList = new ArrayList<>();
129         List<DocTypeConfig> docTypeConfigListDB = (List<DocTypeConfig>) getBusinessObjectService().findAll(DocTypeConfig.class);
130         for (DocTypeConfig docTypeConfig : docTypeConfigList) {
131             Integer docTypeId = docTypeConfig.getId(); //1234
132             insertList.add(docTypeId);
133         }
134         for (DocTypeConfig docTypeConfig1 : docTypeConfigListDB) {
135             Integer id = docTypeConfig1.getId();//123456  56
136             deleteList.add(id);
137         }
138         for (int i = 0; i < deleteList.size(); i++) {
139             if (!insertList.contains(deleteList.get(i))) {
140                 Map map = new HashMap();
141                 Map mapFormat = new HashMap();
142                 map.put("id", deleteList.get(i));
143                 mapFormat.put("docTypeId", deleteList.get(i));
144                 getBusinessObjectService().deleteMatching(DocFieldConfig.class, mapFormat);
145                 getBusinessObjectService().deleteMatching(DocFormatConfig.class, mapFormat);
146                 getBusinessObjectService().deleteMatching(DocTypeConfig.class, map);
147             }
148         }
149         getBusinessObjectService().save(docTypeConfigList);
150         reload(documentConfigForm, result, request, response);
151         GlobalVariables.getMessageMap().putInfoForSectionId("DocTypeConfig", OLEConstants.DOC_TYPES_SAVED);
152        // GlobalVariables.getMessageMap().putErrorForSectionId("DocumentConfigMessageSection", OLEConstants.DOC_TYPES_SAVED);
153         return super.navigate(documentConfigForm, result, request, response);
154     }
155 
156     @RequestMapping(params = "methodToCall=saveDocFormat")
157     public ModelAndView saveDocFormat(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
158                                       HttpServletRequest request, HttpServletResponse response) {
159 
160         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
161         List<DocFormatConfig> docFormatConfigList = documentConfigForm.getDocFormatConfigList();
162         List<Integer> insertList = new ArrayList<>();
163         List<Integer> deleteList = new ArrayList<>();
164         HashMap hashMap = new HashMap();
165         String dataFormatDocType = documentConfigForm.getDocFormatDocType();
166         if (!"".equals(dataFormatDocType)) {
167             hashMap.put("name", dataFormatDocType);
168             DocTypeConfig docTypeConfig = (DocTypeConfig) getBusinessObjectService().findByPrimaryKey(DocTypeConfig.class, hashMap);
169             Integer docTypeId= docTypeConfig.getId();
170             for(int i=0;i<docFormatConfigList.size();i++){
171                 docFormatConfigList.get(i).setDocTypeId(docTypeId);
172             }
173             Map map1 = new HashMap();
174             map1.put("docTypeId", docTypeConfig.getId());
175 
176             List<DocFormatConfig> docFormatConfigListDB = (List<DocFormatConfig>) getBusinessObjectService().findMatching(DocFormatConfig.class, map1);
177             for (DocFormatConfig docFormatConfig : docFormatConfigList) {
178                 Integer formatDocTypeId = docFormatConfig.getId(); //1234
179                 insertList.add(formatDocTypeId);
180             }
181             for (DocFormatConfig docFormatConfig : docFormatConfigListDB) {
182                 Integer id = docFormatConfig.getId();//123456  56
183                 deleteList.add(id);
184             }
185             for (int i = 0; i < deleteList.size(); i++) {
186                 if (!insertList.contains(deleteList.get(i))) {
187                     Map mapDocField = new HashMap();
188                     Map mapFormat = new HashMap();
189                     mapDocField.put("docFormatId", deleteList.get(i));
190                     // mapFormat.put("docTypeId", deleteList.get(i));
191                     mapFormat.put("id", deleteList.get(i));
192                     mapDocField.put("docTypeId", docTypeConfig.getId());
193                     getBusinessObjectService().deleteMatching(DocFieldConfig.class, mapDocField);
194                     getBusinessObjectService().deleteMatching(DocFormatConfig.class, mapFormat);
195                 }
196             }
197             getBusinessObjectService().save(docFormatConfigList);
198             GlobalVariables.getMessageMap().putInfo("DocFormatConfig", OLEConstants.DOC_FORMAT_SAVED);
199             //GlobalVariables.getMessageMap().putErrorForSectionId("DocumentConfigMessageSection", OLEConstants.DOC_FORMAT_SAVED);
200             reload(documentConfigForm, result, request, response);
201         }
202         return super.navigate(documentConfigForm, result, request, response);
203     }
204 
205 
206     @RequestMapping(params = "methodToCall=saveDocField")
207     public ModelAndView saveDocField(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
208                                      HttpServletRequest request, HttpServletResponse response) {
209 
210         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
211         List<DocFieldConfig> docFieldConfigListDB = new ArrayList<>();
212         List<DocFieldConfig> docFieldConfigList = documentConfigForm.getDocFieldConfigList();
213         List<Integer> insertList = new ArrayList<>();
214         List<Integer> deleteList = new ArrayList<>();
215         String dataFormatDocType = documentConfigForm.getDocFieldDocType();
216         String docFormat = documentConfigForm.getDocFormat();
217         if (!"".equals(dataFormatDocType) && !"".equals(docFormat)) {
218             Map docTypeMap = new HashMap();
219             docTypeMap.put("name", dataFormatDocType);
220             List<DocTypeConfig> docTypeConfigList = (List<DocTypeConfig>) getBusinessObjectService().findMatching(DocTypeConfig.class, docTypeMap);
221             if (docTypeConfigList.size() > 0) {
222                 int docTypeId = docTypeConfigList.get(0).getId();
223                 Map docFormatMap = new HashMap();
224                 docFormatMap.put("name", docFormat);
225                 docFormatMap.put("docTypeId", docTypeId);
226                 List<DocFormatConfig> docFormatConfigList = (List<DocFormatConfig>) getBusinessObjectService().findMatching(DocFormatConfig.class, docFormatMap);
227                 if (docFormatConfigList.size() > 0) {
228                     int docFormatId = docFormatConfigList.get(0).getId();
229                     Map docFieldMap = new HashMap();
230                     docFieldMap.put("docTypeId", docTypeId);
231                     docFieldMap.put("docFormatId", docFormatId);
232 
233                     for (int i = 0; i < docFieldConfigList.size(); i++) {
234                         docFieldConfigList.get(i).setDocTypeId(docTypeId);
235                         docFieldConfigList.get(i).setDocFormatId(docFormatId);
236                     }
237 
238                     docFieldConfigListDB = (List<DocFieldConfig>) getBusinessObjectService().findMatching(DocFieldConfig.class, docFieldMap);
239 
240                     for (DocFieldConfig docFieldConfig : docFieldConfigList) {
241                         insertList.add(docFieldConfig.getId());
242                     }
243                     for (DocFieldConfig docFieldConfig : docFieldConfigListDB) {
244                         Integer id = docFieldConfig.getId();
245                         deleteList.add(id);
246                     }
247                     for (int i = 0; i < deleteList.size(); i++) {
248                         if (!insertList.contains(deleteList.get(i))) {
249                             Map mapDocField = new HashMap();
250                             mapDocField.put("id", deleteList.get(i));
251                             getBusinessObjectService().deleteMatching(DocFieldConfig.class, mapDocField);
252                         }
253                     }
254                 }
255             }
256         }
257         getBusinessObjectService().save(docFieldConfigList);
258         reload(documentConfigForm, result, request, response);
259         GlobalVariables.getMessageMap().putInfo("DocField-searchParams-Section", OLEConstants.DOC_FIELDS_SAVED);
260        // GlobalVariables.getMessageMap().putErrorForSectionId("DocumentConfigMessageSection", OLEConstants.DOC_FIELDS_SAVED);
261         return super.navigate(documentConfigForm, result, request, response);
262     }
263 
264     @RequestMapping(params = "methodToCall=refreshforDocField")
265     public ModelAndView refreshforDocField(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
266                                            HttpServletRequest request, HttpServletResponse response) {
267 
268         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
269         Map docTypeMap = new HashMap();
270         docTypeMap.put("name", documentConfigForm.getDocFieldDocType());
271         List<DocTypeConfig> docTypeConfigList = (List<DocTypeConfig>) getBusinessObjectService().findMatching(DocTypeConfig.class, docTypeMap);
272         if (docTypeConfigList.size() > 0) {
273             int docTypeId = docTypeConfigList.get(0).getId();
274             String docFormat = documentConfigForm.getDocFormat();
275             Map docFormatMap = new HashMap();
276             docFormatMap.put("name", docFormat);
277             docFormatMap.put("docTypeId",docTypeId);
278             List<DocFormatConfig> docFormatConfigList = (List<DocFormatConfig>) getBusinessObjectService().findMatching(DocFormatConfig.class, docFormatMap);
279             if (docFormatConfigList.size() > 0) {
280                 int docFormatId = docFormatConfigList.get(0).getId();
281                 Map docFieldMap = new HashMap();
282                 docFieldMap.put("docTypeId",docTypeId);
283                 docFieldMap.put("docFormatId", docFormatId);
284                 List<DocFieldConfig> docFieldConfigList = (List<DocFieldConfig>) getBusinessObjectService().findMatching(DocFieldConfig.class, docFieldMap);
285                 if (docFieldConfigList.size() > 0) {
286                     documentConfigForm.setDocFieldConfigList(docFieldConfigList);
287                 }
288             }else{
289                 documentConfigForm.setDocFieldConfigList(null);
290             }
291         }
292         return super.navigate(documentConfigForm, result, request, response);
293     }
294 
295 
296     @RequestMapping(params = "methodToCall=refreshforDocFormat")
297     public ModelAndView refreshforDocFormat(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
298                                            HttpServletRequest request, HttpServletResponse response) {
299 
300         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
301         documentConfigForm.setDocFormatConfigList(null);
302         documentConfigForm.setDocFieldConfigList(null);
303         return super.navigate(documentConfigForm, result, request, response);
304     }
305 
306     @RequestMapping(params = "methodToCall=saveSearchResultPage")
307     public ModelAndView saveSearchResultPage(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
308                                              HttpServletRequest request, HttpServletResponse response) {
309 
310         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
311         List<SearchResultPage> searchResultPageListDB = new ArrayList<>();
312         List<SearchResultPage> searchResultPageList = documentConfigForm.getSearchResultPageList();
313         List<Integer> insertList = new ArrayList<>();
314         List<Integer> deleteList = new ArrayList<>();
315         List<Integer> duplicateList = new ArrayList<>();
316         List<SearchResultPage> searchResultPages =new ArrayList<>();
317         searchResultPageListDB = (List<SearchResultPage>) getBusinessObjectService().findAll(SearchResultPage.class);
318         for (SearchResultPage searchResultPage : searchResultPageList) {
319             Integer docTypeId = searchResultPage.getId(); //1234
320             duplicateList.add(searchResultPage.getSize());
321             insertList.add(docTypeId);
322         }
323         for (SearchResultPage searchResultPage : searchResultPageListDB) {
324             Integer id = searchResultPage.getId();//123456  56
325             deleteList.add(id);
326         }
327         Set<Integer> duplicateSize = findDuplicates(duplicateList);
328         if (duplicateSize.size() == 0) {
329             for (int i = 0; i < deleteList.size(); i++) {
330                 if (insertList.contains(deleteList.get(i))) {
331                     Map mapDocField = new HashMap();
332                     mapDocField.put("id", deleteList.get(i));
333                     getBusinessObjectService().deleteMatching(SearchResultPage.class, mapDocField);
334                 }
335             }
336             for(SearchResultPage searchResultPage:searchResultPageList){
337                 if(searchResultPage.getSize()!=null){
338                 searchResultPages.add((searchResultPage));
339                 }
340             }
341             getBusinessObjectService().save(searchResultPages);
342             documentConfigForm.setSearchResultPageList(searchResultPages);
343             reload(documentConfigForm, result, request, response);
344             GlobalVariables.getMessageMap().putInfo("OLESearchResultPageConfigSearch-search-parentBean", OLEConstants.DOC_SEARCH_RESULT_SAVED);
345         } else {
346             GlobalVariables.getMessageMap().putInfo("OLESearchResultPageConfigSearch-search-parentBean", OLEConstants.DOC_SEARCH_RESULT_DUPLICATE);
347         }
348         // GlobalVariables.getMessageMap().putErrorForSectionId("DocumentConfigMessageSection", OLEConstants.DOC_SEARCH_RESULT_SAVED);
349         return super.navigate(documentConfigForm, result, request, response);
350     }
351     public Set<Integer> findDuplicates(List<Integer> duplicateList) {
352 
353         final Set<Integer> duplicateSet = new HashSet<Integer>();
354         final Set<Integer> setIdList = new HashSet<Integer>();
355 
356         for (Integer duplicateInt : duplicateList) {
357             if (!setIdList.add(duplicateInt) && duplicateInt!=null) {
358                 duplicateSet.add(duplicateInt);
359             }
360         }
361         return duplicateSet;
362     }
363 
364 
365     @RequestMapping(params = "methodToCall=saveFacetPage")
366     public ModelAndView saveFacetPage(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
367                                       HttpServletRequest request, HttpServletResponse response) {
368 
369         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
370         SearchFacetPage searchFacetPage = documentConfigForm.getSearchFacetPage();
371         getBusinessObjectService().save(searchFacetPage);
372         reload(documentConfigForm, result, request, response);
373         GlobalVariables.getMessageMap().putInfo("OLEFacetPageConfigSearch-search-parentBean", OLEConstants.DOC_FACET_PAGE_SAVED);
374        // GlobalVariables.getMessageMap().putErrorForSectionId("DocumentConfigMessageSection", OLEConstants.DOC_FACET_PAGE_SAVED);
375         return super.navigate(documentConfigForm, result, request, response);
376     }
377 
378     @RequestMapping(params = "methodToCall=reload")
379     public ModelAndView reload(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
380                                       HttpServletRequest request, HttpServletResponse response) {
381 
382         DocumentSearchConfig.reloadDocumentConfig();
383 
384         try {
385             getDocstoreClientLocator().getDocstoreClient().reloadConfiguration();
386         } catch (Exception e) {
387             LOG.error(e.getMessage());
388         }
389         return super.navigate(form, result, request, response);
390     }
391 
392     @RequestMapping(params = "methodToCall=resetDocTypes")
393     public ModelAndView resetDocTypes(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
394                                HttpServletRequest request, HttpServletResponse response) {
395         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
396             List<DocTypeConfig> docTypeConfigList = (List<DocTypeConfig>) getBusinessObjectService().findAll(DocTypeConfig.class);
397             documentConfigForm.setDocTypeConfigList(docTypeConfigList);
398         return super.navigate(form, result, request, response);
399     }
400 
401 
402     @RequestMapping(params = "methodToCall=resetDocFormats")
403     public ModelAndView resetDocFormats(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
404                                       HttpServletRequest request, HttpServletResponse response) {
405         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
406         Map docTypeMap = new HashMap();
407         docTypeMap.put("name",documentConfigForm.getDocFormatDocType());
408         List<DocTypeConfig> docTypeConfigList = (List<DocTypeConfig>) getBusinessObjectService().findMatching(DocTypeConfig.class,docTypeMap);
409         Integer docTypeId= docTypeConfigList.get(0).getId();
410         HashMap hashMapDocFormat = new HashMap();
411         hashMapDocFormat.put("docTypeId", docTypeId);
412         List<DocFormatConfig> docFormatConfigList = (List<DocFormatConfig>) getBusinessObjectService().findMatching(DocFormatConfig.class, hashMapDocFormat);
413         documentConfigForm.setDocFormatConfigList(docFormatConfigList);
414         return super.navigate(form, result, request, response);
415     }
416 
417 
418     @RequestMapping(params = "methodToCall=resetDocFields")
419     public ModelAndView resetDocFields(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
420                                         HttpServletRequest request, HttpServletResponse response) {
421         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
422         Map docTypeMap = new HashMap();
423         docTypeMap.put("name",documentConfigForm.getDocFieldDocType());
424         List<DocTypeConfig> docTypeConfigList = (List<DocTypeConfig>) getBusinessObjectService().findMatching(DocTypeConfig.class,docTypeMap);
425         Integer docTypeId= docTypeConfigList.get(0).getId();
426         String docFormat= documentConfigForm.getDocFormat();
427         HashMap hashMapDocFormat = new HashMap();
428         hashMapDocFormat.put("docTypeId", docTypeId);
429         hashMapDocFormat.put("name",docFormat);
430         List<DocFormatConfig> docFormatConfigList = (List<DocFormatConfig>) getBusinessObjectService().findMatching(DocFormatConfig.class, hashMapDocFormat);
431         if (docFormatConfigList.size() > 0) {
432             int docFormatId = docFormatConfigList.get(0).getId();
433             Map docFieldMap = new HashMap();
434             docFieldMap.put("docTypeId",docTypeId);
435             docFieldMap.put("docFormatId", docFormatId);
436             List<DocFieldConfig> docFieldConfigList = (List<DocFieldConfig>) getBusinessObjectService().findMatching(DocFieldConfig.class, docFieldMap);
437             if (docFieldConfigList.size() > 0) {
438                 documentConfigForm.setDocFieldConfigList(docFieldConfigList);
439             } else {
440                 documentConfigForm.setDocFieldConfigList(null);
441             }
442         }else{
443             documentConfigForm.setDocFieldConfigList(null);
444         }
445         documentConfigForm.setDocFormatConfigList(docFormatConfigList);
446         return super.navigate(form, result, request, response);
447     }
448 
449     @RequestMapping(params = "methodToCall=resetSearchResultPage")
450     public ModelAndView resetSearchResultPage(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
451                                        HttpServletRequest request, HttpServletResponse response) {
452         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
453         List<SearchResultPage> searchResultPageList = (List<SearchResultPage>) getBusinessObjectService().findAll(SearchResultPage.class);
454         documentConfigForm.setSearchResultPageList(searchResultPageList);
455         return super.navigate(form, result, request, response);
456     }
457 
458 
459     @RequestMapping(params = "methodToCall=resetFacetPage")
460     public ModelAndView resetFacetPage(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
461                                       HttpServletRequest request, HttpServletResponse response) {
462         DocumentConfigForm documentConfigForm = (DocumentConfigForm) form;
463         List<SearchFacetPage> searchFacetPageList = (List<SearchFacetPage>) getBusinessObjectService().findAll(SearchFacetPage.class);
464         if (searchFacetPageList.size() > 0) {
465             documentConfigForm.setSearchFacetPage(searchFacetPageList.get(0));
466         }
467         return super.navigate(form, result, request, response);
468     }
469 
470 }