1 package org.kuali.ole.describe.controller;
2
3 import org.kuali.ole.OLEConstants;
4 import org.kuali.ole.describe.service.impl.ExternalDSConfigMaintenanceDocumentServiceImpl;
5 import org.kuali.ole.service.OlePatronMaintenanceDocumentServiceImpl;
6 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
7 import org.kuali.rice.krad.maintenance.MaintenanceDocument;
8 import org.kuali.rice.krad.maintenance.MaintenanceUtils;
9 import org.kuali.rice.krad.service.MaintenanceDocumentService;
10 import org.kuali.rice.krad.web.controller.MaintenanceDocumentController;
11 import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
12 import org.springframework.stereotype.Controller;
13 import org.springframework.validation.BindingResult;
14 import org.springframework.web.bind.annotation.ModelAttribute;
15 import org.springframework.web.bind.annotation.RequestMapping;
16 import org.springframework.web.servlet.ModelAndView;
17
18 import javax.servlet.http.HttpServletRequest;
19 import javax.servlet.http.HttpServletResponse;
20
21
22
23
24
25
26
27
28
29 @Controller
30 @RequestMapping(value = "/externalDataSourceMaintenance")
31 public class OleExternalDSConfigMaintenanceDocumentController
32 extends MaintenanceDocumentController {
33 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(
34 OleExternalDSConfigMaintenanceDocumentController.class);
35
36
37
38
39
40
41
42
43
44
45
46 @RequestMapping(params = "methodToCall=" + "maintenanceDelete")
47 public ModelAndView maintenanceDelete(@ModelAttribute("KualiForm") MaintenanceDocumentForm form, BindingResult result,
48 HttpServletRequest request, HttpServletResponse response) throws Exception {
49 LOG.debug(" Inside maintenanceDelete ");
50 setupMaintenanceForDelete(form, request, OLEConstants.OleExternalDataSourceConfig.DATA_SOURCE_DELETE);
51 return getUIFModelAndView(form);
52 }
53
54
55
56
57
58
59
60
61 protected void setupMaintenanceForDelete(MaintenanceDocumentForm form, HttpServletRequest request,
62 String maintenanceAction) {
63 LOG.debug(" Inside setupMaintenanceForDelete ");
64 MaintenanceDocument document = form.getDocument();
65 if (document == null) {
66 document = getMaintenanceDocumentService()
67 .setupNewMaintenanceDocument(form.getDataObjectClassName(), form.getDocTypeName(),
68 maintenanceAction);
69
70 form.setDocument(document);
71 form.setDocTypeName(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
72 }
73
74 form.setMaintenanceAction(maintenanceAction);
75 ExternalDSConfigMaintenanceDocumentServiceImpl dataSourceService
76 = (ExternalDSConfigMaintenanceDocumentServiceImpl) getMaintenanceDocumentService();
77 dataSourceService.setupMaintenanceObjectForDelete(document, maintenanceAction, request.getParameterMap());
78 MaintenanceUtils.checkForLockingDocument(document, false);
79 }
80
81
82
83
84
85
86 @Override
87 protected MaintenanceDocumentService getMaintenanceDocumentService() {
88 return GlobalResourceLoader
89 .getService(OLEConstants.OleExternalDataSourceConfig.DATA_SOURCE_MAINTENANCE_DOC_SERVICE);
90 }
91
92 }