001/** 002 * Copyright 2005-2014 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.ksb.messaging.web; 017 018import org.apache.struts.action.ActionForm; 019import org.apache.struts.action.ActionForward; 020import org.apache.struts.action.ActionMapping; 021import org.apache.struts.action.ActionMessages; 022import org.kuali.rice.core.api.config.property.ConfigContext; 023import org.kuali.rice.core.api.util.ConcreteKeyValue; 024import org.kuali.rice.core.api.util.KeyValue; 025import org.kuali.rice.core.impl.config.property.ConfigLogger; 026 027import javax.servlet.http.HttpServletRequest; 028import javax.servlet.http.HttpServletResponse; 029import java.util.ArrayList; 030import java.util.List; 031import java.util.Properties; 032/** 033 * This is a description of what this class does - g don't forget to fill this in. 034 * 035 * @author Kuali Rice Team (rice.collab@kuali.org) 036 * 037 */ 038public class ConfigViewerAction extends KSBAction{ 039 040 /** 041 * This overridden method ... 042 * 043 * @see org.kuali.rice.ksb.messaging.web.KSBAction#establishRequiredState(javax.servlet.http.HttpServletRequest, org.apache.struts.action.ActionForm) 044 */ 045 @Override 046 public ActionMessages establishRequiredState(HttpServletRequest request, 047 ActionForm actionForm) throws Exception { 048 ConfigViewerForm form = (ConfigViewerForm)actionForm; 049 form.setProperties(this.getFilteredConfigList()); 050 051 return null; 052 } 053 054 protected List<KeyValue> getFilteredConfigList(){ 055 List<KeyValue> lRet = new ArrayList<KeyValue>(); 056 Properties p = ConfigContext.getCurrentContextConfig().getProperties(); 057 for(Object o: p.keySet()){ 058 String key = (String)o; 059 060 lRet.add(new ConcreteKeyValue(key,ConfigLogger.getDisplaySafeValue(key, p.getProperty(key)))); 061 } 062 return lRet; 063 } 064 065 /** 066 * This overridden method ... 067 * 068 * @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) 069 */ 070 @Override 071 public ActionForward start(ActionMapping mapping, ActionForm form, 072 HttpServletRequest request, HttpServletResponse response) 073 throws Exception { 074 return mapping.findForward("basic"); 075 } 076 077}