KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javabb > action > ForumAction


1 package org.javabb.action;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.List JavaDoc;
5
6 import org.javabb.action.infra.BaseAction;
7 import org.javabb.transaction.ForumTransaction;
8 import org.javabb.vh.ForumConfigView;
9 import org.javabb.vo.Forum;
10
11 /*
12  * Copyright 2004 JavaFree.org
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  */

26
27 /**
28  * $Id: ForumAction.java,v 1.20.2.1.4.2 2006/04/17 17:47:06 daltoncamargo Exp $
29  * @author Dalton Camargo - <a HREF="mailto:dalton@javabb.org">dalton@javabb.org </a> <br>
30  * @author Ronald Tetsuo Miura
31  * @author Lucas Teixeira - <a HREF="mailto:lucas@javabb.org">lucas@javabb.org </a> <br>
32  */

33 public class ForumAction extends BaseAction {
34
35     private ForumConfigView forumConfigView = new ForumConfigView();
36     
37     protected Forum forum = new Forum();
38
39     protected ForumTransaction forumTransaction;
40
41     protected List JavaDoc forums = new ArrayList JavaDoc();
42
43     private int removeForum = 0;
44
45     // Temas (pastas)
46
private List JavaDoc themes = new ArrayList JavaDoc();
47     private List JavaDoc langs;
48     // Buttons Language
49
private List JavaDoc btnLang = new ArrayList JavaDoc();
50
51     // ####################################################################
52
// Parameters
53
// ####################################################################
54

55     //Parameters to sort foruns (Admin Painel)
56
private Integer JavaDoc destOrder;
57     private Integer JavaDoc position;
58     
59     /**
60      * @param removeForum The removeForum to set.
61      */

62     public void setRemoveForum(int removeForum) {
63         this.removeForum = removeForum;
64     }
65
66     // ####################################################################
67
// Dependencies
68
// ####################################################################
69

70
71     /**
72      * @param forumTransaction the new forumTransaction value
73      */

74     public void setForumTransaction(ForumTransaction forumTransaction) {
75         this.forumTransaction = forumTransaction;
76     }
77
78     // ####################################################################
79
// View objects accessors
80
// ####################################################################
81

82     /**
83      * @return result
84      * @throws Exception
85      */

86     public String JavaDoc forumConfig() throws Exception JavaDoc {
87         btnLang = forumTransaction.listButtons();
88         //langs = forumTransaction.listLangs();
89
return SUCCESS;
90     }
91     
92     /**
93      * @return action status
94      * @throws Exception
95      */

96     public String JavaDoc listaForum() throws Exception JavaDoc {
97         forums = forumTransaction.findAll();
98         return SUCCESS;
99     }
100
101     /**
102      * @return action status
103      * @throws Exception
104      */

105     public String JavaDoc loadForum() throws Exception JavaDoc {
106         forum = forumTransaction.loadForum(forum.getId());
107         return SUCCESS;
108     }
109
110     /**
111      * @return action status
112      * @throws Exception
113      */

114     public String JavaDoc updateForum() throws Exception JavaDoc {
115         forumTransaction.update(forum.getIdForum(), forum);
116         return SUCCESS;
117     }
118
119     /**
120      * @return action status
121      * @throws Exception
122      */

123     public String JavaDoc insertForum() throws Exception JavaDoc {
124         forumTransaction.insertForum(forum);
125         return SUCCESS;
126     }
127
128     /**
129      * @return action status
130      * @throws Exception
131      */

132     public String JavaDoc deleteForum() throws Exception JavaDoc {
133         if (removeForum != -1) {
134             forumTransaction.transferForum(forum, removeForum);
135         }
136         forumTransaction.deleteForum(forum);
137         return SUCCESS;
138     }
139
140     public String JavaDoc sortForum() throws Exception JavaDoc {
141         forumTransaction.sortForuns(_categoryId, destOrder, position);
142         return SUCCESS;
143     }
144     
145     
146     /**
147      * @return result
148      * @throws Exception
149      */

150     public String JavaDoc saveForumConfig() throws Exception JavaDoc {
151         forumTransaction.saveConfigForum(forumConfigView);
152         return SUCCESS;
153     }
154     
155     public String JavaDoc sortUserRankByForum() throws Exception JavaDoc {
156         forumTransaction.refreshForumUserRank();
157         return SUCCESS;
158     }
159
160     
161     // ####################################################################
162
// View objects accessors
163
// ####################################################################
164

165     /**
166      * @return Returns the forum.
167      */

168     public Forum getForum() {
169         return forum;
170     }
171
172     /**
173      * @return Returns the forums.
174      */

175     public List JavaDoc getForums() {
176         return forums;
177     }
178
179     /**
180      * @return Returns the removeForum.
181      */

182     public int getRemoveForum() {
183         return removeForum;
184     }
185
186     /**
187      * @return Returns the themes.
188      */

189     public List JavaDoc getThemes() {
190         return themes;
191     }
192
193     /**
194      * @return Returns the langs.
195      */

196     public List JavaDoc getLangs() {
197         return langs;
198     }
199     /**
200      * @return Returns the forumConfigView.
201      */

202     public ForumConfigView getForumConfigView() {
203         return forumConfigView;
204     }
205     /**
206      * @return Returns the destOrder.
207      */

208     public Integer JavaDoc getDestOrder() {
209         return destOrder;
210     }
211     /**
212      * @param destOrder The destOrder to set.
213      */

214     public void setDestOrder(Integer JavaDoc destOrder) {
215         this.destOrder = destOrder;
216     }
217     /**
218      * @return Returns the position.
219      */

220     public Integer JavaDoc getPosition() {
221         return position;
222     }
223     /**
224      * @param position The position to set.
225      */

226     public void setPosition(Integer JavaDoc position) {
227         this.position = position;
228     }
229     /**
230      * @return Returns the btnLang.
231      */

232     public List JavaDoc getBtnLang() {
233         return btnLang;
234     }
235 }
Popular Tags