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