KickJava   Java API By Example, From Geeks To Geeks.

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


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.BadWordTransaction;
8 import org.javabb.vo.BadWord;
9
10 /*
11  * Copyright 2004 JavaFree.org
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */

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

32 public class BadWordAction extends BaseAction {
33     private BadWord badWord;
34
35     private BadWordTransaction badWordTransaction;
36
37     private List JavaDoc badWords = new ArrayList JavaDoc();
38
39     private Long JavaDoc id;
40
41     private String JavaDoc word;
42
43     private String JavaDoc replacement;
44
45     // ####################################################################
46
// Parameters
47
// ####################################################################
48

49     /**
50      * @param id
51      * the new id value
52      */

53     public void setId(Long JavaDoc id) {
54         this.id = id;
55     }
56
57     /**
58      * @param replacement
59      * the new replacement value
60      */

61     public void setReplacement(String JavaDoc replacement) {
62         this.replacement = replacement;
63     }
64
65     /**
66      * @param word
67      * the new word value
68      */

69     public void setWord(String JavaDoc word) {
70         this.word = word;
71     }
72
73     // ####################################################################
74
// Dependencies
75
// ####################################################################
76

77     /**
78      * @param badWordTransaction
79      * the new badWordTransaction value
80      */

81     public void setBadWordTransaction(BadWordTransaction badWordTransaction) {
82         this.badWordTransaction = badWordTransaction;
83     }
84
85     // ####################################################################
86
// Actions
87
// ####################################################################
88

89     /**
90      * @return result
91      * @throws Exception
92      */

93     public String JavaDoc listBadWords() throws Exception JavaDoc {
94         badWords = badWordTransaction.listAll();
95         return SUCCESS;
96     }
97
98     /**
99      * @return result
100      * @throws Exception
101      */

102     public String JavaDoc loadBadWord() throws Exception JavaDoc {
103         badWord = badWordTransaction.getBadWord(id);
104         badWords = badWordTransaction.listAll();
105         return SUCCESS;
106     }
107
108     /**
109      * @return result
110      * @throws Exception
111      */

112     public String JavaDoc delBadWord() throws Exception JavaDoc {
113         badWordTransaction.delete(new BadWord(id));
114         return SUCCESS;
115     }
116
117     /**
118      * @return result
119      * @throws Exception
120      */

121     public String JavaDoc editBadWord() throws Exception JavaDoc {
122         badWordTransaction.update(new BadWord(id, word, replacement));
123         return SUCCESS;
124     }
125
126     /**
127      * @return result
128      * @throws Exception
129      */

130     public String JavaDoc addBadWord() throws Exception JavaDoc {
131         badWordTransaction.save(new BadWord(word, replacement));
132         return SUCCESS;
133     }
134
135     // ####################################################################
136
// View objects accessors
137
// ####################################################################
138

139     /**
140      * @return Returns the badWord.
141      */

142     public BadWord getBadWord() {
143         return badWord;
144     }
145
146     /**
147      * @return Returns the badWords.
148      */

149     public List JavaDoc getBadWords() {
150         return badWords;
151     }
152
153 }
Popular Tags