KickJava   Java API By Example, From Geeks To Geeks.

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


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.SmileTransaction;
8 import org.javabb.vo.Smile;
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: SmileAction.java,v 1.7.10.2 2006/04/17 17:47:05 daltoncamargo Exp $ */
27 /**
28  * @author Dalton Camargo - <a HREF="mailto:dalton@javabb.org">dalton@javabb.org </a> <br>
29  * @author Ronald Tetsuo Miura
30  */

31 public class SmileAction extends BaseAction {
32
33     private SmileTransaction _smileTransaction;
34
35     private Smile _smile = new Smile();
36     private List JavaDoc _smiles = new ArrayList JavaDoc();
37
38     private String JavaDoc _emoticon = "";
39     private String JavaDoc _symbol = "";
40     private String JavaDoc _filename = "";
41
42     // ####################################################################
43
// Parameters
44
// ####################################################################
45

46     /**
47      * @param filename
48      */

49     public void setFilename(String JavaDoc filename) {
50         this._filename = filename;
51     }
52
53     /**
54      * @param symbol
55      */

56     public void setSymbol(String JavaDoc symbol) {
57         this._symbol = symbol;
58     }
59
60     /**
61      * @param emotion
62      */

63     public void setEmoticon(String JavaDoc emotion) {
64         this._emoticon = emotion;
65     }
66
67     // ####################################################################
68
// Dependencies
69
// ####################################################################
70

71     /**
72      * @param smileTransaction
73      */

74     public void setSmileTransaction(SmileTransaction smileTransaction) {
75         this._smileTransaction = smileTransaction;
76     }
77
78     // ####################################################################
79
// Actions
80
// ####################################################################
81

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

86     public String JavaDoc listSmiles() throws Exception JavaDoc {
87         _smiles = _smileTransaction.listAll();
88         return SUCCESS;
89     }
90
91     /**
92      * @return result
93      * @throws Exception
94      */

95     public String JavaDoc loadSmile() throws Exception JavaDoc {
96         _smile = _smileTransaction.getSmile(_smileId);
97         return SUCCESS;
98     }
99
100     /**
101      * @return result
102      * @throws Exception
103      */

104     public String JavaDoc removeSmile() throws Exception JavaDoc {
105         _smileTransaction.delete(_smileId);
106         return SUCCESS;
107     }
108
109     /**
110      * @return result
111      * @throws Exception
112      */

113     public String JavaDoc updateSmile() throws Exception JavaDoc {
114         _smileTransaction.updateSmile(_smileId, _emoticon, _symbol, _filename);
115         return SUCCESS;
116     }
117
118     /**
119      * @return result
120      * @throws Exception
121      */

122     public String JavaDoc addSmile() throws Exception JavaDoc {
123         _smileTransaction.addSmile(_emoticon, _symbol, _filename);
124         return SUCCESS;
125     }
126
127     // ####################################################################
128
// View objects accessors
129
// ####################################################################
130

131     /**
132      * @return smile
133      */

134     public Smile getSmile() {
135         return _smile;
136     }
137
138     /**
139      * @return Returns the badWords.
140      */

141     public List JavaDoc getSmiles() {
142         return _smiles;
143     }
144
145 }
Popular Tags