1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.pm.position.web;
17
18
19 import java.util.Map;
20
21 import javax.servlet.http.HttpServletRequest;
22 import javax.servlet.http.HttpServletResponse;
23
24 import org.apache.commons.lang.StringUtils;
25 import org.kuali.kpme.pm.position.Position;
26 import org.kuali.rice.kim.api.identity.Person;
27 import org.kuali.rice.krad.exception.AuthorizationException;
28 import org.kuali.rice.krad.maintenance.MaintenanceDocument;
29 import org.kuali.rice.krad.util.GlobalVariables;
30 import org.kuali.rice.krad.util.KRADConstants;
31 import org.kuali.rice.krad.web.controller.MaintenanceDocumentController;
32 import org.kuali.rice.krad.web.form.DocumentFormBase;
33 import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
34 import org.kuali.rice.krad.web.form.UifFormBase;
35 import org.springframework.stereotype.Controller;
36 import org.springframework.validation.BindingResult;
37 import org.springframework.web.bind.annotation.ModelAttribute;
38 import org.springframework.web.bind.annotation.RequestMapping;
39 import org.springframework.web.servlet.ModelAndView;
40
41 @Controller
42 @RequestMapping(value = "/positionMaintenance")
43 public class PositionController extends MaintenanceDocumentController {
44
45
46 @Override
47 @RequestMapping(params = "methodToCall=" + "setupMaintenance")
48 protected void setupMaintenance(MaintenanceDocumentForm form, HttpServletRequest request, String maintenanceAction) {
49 super.setupMaintenance(form, request, maintenanceAction);
50
51 if(KRADConstants.MAINTENANCE_EDIT_ACTION.equals(maintenanceAction)) {
52 MaintenanceDocument document = form.getDocument();
53 Position oldPosition = (Position) document.getOldMaintainableObject().getDataObject();
54 Position newPosition = (Position) document.getNewMaintainableObject().getDataObject();
55
56 Map<String, String[]> aMap = request.getParameterMap();
57 String[] aStringCol = aMap.get("category");
58 if(aStringCol.length != 0) {
59 String aString = aStringCol[0];
60 if(StringUtils.isNotEmpty(aString)) {
61 oldPosition.setCategory(aString);
62 newPosition.setCategory(aString);
63 }
64 }
65
66
67
68
69
70
71
72
73
74
75 document.getOldMaintainableObject().setDataObject(oldPosition);
76 document.getNewMaintainableObject().setDataObject(newPosition);
77 }
78 }
79
80 }