~vcs-imports/evaristo/trunk

« back to all changes in this revision

Viewing changes to com/m16e/mpbiz/tables/DbDocTaxa.java

  • Committer: m16e
  • Date: 2004-01-21 17:10:58 UTC
  • Revision ID: vcs-imports@canonical.com-20040121171058-00w8f93ynnk2xwve
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Log: DbDocTaxa.java,v $
 
3
 * Revision 1.1  2004/01/21 17:15:37  m16e
 
4
 * Initial revision
 
5
 *
 
6
 *
 
7
 *
 
8
 */
 
9
 
 
10
package com.m16e.mpbiz.tables;
 
11
 
 
12
import java.io.*;
 
13
import java.util.*;
 
14
import java.text.*;
 
15
import java.sql.*;
 
16
import com.m16e.free.tools.*;
 
17
import com.m16e.free.tools.db.*;
 
18
import com.m16e.free.tools.debug.*;
 
19
import com.m16e.free.tools.xml.*;
 
20
 
 
21
////////////////////////////////////////////////////////////
 
22
public class DbDocTaxa
 
23
        extends DbTab
 
24
        implements DbTableInterface
 
25
{
 
26
        public final static String XGUI_FORM_DOC_TAXA =
 
27
                "xgui-form-doc-taxa.xml";
 
28
        public final static String XGUI_FORM_DOC_TAXA_FRAME =
 
29
                "form-doc-taxa-frame";
 
30
        public final static String XGUI_LIST_DOC_TAXA =
 
31
                "xgui-list-doc-taxa.xml";
 
32
        public final static String XGUI_LIST_DOC_TAXA_FRAME =
 
33
                "list-doc-taxa-frame";
 
34
 
 
35
        public final static String T_NAME = "doc_taxa";
 
36
        public final static String[] FIELDS = 
 
37
                {       "tipo_ent_id",
 
38
                        "tipo_doc_id",
 
39
                        "doc_id",
 
40
                        "taxa_id",
 
41
                        "incidencia",
 
42
                        "imposto" };
 
43
        public final static String[] FIELD_NAMES = 
 
44
                {       "tipo_ent_id",
 
45
                        "tipo_doc_id",
 
46
                        "doc_id",
 
47
                        "taxa_id",
 
48
                        "incidencia",
 
49
                        "imposto" };
 
50
        public final static int TIPO_ENT_ID = 0;
 
51
        public final static int TIPO_DOC_ID = 1;
 
52
        public final static int DOC_ID = 2;
 
53
        public final static int TAXA_ID = 3;
 
54
        public final static int INCIDENCIA = 4;
 
55
        public final static int IMPOSTO = 5;
 
56
        public final static TupleColDataModel[] TCDM =
 
57
        {
 
58
                // tipo_ent_id
 
59
                new TupleColDataModel( 
 
60
                                Integer.class, FIELDS[0], 8, false ),
 
61
                // tipo_doc_id
 
62
                new TupleColDataModel( 
 
63
                                Integer.class, FIELDS[1], 8, false ),
 
64
                // doc_id
 
65
                new TupleColDataModel( 
 
66
                                Integer.class, FIELDS[2], 8, false ),
 
67
                // taxa_id
 
68
                new TupleColDataModel( 
 
69
                                Integer.class, FIELDS[3], 8, false ),
 
70
                // incidencia
 
71
                new TupleColDataModel( 
 
72
                                Double.class, FIELDS[4], 15, false ),
 
73
                // imposto
 
74
                new TupleColDataModel( 
 
75
                                Double.class, FIELDS[5], 15, false )
 
76
        };
 
77
 
 
78
        public final static TupleDataModel TDM =
 
79
                new TupleDataModel( "DbDocTaxa.class", TCDM );
 
80
 
 
81
        ////////////////////////////////////////////////////////////
 
82
        public DbDocTaxa( Database db )
 
83
                throws SQLException
 
84
        {
 
85
                super( db, T_NAME, TDM );
 
86
        }
 
87
 
 
88
        ////////////////////////////////////////////////////////////
 
89
        public DbDocTaxa( Database db, ResultSet rs )
 
90
                throws SQLException
 
91
        {
 
92
                super( db, T_NAME, TDM );
 
93
                setTuple( rs );
 
94
        }
 
95
 
 
96
        ////////////////////////////////////////////////////////////
 
97
        public DbTableInterface createTab( Database db,  String tableName, ResultSet rs)
 
98
                throws SQLException
 
99
        {
 
100
                DbDocTaxa dbDocTaxa = new DbDocTaxa( db, rs );
 
101
                return dbDocTaxa;
 
102
        }
 
103
 
 
104
        ////////////////////////////////////////////////////////////
 
105
        public String getTabLayout()
 
106
        {
 
107
                return XGUI_LIST_DOC_TAXA;
 
108
        }
 
109
 
 
110
        ////////////////////////////////////////////////////////////
 
111
        public String getFormLayout()
 
112
        {
 
113
                return XGUI_FORM_DOC_TAXA;
 
114
        }
 
115
 
 
116
        ////////////////////////////////////////////////////////////
 
117
        public void setData( String xmlData )
 
118
                throws SQLException
 
119
        {
 
120
                DateFormat df = MpAppContext.getInstance().getDateFormat();
 
121
                DateFormat tsf = MpAppContext.getInstance().getTimestampFormat();
 
122
                // tipo_ent_id
 
123
                String aux =
 
124
                        XmlInterpreter.getElementValue(
 
125
                                xmlData,
 
126
                                FIELDS[ TIPO_ENT_ID ] );
 
127
                if ( aux.length() == 0 )
 
128
                        aux = "0";
 
129
                setValue( TIPO_ENT_ID, Integer.parseInt( aux ) );
 
130
 
 
131
                setChangedField( TIPO_ENT_ID, hasChanged( xmlData, FIELDS[ TIPO_ENT_ID ] ) );
 
132
                // tipo_doc_id
 
133
                aux =
 
134
                        XmlInterpreter.getElementValue(
 
135
                                xmlData,
 
136
                                FIELDS[ TIPO_DOC_ID ] );
 
137
                if ( aux.length() == 0 )
 
138
                        aux = "0";
 
139
                setValue( TIPO_DOC_ID, Integer.parseInt( aux ) );
 
140
 
 
141
                setChangedField( TIPO_DOC_ID, hasChanged( xmlData, FIELDS[ TIPO_DOC_ID ] ) );
 
142
                // doc_id
 
143
                aux =
 
144
                        XmlInterpreter.getElementValue(
 
145
                                xmlData,
 
146
                                FIELDS[ DOC_ID ] );
 
147
                if ( aux.length() == 0 )
 
148
                        aux = "0";
 
149
                setValue( DOC_ID, Integer.parseInt( aux ) );
 
150
 
 
151
                setChangedField( DOC_ID, hasChanged( xmlData, FIELDS[ DOC_ID ] ) );
 
152
                // taxa_id
 
153
                aux =
 
154
                        XmlInterpreter.getElementValue(
 
155
                                xmlData,
 
156
                                FIELDS[ TAXA_ID ] );
 
157
                if ( aux.length() == 0 )
 
158
                        aux = "0";
 
159
                setValue( TAXA_ID, Integer.parseInt( aux ) );
 
160
 
 
161
                setChangedField( TAXA_ID, hasChanged( xmlData, FIELDS[ TAXA_ID ] ) );
 
162
                // incidencia
 
163
                aux =
 
164
                        XmlInterpreter.getElementValue(
 
165
                                xmlData,
 
166
                                FIELDS[ INCIDENCIA ] );
 
167
                if ( aux.length() == 0 )
 
168
                        aux = "0.0";
 
169
                setValue( INCIDENCIA,
 
170
                        Double.parseDouble(
 
171
                                DataFactory.fixNumberSeparator( aux, null ) ) );
 
172
 
 
173
                setChangedField( INCIDENCIA, hasChanged( xmlData, FIELDS[ INCIDENCIA ] ) );
 
174
                // imposto
 
175
                aux =
 
176
                        XmlInterpreter.getElementValue(
 
177
                                xmlData,
 
178
                                FIELDS[ IMPOSTO ] );
 
179
                if ( aux.length() == 0 )
 
180
                        aux = "0.0";
 
181
                setValue( IMPOSTO,
 
182
                        Double.parseDouble(
 
183
                                DataFactory.fixNumberSeparator( aux, null ) ) );
 
184
 
 
185
                setChangedField( IMPOSTO, hasChanged( xmlData, FIELDS[ IMPOSTO ] ) );
 
186
        }
 
187
 
 
188
        ////////////////////////////////////////////////////////////
 
189
        // Get/Set methods: BEGIN
 
190
        ////////////////////////////////////////////////////////////
 
191
 
 
192
        ////////////////////////////////////////////////////////////
 
193
        public int getTipoEntId()
 
194
        {
 
195
                return getTipoEntId( getTuple() );
 
196
        }
 
197
 
 
198
        ////////////////////////////////////////////////////////////
 
199
        public static int getTipoEntId( Object[] tuple )
 
200
        {
 
201
                int value = toInt( tuple, TIPO_ENT_ID );
 
202
                return value;
 
203
        }
 
204
 
 
205
        ////////////////////////////////////////////////////////////
 
206
        public void setTipoEntId( int value )
 
207
        {
 
208
                setTipoEntId( getTuple(), value );
 
209
        }
 
210
 
 
211
        ////////////////////////////////////////////////////////////
 
212
        public static void setTipoEntId( Object[] tuple, int value )
 
213
        {
 
214
                setValue( tuple, TIPO_ENT_ID, value );
 
215
        }
 
216
 
 
217
        ////////////////////////////////////////////////////////////
 
218
        public int getTipoDocId()
 
219
        {
 
220
                return getTipoDocId( getTuple() );
 
221
        }
 
222
 
 
223
        ////////////////////////////////////////////////////////////
 
224
        public static int getTipoDocId( Object[] tuple )
 
225
        {
 
226
                int value = toInt( tuple, TIPO_DOC_ID );
 
227
                return value;
 
228
        }
 
229
 
 
230
        ////////////////////////////////////////////////////////////
 
231
        public void setTipoDocId( int value )
 
232
        {
 
233
                setTipoDocId( getTuple(), value );
 
234
        }
 
235
 
 
236
        ////////////////////////////////////////////////////////////
 
237
        public static void setTipoDocId( Object[] tuple, int value )
 
238
        {
 
239
                setValue( tuple, TIPO_DOC_ID, value );
 
240
        }
 
241
 
 
242
        ////////////////////////////////////////////////////////////
 
243
        public int getDocId()
 
244
        {
 
245
                return getDocId( getTuple() );
 
246
        }
 
247
 
 
248
        ////////////////////////////////////////////////////////////
 
249
        public static int getDocId( Object[] tuple )
 
250
        {
 
251
                int value = toInt( tuple, DOC_ID );
 
252
                return value;
 
253
        }
 
254
 
 
255
        ////////////////////////////////////////////////////////////
 
256
        public void setDocId( int value )
 
257
        {
 
258
                setDocId( getTuple(), value );
 
259
        }
 
260
 
 
261
        ////////////////////////////////////////////////////////////
 
262
        public static void setDocId( Object[] tuple, int value )
 
263
        {
 
264
                setValue( tuple, DOC_ID, value );
 
265
        }
 
266
 
 
267
        ////////////////////////////////////////////////////////////
 
268
        public int getTaxaId()
 
269
        {
 
270
                return getTaxaId( getTuple() );
 
271
        }
 
272
 
 
273
        ////////////////////////////////////////////////////////////
 
274
        public static int getTaxaId( Object[] tuple )
 
275
        {
 
276
                int value = toInt( tuple, TAXA_ID );
 
277
                return value;
 
278
        }
 
279
 
 
280
        ////////////////////////////////////////////////////////////
 
281
        public void setTaxaId( int value )
 
282
        {
 
283
                setTaxaId( getTuple(), value );
 
284
        }
 
285
 
 
286
        ////////////////////////////////////////////////////////////
 
287
        public static void setTaxaId( Object[] tuple, int value )
 
288
        {
 
289
                setValue( tuple, TAXA_ID, value );
 
290
        }
 
291
 
 
292
        ////////////////////////////////////////////////////////////
 
293
        public double getIncidencia()
 
294
        {
 
295
                return getIncidencia( getTuple() );
 
296
        }
 
297
 
 
298
        ////////////////////////////////////////////////////////////
 
299
        public static double getIncidencia( Object[] tuple )
 
300
        {
 
301
                double value = toDouble( tuple, INCIDENCIA );
 
302
                return value;
 
303
        }
 
304
 
 
305
        ////////////////////////////////////////////////////////////
 
306
        public void setIncidencia( double value )
 
307
        {
 
308
                setIncidencia( getTuple(), value );
 
309
        }
 
310
 
 
311
        ////////////////////////////////////////////////////////////
 
312
        public static void setIncidencia( Object[] tuple, double value )
 
313
        {
 
314
                setValue( tuple, INCIDENCIA, value );
 
315
        }
 
316
 
 
317
        ////////////////////////////////////////////////////////////
 
318
        public double getImposto()
 
319
        {
 
320
                return getImposto( getTuple() );
 
321
        }
 
322
 
 
323
        ////////////////////////////////////////////////////////////
 
324
        public static double getImposto( Object[] tuple )
 
325
        {
 
326
                double value = toDouble( tuple, IMPOSTO );
 
327
                return value;
 
328
        }
 
329
 
 
330
        ////////////////////////////////////////////////////////////
 
331
        public void setImposto( double value )
 
332
        {
 
333
                setImposto( getTuple(), value );
 
334
        }
 
335
 
 
336
        ////////////////////////////////////////////////////////////
 
337
        public static void setImposto( Object[] tuple, double value )
 
338
        {
 
339
                setValue( tuple, IMPOSTO, value );
 
340
        }
 
341
 
 
342
        ////////////////////////////////////////////////////////////
 
343
        // Get/Set methods: END
 
344
        ////////////////////////////////////////////////////////////
 
345
 
 
346
 
 
347
}