/**
 * Copyright 2005-2014 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.krad.labs.ruleevent;

import org.kuali.rice.krad.maintenance.MaintenanceDocument;
import org.kuali.rice.krad.maintenance.MaintenanceDocumentController;
import org.kuali.rice.krad.web.form.DocumentFormBase;
import org.kuali.rice.krad.web.form.MaintenanceDocumentForm;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Setup a custom save method for the document controller to test custom save document event rule processing
 *
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
@Controller
@RequestMapping( value = "/defaultRuleEvent" )
public class DefaultRuleEventController extends MaintenanceDocumentController {

    @Override
    @RequestMapping(params = "methodToCall=save")
    public ModelAndView save(DocumentFormBase form) {
        MaintenanceDocumentForm docForm = (MaintenanceDocumentForm) form;
        MaintenanceDocument document = docForm.getDocument();

        RuleEventImpl event = new RuleEventImpl(document);
        event.setName("Lab-RuleEventController");
        event.addFact("RuleEventSave", document.getDocumentDataObject());

        super.save(docForm);

        return getModelAndView(form);
    }
}

@@ -845,16 +845,27 @@
 eb.form.
+Maintenance
 Document
@@ -868,20 +868,16 @@
 mentForm
-Base
 ;%0D%0Aimpor
@@ -907,39 +907,27 @@
 eb.form.
-MaintenanceDocumentForm
+UifFormBase
 ;%0D%0Aimpor
@@ -1507,24 +1507,19 @@
 ew save(
-Document
+Uif
 FormBase

Change signature of document save method so it overrides the introduced save method of uif controller base