001/** 002 * Copyright 2005-2015 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 */ 016package org.kuali.rice.krad.labs.ruleevent; 017 018import org.kuali.rice.krad.maintenance.MaintenanceDocument; 019import org.kuali.rice.krad.maintenance.MaintenanceDocumentController; 020import org.kuali.rice.krad.web.form.MaintenanceDocumentForm; 021import org.kuali.rice.krad.web.form.UifFormBase; 022import org.springframework.stereotype.Controller; 023import org.springframework.web.bind.annotation.RequestMapping; 024import org.springframework.web.servlet.ModelAndView; 025 026/** 027 * Set up a custom save method for the document controller to test custom save document event rule processing. 028 * 029 * @author Kuali Rice Team (rice.collab@kuali.org) 030 */ 031@Controller 032@RequestMapping( value = "/defaultRuleEvent" ) 033public class DefaultRuleEventController extends MaintenanceDocumentController { 034 035 @Override 036 @RequestMapping(params = "methodToCall=save") 037 public ModelAndView save(UifFormBase form) { 038 MaintenanceDocumentForm docForm = (MaintenanceDocumentForm) form; 039 MaintenanceDocument document = docForm.getDocument(); 040 041 RuleEventImpl event = new RuleEventImpl(document); 042 event.setName("Lab-RuleEventController"); 043 event.addFact("RuleEventSave", document.getDocumentDataObject()); 044 045 super.save(docForm, event); 046 047 return getModelAndView(form); 048 } 049}