001    /**
002     * Copyright 2005-2013 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 edu.sampleu.demo.kitchensink;
017    
018    import org.apache.commons.lang.RandomStringUtils;
019    import org.kuali.rice.krad.util.GlobalVariables;
020    import org.kuali.rice.krad.web.controller.UifControllerBase;
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     * a controller for the configuration test view
033     *
034     * @author Kuali Rice Team (rice.collab@kuali.org)
035     */
036    @Controller
037    @RequestMapping(value = "/configuration-test-view-uif-controller")
038    public class ConfigurationTestViewUifController extends UifControllerBase {
039    
040        @Override
041        protected UifFormBase createInitialForm(HttpServletRequest request) {
042            return new UifComponentsTestForm();
043        }
044    
045        /**
046         * places a message containing apostrophes into the message map for display as a growl
047         */
048        @Override
049        @RequestMapping(params = "methodToCall=start")
050        public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form,
051                HttpServletRequest request, HttpServletResponse response) {
052            String randomYear = RandomStringUtils.randomNumeric(2);
053            GlobalVariables.getMessageMap().putInfo("growl.testing.apostrophe", "sampleapp.growl.testmsg", "'" + randomYear);
054    
055            return super.start(form, request, response);
056        }
057    }