001: /*
002: * Created on 16/10/2006
003: *
004: * Swing Components - visit http://sf.net/projects/gfd
005: *
006: * Copyright (C) 2006 Igor Regis da Silva Simões
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public License
010: * as published by the Free Software Foundation; either version 2
011: * of the License, or (at your option) any later version.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with this program; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021: *
022: */
023: package br.com.gfp.ols.dados;
024:
025: import java.sql.SQLException;
026:
027: import br.com.gfp.internationalization.ErrosDeDadosMessages;
028: import br.com.gfpshare.db.AbstractPersistentObject;
029: import br.com.gfpshare.db.Column;
030: import br.com.gfpshare.db.Table;
031:
032: @Table(name="Request")
033: public class Request extends AbstractPersistentObject {
034: public static final int BUG_REPORT = 0;
035:
036: public static final int SUPPORT_REQUEST = 1;
037:
038: public static final int FEATURE_REQUEST = 2;
039:
040: @Column(isPk=true,nome="Id",readMethodName="getId",writeMethodName="setId")
041: private Integer id = null;
042:
043: /**
044: * Numero de comentarios (posts) que este request possui
045: */
046: @Column(isPk=false,nome="CommentsCount",readMethodName="getCommentsCount",writeMethodName="setCommentsCount")
047: private Integer commentsCount = null;
048:
049: /**
050: * Tipo do request (sepport request, bug report ou feature request)
051: */
052: @Column(isPk=false,nome="Tipo",readMethodName="getTipo",writeMethodName="setTipo")
053: protected Integer tipo = null;
054:
055: /**
056: * Indica se este é um request que o usuario postou
057: */
058: @Column(isPk=false,nome="MyRequest",readMethodName="isMyRequest",writeMethodName="setMyRequest")
059: private Boolean myRequest = null;
060:
061: /**
062: * Categoria do request (ver site)
063: */
064: @Column(isPk=false,nome="Categoria",readMethodName="getCategoria",writeMethodName="setCategoria")
065: private String categoria = null;
066:
067: /**
068: * Grupo do request (ver site)
069: */
070: @Column(isPk=false,nome="Grupo",readMethodName="getGrupo",writeMethodName="setGrupo")
071: private String grupo = null;
072:
073: /**
074: * Quem é o responsável pela condução deste request
075: */
076: @Column(isPk=false,nome="AtribuidoPara",readMethodName="getAtribuidoPara",writeMethodName="setAtribuidoPara")
077: private String atribuidoPara = null;
078:
079: /**
080: * Prioridade deste request
081: */
082: @Column(isPk=false,nome="Prioridade",readMethodName="getPrioridade",writeMethodName="setPrioridade")
083: private String prioridade = null;
084:
085: /**
086: * Status (aberto, fechando, pendente, ...)
087: */
088: @Column(isPk=false,nome="Status",readMethodName="getStatus",writeMethodName="setStatus")
089: private String status = null;
090:
091: /**
092: * Titulo do request
093: */
094: @Column(isPk=false,nome="Titulo",readMethodName="getTitulo",writeMethodName="setTitulo")
095: private String titulo = null;
096:
097: /**
098: * Comentarios do request
099: */
100: @Column(isPk=false,nome="Texto",readMethodName="getTexto",writeMethodName="setTexto")
101: private String texto = null;
102:
103: /**
104: * Indica se este request já foi enviado para o site
105: */
106: @Column(isPk=false,nome="LocalPost",readMethodName="isLocalPost",writeMethodName="setLocalPost")
107: private Boolean localPost = null;
108:
109: /**
110: * Campo para adição de novo comentario ao request
111: */
112: private String novoTexto = null;
113:
114: /*
115: * Indicamos que as pk não são automáticas para este tipo de dado
116: */
117: {
118: autoPk = false;
119: }
120:
121: public Request() {
122: //Podemos criar um Request sem parametros
123: }
124:
125: public Request(Integer id) {
126: setId(id);
127: }
128:
129: public Request(String titulo) {
130: setTitulo(titulo);
131: }
132:
133: public String getAsString(int arg0) {
134: if (arg0 == CURTO)
135: return getId() + " - " + getTitulo();
136: else if (arg0 == MEDIO)
137: return getAsString(CURTO) + " Status: " + getStatus()
138: + " Coments Count: " + getCommentsCount();
139: else if (arg0 == LONGO)
140: return getAsString(CURTO) + getAsString(MEDIO)
141: + " Prioridade: " + getPrioridade()
142: + " Responsável: " + getAtribuidoPara();
143: return "Invalid parameter!";
144: }
145:
146: public void validate() throws SQLException {
147: if (getTitulo() == null)
148: throw new SQLException(ErrosDeDadosMessages.getMessages()
149: .getString("TituloInvalido"));
150: if (getNovoTexto() == null)
151: throw new SQLException(ErrosDeDadosMessages.getMessages()
152: .getString("TextoInvalido"));
153: }
154:
155: public String getAtribuidoPara() {
156: return atribuidoPara;
157: }
158:
159: public void setAtribuidoPara(String atribuidoPara) {
160: this .atribuidoPara = atribuidoPara;
161: }
162:
163: public String getCategoria() {
164: return categoria;
165: }
166:
167: public void setCategoria(String categoria) {
168: this .categoria = categoria;
169: }
170:
171: public Integer getCommentsCount() {
172: return commentsCount;
173: }
174:
175: public void setCommentsCount(Integer commentsCount) {
176: this .commentsCount = commentsCount;
177: }
178:
179: public String getGrupo() {
180: return grupo;
181: }
182:
183: public void setGrupo(String grupo) {
184: this .grupo = grupo;
185: }
186:
187: public Integer getId() {
188: return id;
189: }
190:
191: public void setId(Integer id) {
192: this .id = id;
193: }
194:
195: public String getPrioridade() {
196: return prioridade;
197: }
198:
199: public void setPrioridade(String prioridade) {
200: this .prioridade = prioridade;
201: }
202:
203: public String getStatus() {
204: return status;
205: }
206:
207: public void setStatus(String status) {
208: this .status = status;
209: }
210:
211: public String getTexto() {
212: return texto;
213: }
214:
215: public void setTexto(String texto) {
216: this .texto = texto;
217: }
218:
219: public Integer getTipo() {
220: return tipo;
221: }
222:
223: public void setTipo(Integer tipo) {
224: this .tipo = tipo;
225: }
226:
227: public String getTitulo() {
228: return titulo;
229: }
230:
231: public void setTitulo(String titulo) {
232: this .titulo = titulo;
233: }
234:
235: public Boolean isMyRequest() {
236: return myRequest;
237: }
238:
239: public void setMyRequest(Boolean myRequest) {
240: this .myRequest = myRequest;
241: }
242:
243: public String getNovoTexto() {
244: return novoTexto;
245: }
246:
247: public void setNovoTexto(String novoTexto) {
248: this .novoTexto = novoTexto;
249: }
250:
251: public Boolean isLocalPost() {
252: return localPost;
253: }
254:
255: public void setLocalPost(Boolean localPost) {
256: this.localPost = localPost;
257: }
258: }
|