View Javadoc
1   /**
2    * Copyright 2005-2016 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ksb.messaging.web;
17  
18  import org.apache.struts.action.ActionForm;
19  import org.apache.struts.action.ActionForward;
20  import org.apache.struts.action.ActionMapping;
21  import org.apache.struts.action.ActionMessages;
22  import org.kuali.rice.core.api.config.property.ConfigContext;
23  import org.kuali.rice.core.api.util.ConcreteKeyValue;
24  import org.kuali.rice.core.api.util.KeyValue;
25  import org.kuali.rice.core.impl.config.property.ConfigLogger;
26  
27  import javax.servlet.http.HttpServletRequest;
28  import javax.servlet.http.HttpServletResponse;
29  import java.util.ArrayList;
30  import java.util.List;
31  import java.util.Properties;
32  /**
33   * This is a description of what this class does - g don't forget to fill this in. 
34   * 
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   *
37   */
38  public class ConfigViewerAction extends KSBAction{
39  
40  	/**
41  	 * This overridden method ...
42  	 * 
43  	 * @see org.kuali.rice.ksb.messaging.web.KSBAction#establishRequiredState(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionForm)
44  	 */
45  	@Override
46  	public ActionMessages establishRequiredState(HttpServletRequest request,
47  			ActionForm actionForm) throws Exception {
48  		ConfigViewerForm  form = (ConfigViewerForm)actionForm;
49  		form.setProperties(this.getFilteredConfigList());
50  				
51  		return null;
52  	}
53  	
54  	protected List<KeyValue> getFilteredConfigList(){
55  		List<KeyValue> lRet = new ArrayList<KeyValue>();
56  		Properties p = ConfigContext.getCurrentContextConfig().getProperties();
57  		for(Object o: p.keySet()){
58  			String key = (String)o;			
59  			
60  			lRet.add(new ConcreteKeyValue(key,ConfigLogger.getDisplaySafeValue(key, p.getProperty(key))));			
61  		}
62  		return lRet;
63  	}
64  
65  	/**
66  	 * This overridden method ...
67  	 * 
68  	 * @see org.kuali.rice.ksb.messaging.web.KSBAction#start(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
69  	 */
70  	@Override
71  	public ActionForward start(ActionMapping mapping, ActionForm form,
72  			HttpServletRequest request, HttpServletResponse response)
73  			throws Exception {
74  		return mapping.findForward("basic");
75  	}
76  
77  }