001: /*
002: * Created on 13/02/2004
003: *
004: * Swing Components - visit http://sf.net/projects/gfd
005: *
006: * Copyright (C) 2004 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.data;
024:
025: import java.sql.SQLException;
026: import java.util.Map;
027:
028: import br.com.gfp.internationalization.ErrosDeDadosMessages;
029: import br.com.gfpshare.db.Column;
030: import br.com.gfpshare.db.Table;
031:
032: /**
033: * Classe que representa um tipo de lancamento
034: * @author Igor Regis da Silva Simoes
035: */
036: @Table(name="TipoLancamento")
037: public class TransactionType extends BasicGFPDataObject {
038: /**
039: * Nome do tipo de lancamento
040: */
041: @Column(nome="Nome",isPk=false,writeMethodName="setNome",readMethodName="getNome")
042: private String nome = null;
043:
044: /**
045: * Descricao do tipo de lancamento
046: */
047: @Column(nome="Descricao",isPk=false,writeMethodName="setDescricao",readMethodName="getDescricao")
048: private String descricao = null;
049:
050: /**
051: * Indica se o Tipo de Lancamento é subtipo de algum outro Tipo de Lancamento
052: */
053: @Column(nome="SuperTipo",isPk=false,writeMethodName="setSuperTipo",readMethodName="getSuperTipo")
054: private Integer super Tipo = null;
055:
056: /**
057: * Indica se o Tipo de Lancamento é subtipo de algum outro Tipo de Lancamento
058: */
059: @Column(nome="EhDeSistema",isPk=false,writeMethodName="setEhDeSistema",readMethodName="getEhDeSistema")
060: private Boolean ehDeSistema = null;
061:
062: /**
063: * Indica se o Tipo de Lancamento é subtipo de algum outro Tipo de Lancamento
064: */
065: @Column(nome="RealizarPrevisao",isPk=false,writeMethodName="setRealizarPrevisao",readMethodName="getRealizarPrevisao")
066: private Boolean realizarPrevisao = null;
067:
068: /**
069: * Indica uma méta de valores para este tipo de lançamento
070: */
071: @Column(nome="Meta",isPk=false,writeMethodName="setMeta",readMethodName="getMeta")
072: private Double meta = null;
073:
074: /** Cria uma nova instância de TipoLancamento */
075: public TransactionType() {
076: //Não fazemos nada
077: }
078:
079: /** Cria uma nova instância de TipoLancamento
080: * @param nome Nome do novo Tipo de Lancamento
081: **/
082: public TransactionType(String nome) {
083: setNome(nome);
084: }
085:
086: /** Cria uma nova instância de TipoLancamento
087: * @param id Id no novo Tipo de Lancamento
088: **/
089: public TransactionType(Integer id) {
090: setId(id);
091: }
092:
093: /**
094: * Cria uma nova instância de TipoLancamento
095: * @param dados Map contendo os dados deste novo Tipo de Lancamento
096: */
097: public TransactionType(Map<String, Object> dados) {
098: setDados(dados);
099: }
100:
101: /** Getter for property nome.
102: * @return Value of property nome.
103: *
104: */
105: public String getNome() {
106: return nome;
107: }
108:
109: /** Setter for property nome.
110: * @param nome New value of property nome.
111: *
112: */
113: public void setNome(String nome) {
114: this .nome = nome == null || nome.equals("") ? null : nome;
115: }
116:
117: /** Getter for property descricao.
118: * @return Value of property descricao.
119: *
120: */
121: public String getDescricao() {
122: return descricao;
123: }
124:
125: /** Setter for property descricao.
126: * @param descricao New value of property descricao.
127: *
128: */
129: public void setDescricao(String descricao) {
130: this .descricao = descricao == null || descricao.equals("") ? null
131: : descricao;
132: }
133:
134: /**
135: * Getter for property superTipo.
136: * @return Value of property superTipo.
137: */
138: public Integer getSuperTipo() {
139: return super Tipo;
140: }
141:
142: /**
143: * Setter for property superTipo.
144: * @param superTipo New value of property superTipo.
145: */
146: public void setSuperTipo(Integer super Tipo) {
147: this .super Tipo = super Tipo;
148: }
149:
150: /**
151: * @return Returns the persistentEhDeSistema.
152: */
153: public Boolean getEhDeSistema() {
154: return ehDeSistema;
155: }
156:
157: /**
158: * @param ehDeSistema The persistentEhDeSistema to set.
159: */
160: public void setEhDeSistema(Boolean ehDeSistema) {
161: this .ehDeSistema = ehDeSistema;
162: }
163:
164: /**
165: * @see br.com.gfpshare.db.PersistentObject#validate()
166: */
167: public void validate() throws SQLException {
168: if (this .nome == null)
169: throw new SQLException(ErrosDeDadosMessages.getMessages()
170: .getString("NomeInvalido"));
171: }
172:
173: /**
174: * @see br.com.gfpshare.db.PersistentObject#getAsString(int)
175: */
176: public String getAsString(int format) {
177: switch (format) {
178: case TransactionType.CURTO:
179: return getNome();
180: case TransactionType.MEDIO:
181: return getNome() + " - " + getDescricao();
182: case TransactionType.LONGO:
183: return toString();
184: }
185: return "";
186: }
187:
188: /**
189: * Indica se este tipo de lancamento deverá sofrer previsões futuras
190: * Ou seja, sempre que houver um lançamento deste tipo o GFP irá realizar
191: * uma prospecção doa valores para este tipo de lanaçamento nos meses seguintes.
192: *
193: * @return Boolean
194: */
195: public Boolean getRealizarPrevisao() {
196: return realizarPrevisao;
197: }
198:
199: /**
200: * Indica se este tipo de lancamento deverá sofrer previsões futuras
201: * Ou seja, sempre que houver um lançamento deste tipo o GFP irá realizar
202: * uma prospecção doa valores para este tipo de lanaçamento nos meses seguintes.
203: *
204: * @param realizarPrevisao
205: */
206: public void setRealizarPrevisao(Boolean realizarPrevisao) {
207: this .realizarPrevisao = realizarPrevisao;
208: }
209:
210: /**
211: * Indica uma méta de valores para este tipo de lançamento
212: * @return
213: */
214: public Double getMeta() {
215: return meta;
216: }
217:
218: /**
219: * Indica uma méta de valores para este tipo de lançamento
220: * @param meta
221: */
222: public void setMeta(Double meta) {
223: this.meta = meta;
224: }
225: }
|