KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > webapp > action > core > globalProperty > ListGlobalPropertiesAction


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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 com.blandware.atleap.webapp.action.core.globalProperty;
17
18 import com.blandware.atleap.common.Constants;
19 import com.blandware.atleap.model.core.GlobalProperty;
20 import com.blandware.atleap.service.core.GlobalPropertyManager;
21 import com.blandware.atleap.webapp.action.core.BaseAction;
22 import com.blandware.atleap.webapp.form.core.GlobalPropertyForm;
23 import org.apache.struts.action.ActionForm;
24 import org.apache.struts.action.ActionForward;
25 import org.apache.struts.action.ActionMapping;
26
27 import javax.servlet.http.HttpServletRequest JavaDoc;
28 import javax.servlet.http.HttpServletResponse JavaDoc;
29 import java.util.Iterator JavaDoc;
30 import java.util.List JavaDoc;
31
32 /**
33  * <p>Forward to the page with list of global properties
34  * </p>
35  * <p><a HREF="ListGlobalPropertiesAction.java.htm"><i>View Source</i></a></p>
36  * <p/>
37  *
38  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
39  * @version $Revision: 1.3 $ $Date: 2006/03/10 17:10:24 $
40  * @struts.action path="/core/globalProperty/list"
41  * name="globalPropertyForm"
42  * validate="false"
43  * roles="core-globalProperty-list"
44  * @struts.action-forward name="listGlobalProperties"
45  * path=".core.globalProperty.list"
46  */

47 public final class ListGlobalPropertiesAction extends BaseAction {
48     /**
49      * @param mapping The ActionMapping used to select this instance
50      * @param form The optional ActionForm bean for this request (if any)
51      * @param request The HTTP request we are proceeding
52      * @param response The HTTP response we are creating
53      * @return an ActionForward instance describing where and how
54      * control should be forwarded, or null if response
55      * has already been completed
56      */

57     public ActionForward execute(ActionMapping mapping, ActionForm form,
58                                  HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc {
59
60         GlobalPropertyManager globalPropertyManager = (GlobalPropertyManager) getBean(Constants.GLOBAL_PROPERTY_MANAGER_BEAN);
61
62         GlobalPropertyForm globalPropertyForm = (GlobalPropertyForm) form;
63
64         List JavaDoc dynamicProperties = globalPropertyManager.listDynamicProperties();
65         for ( Iterator JavaDoc i = dynamicProperties.iterator(); i.hasNext(); ) {
66             GlobalProperty globalProperty = (GlobalProperty) i.next();
67             String JavaDoc key = globalProperty.getName();
68             globalPropertyForm.setProperty(key, globalProperty.getValue());
69             globalPropertyForm.setVersion(key, globalProperty.getVersion());
70         }
71
72         // save transaction token in request
73
saveToken(request);
74         return mapping.findForward("listGlobalProperties");
75     }
76 }
Popular Tags