001 /**
002 * Copyright 2005-2011 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.kew.impl.peopleflow;
017
018 import org.apache.commons.lang.StringUtils;
019 import org.kuali.rice.krad.web.controller.MaintenanceDocumentController;
020 import org.kuali.rice.krad.web.form.MaintenanceForm;
021 import org.kuali.rice.krad.web.form.UifFormBase;
022 import org.springframework.stereotype.Controller;
023 import org.springframework.validation.BindingResult;
024 import org.springframework.web.bind.annotation.ModelAttribute;
025 import org.springframework.web.bind.annotation.RequestMapping;
026 import org.springframework.web.servlet.ModelAndView;
027
028 import javax.servlet.http.HttpServletRequest;
029 import javax.servlet.http.HttpServletResponse;
030
031 /**
032 * Controller for the people flow maintenance document
033 *
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036 @Controller
037 @RequestMapping(value = "/peopleFlowMaintenance")
038 public class PeopleFlowController extends MaintenanceDocumentController {
039
040 /**
041 * Invoked for the refresh of the type attributes group to prepare the type attribute bos for the peopleflow
042 */
043 @RequestMapping(params = "methodToCall=" + "prepareTypeAttributes")
044 public ModelAndView prepareTypeAttributes(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
045 HttpServletRequest request, HttpServletResponse response) throws Exception {
046 MaintenanceForm maintenanceForm = (MaintenanceForm) form;
047
048 PeopleFlowBo peopleFlow =
049 (PeopleFlowBo) maintenanceForm.getDocument().getNewMaintainableObject().getDataObject();
050 if (StringUtils.isNotBlank(peopleFlow.getTypeId())) {
051 peopleFlow.rebuildTypeAttributes();
052 }
053
054 return super.updateComponent(form, result, request, response);
055 }
056
057 }