PageRenderTime 35ms CodeModel.GetById 2ms app.highlight 28ms RepoModel.GetById 1ms app.codeStats 0ms

/src/mpv5/ui/dialogs/subcomponents/wizard_MP45_Import.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 482 lines | 413 code | 44 blank | 25 comment | 20 complexity | af01ed8dfff2f0c81a1913f9846b6915 MD5 | raw file
  1package mpv5.ui.dialogs.subcomponents;
  2
  3import java.awt.Cursor;
  4import java.math.BigDecimal;
  5import java.util.HashMap;
  6import java.util.List;
  7import java.util.Vector;
  8import java.util.logging.Level;
  9import java.util.logging.Logger;
 10import javax.swing.DefaultComboBoxModel;
 11
 12import mpv5.db.common.ConnectionTypeHandler;
 13import mpv5.db.common.Context;
 14import mpv5.db.common.DatabaseConnection;
 15import mpv5.db.common.DatabaseObject;
 16import mpv5.db.common.NodataFoundException;
 17import mpv5.db.common.QueryCriteria;
 18import mpv5.db.common.QueryHandler;
 19import mpv5.db.common.ReturnValue;
 20import mpv5.db.objects.Contact;
 21import mpv5.db.objects.Product;
 22import mpv5.db.objects.ProductGroup;
 23import mpv5.db.objects.Tax;
 24import mpv5.globals.Messages;
 25import mpv5.logging.Log;
 26import mpv5.ui.dialogs.DialogForFile;
 27import mpv5.ui.dialogs.Popup;
 28import mpv5.ui.dialogs.WizardMaster;
 29import mpv5.ui.dialogs.Wizardable;
 30import mpv5.utils.text.RandomText;
 31import mpv5.utils.ui.TextFieldUtils;
 32
 33/**
 34 *
 35 * 
 36 */
 37public class wizard_MP45_Import extends javax.swing.JPanel implements Wizardable {
 38
 39    private static final long serialVersionUID = -8347532498124147821L;
 40    private WizardMaster master;
 41    private DatabaseConnection conn;
 42    private QueryHandler qh;
 43    private int imports;
 44
 45    public wizard_MP45_Import(WizardMaster w) {
 46        this.master = w;
 47        initComponents();
 48        path.setFilter(DialogForFile.DIRECTORIES);
 49        jComboBox1.setModel(new DefaultComboBoxModel(ConnectionTypeHandler.DRIVERS));
 50        path.setModalityParent(this);
 51    }
 52
 53    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 54    private void initComponents() {
 55
 56        jPanel1 = new javax.swing.JPanel();
 57        path = new mpv5.ui.beans.LabeledTextChooser();
 58        jLabel1 = new javax.swing.JLabel();
 59        products = new javax.swing.JCheckBox();
 60        customers = new javax.swing.JCheckBox();
 61        suppliers = new javax.swing.JCheckBox();
 62        manufacturers = new javax.swing.JCheckBox();
 63        jComboBox1 = new javax.swing.JComboBox();
 64        jLabel2 = new javax.swing.JLabel();
 65        dbname = new mpv5.ui.beans.LabeledTextField();
 66        dbuser = new mpv5.ui.beans.LabeledTextField();
 67        dbpassword = new mpv5.ui.beans.LabeledTextField();
 68        dbprefix = new mpv5.ui.beans.LabeledTextField();
 69
 70        setBackground(new java.awt.Color(255, 255, 255));
 71        setName("Form"); // NOI18N
 72        setLayout(new java.awt.BorderLayout());
 73
 74        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
 75         java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
 76        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("wizard_MP45_Import.jPanel1.border.title"))); // NOI18N
 77        jPanel1.setName("jPanel1"); // NOI18N
 78
 79        path.set_Label(bundle.getString("wizard_MP45_Import.path._Label")); // NOI18N
 80        path.setName("path"); // NOI18N
 81
 82        jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() & ~java.awt.Font.BOLD));
 83        jLabel1.setText(bundle.getString("wizard_MP45_Import.jLabel1.text")); // NOI18N
 84        jLabel1.setName("jLabel1"); // NOI18N
 85
 86        products.setBackground(new java.awt.Color(255, 255, 255));
 87        products.setSelected(true);
 88        products.setText(bundle.getString("wizard_MP45_Import.products.text")); // NOI18N
 89        products.setBorder(javax.swing.BorderFactory.createEtchedBorder());
 90        products.setName("products"); // NOI18N
 91
 92        customers.setBackground(new java.awt.Color(255, 255, 255));
 93        customers.setSelected(true);
 94        customers.setText(bundle.getString("wizard_MP45_Import.customers.text")); // NOI18N
 95        customers.setBorder(javax.swing.BorderFactory.createEtchedBorder());
 96        customers.setName("customers"); // NOI18N
 97
 98        suppliers.setBackground(new java.awt.Color(255, 255, 255));
 99        suppliers.setSelected(true);
100        suppliers.setText(bundle.getString("wizard_MP45_Import.suppliers.text")); // NOI18N
101        suppliers.setBorder(javax.swing.BorderFactory.createEtchedBorder());
102        suppliers.setName("suppliers"); // NOI18N
103
104        manufacturers.setBackground(new java.awt.Color(255, 255, 255));
105        manufacturers.setSelected(true);
106        manufacturers.setText(bundle.getString("wizard_MP45_Import.manufacturers.text")); // NOI18N
107        manufacturers.setBorder(javax.swing.BorderFactory.createEtchedBorder());
108        manufacturers.setName("manufacturers"); // NOI18N
109
110        jComboBox1.setEditable(true);
111        jComboBox1.setFont(new java.awt.Font("Dialog", 0, 11));
112        jComboBox1.setName("jComboBox1"); // NOI18N
113        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
114            public void actionPerformed(java.awt.event.ActionEvent evt) {
115                jComboBox1ActionPerformed(evt);
116            }
117        });
118
119        jLabel2.setText(bundle.getString("wizard_MP45_Import.jLabel2.text")); // NOI18N
120        jLabel2.setName("jLabel2"); // NOI18N
121
122        dbname.set_Label(bundle.getString("wizard_MP45_Import.dbname._Label")); // NOI18N
123        dbname.setName("dbname"); // NOI18N
124
125        dbuser.set_Label(bundle.getString("wizard_MP45_Import.dbuser._Label")); // NOI18N
126        dbuser.setName("dbuser"); // NOI18N
127
128        dbpassword.set_Label(bundle.getString("wizard_MP45_Import.dbpassword._Label")); // NOI18N
129        dbpassword.setName("dbpassword"); // NOI18N
130
131        dbprefix.set_Label(bundle.getString("wizard_MP45_Import.dbprefix._Label")); // NOI18N
132        dbprefix.setName("dbprefix"); // NOI18N
133
134        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
135        jPanel1.setLayout(jPanel1Layout);
136        jPanel1Layout.setHorizontalGroup(
137            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
138            .addGroup(jPanel1Layout.createSequentialGroup()
139                .addContainerGap()
140                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
141                    .addComponent(products)
142                    .addComponent(customers)
143                    .addComponent(suppliers)
144                    .addComponent(manufacturers)
145                    .addComponent(path, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
146                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
147                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
148                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
149                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 431, javax.swing.GroupLayout.PREFERRED_SIZE))
150                    .addComponent(jLabel1)
151                    .addGroup(jPanel1Layout.createSequentialGroup()
152                        .addComponent(dbuser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
153                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 119, Short.MAX_VALUE)
154                        .addComponent(dbname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
155                    .addGroup(jPanel1Layout.createSequentialGroup()
156                        .addComponent(dbpassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
157                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 119, Short.MAX_VALUE)
158                        .addComponent(dbprefix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
159                .addContainerGap())
160        );
161        jPanel1Layout.setVerticalGroup(
162            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
163            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
164                .addContainerGap()
165                .addComponent(manufacturers)
166                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
167                .addComponent(suppliers)
168                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
169                .addComponent(customers)
170                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
171                .addComponent(products)
172                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 102, Short.MAX_VALUE)
173                .addComponent(jLabel1)
174                .addGap(18, 18, 18)
175                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
176                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
177                    .addComponent(jLabel2))
178                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
179                .addComponent(path, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
180                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
181                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
182                    .addGroup(jPanel1Layout.createSequentialGroup()
183                        .addComponent(dbuser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
184                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
185                        .addComponent(dbpassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
186                    .addGroup(jPanel1Layout.createSequentialGroup()
187                        .addComponent(dbname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
188                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
189                        .addComponent(dbprefix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
190                .addContainerGap())
191        );
192
193        add(jPanel1, java.awt.BorderLayout.CENTER);
194    }// </editor-fold>//GEN-END:initComponents
195
196    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
197    }//GEN-LAST:event_jComboBox1ActionPerformed
198    // Variables declaration - do not modify//GEN-BEGIN:variables
199    private javax.swing.JCheckBox customers;
200    private mpv5.ui.beans.LabeledTextField dbname;
201    private mpv5.ui.beans.LabeledTextField dbpassword;
202    private mpv5.ui.beans.LabeledTextField dbprefix;
203    private mpv5.ui.beans.LabeledTextField dbuser;
204    private javax.swing.JComboBox jComboBox1;
205    private javax.swing.JLabel jLabel1;
206    private javax.swing.JLabel jLabel2;
207    private javax.swing.JPanel jPanel1;
208    private javax.swing.JCheckBox manufacturers;
209    private mpv5.ui.beans.LabeledTextChooser path;
210    private javax.swing.JCheckBox products;
211    private javax.swing.JCheckBox suppliers;
212    // End of variables declaration//GEN-END:variables
213
214    public boolean next() {
215        master.setCursor(new Cursor(Cursor.WAIT_CURSOR));
216        if (path.hasText()) {
217
218            imports();
219
220            return false;
221        } else {
222            return false;
223        }
224    }
225
226    public boolean back() {
227        return false;
228    }
229
230    public void load() {
231    }
232
233    private void imports() {
234        Runnable runnable = new Runnable() {
235
236            public void run() {
237                if (dbname.getText().length() > 0) {
238                    if (path.get_Text(false).endsWith(dbname.getText())) {
239                        path.set_Text(path.get_Text(false).replace(dbname.getText(), ""));
240                    }
241                    try {
242                        conn = new DatabaseConnection();
243
244                        conn.connect(jComboBox1.getSelectedItem().toString(),
245                                dbuser.getText(),
246                                dbpassword.getText(),
247                                path.get_Text(false),
248                                dbname.getText(), dbprefix.getText(),
249                                false);
250                        conn.setProgressbar(master.getProgressbar());
251
252                        if (conn.getConnection().isValid(1000)) {
253
254                            qh = new QueryHandler(conn);
255
256                            if (manufacturers.isSelected()) {
257                                importm();
258                            }
259
260                            if (suppliers.isSelected()) {
261                                importl();
262                            }
263
264                            if (customers.isSelected()) {
265                                importc();
266                            }
267
268                            if (products.isSelected()) {
269                                importp();
270                            }
271                        }
272                        master.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
273                        master.isEnd(true);
274                        Popup.notice(imports + " " + Messages.IMPORTED.toString());
275                        if (!errors.isEmpty()) {
276                            Popup.notice(errors, mpv5.globals.Messages.ERROR_OCCURED);
277                        }
278                    } catch (Exception exception) {
279                        Popup.error(exception);
280                        Log.Debug(exception);
281                    }
282                } else {
283                    TextFieldUtils.blinkerRed(dbname);
284                }
285            }
286        };
287        new Thread(runnable).start();
288    }
289    List<DatabaseObject> errors = new Vector<DatabaseObject>();
290    /**
291     * Fields in manufacturer table
292     */
293    public final String TABLE_MANUFACTURER_FIELDS =
294            "nummer" + "," + "Firma" + "," + "Anrede" + "," + "Vorname" +
295            "," + "Name" + "," + "Str" + "," + "PLZ" + "," + "Ort" + "," +
296            "Tel" + "," + "Fax" + "," + "Mobil" + "," + "Mail" + "," + "Webseite" + "," + "Notizen" + "," + "id";
297    HashMap<Integer, Integer> manufacturer = new HashMap<Integer, Integer>();
298
299    private void importm() {
300        try {
301            qh.setTable2("hersteller");
302            Object[][] data = qh.freeSelect(TABLE_MANUFACTURER_FIELDS).getData();
303            for (int i = 0; i < data.length; i++) {
304                Contact c = new Contact();
305                c.setCNumber(String.valueOf(data[i][0]));
306                c.setCompany(String.valueOf(data[i][1]));
307                c.setTitle(String.valueOf(data[i][2]));
308                c.setPrename(String.valueOf(data[i][3]));
309                c.setCname(String.valueOf(data[i][4]));
310                c.setStreet(String.valueOf(data[i][5]));
311                c.setZip(String.valueOf(data[i][6]));
312                c.setCity(String.valueOf(data[i][7]));
313                c.setMainphone(String.valueOf(data[i][8]));
314                c.setFax(String.valueOf(data[i][9]));
315                c.setMobilephone(String.valueOf(data[i][10]));
316                c.setMailaddress(String.valueOf(data[i][11]));
317                c.setWebsite(String.valueOf(data[i][12]));
318                c.setNotes(String.valueOf(data[i][12 + 1]));
319                c.setisManufacturer(true);
320                c.setisMale(true);
321                c.saveImport();
322                imports++;
323                manufacturer.put(Integer.valueOf(String.valueOf(data[i][14])), c.__getIDS());
324            }
325        } catch (NodataFoundException ex) {
326            Log.Debug(this, ex.getMessage());
327        }
328    }
329    /**
330     * Fields in Kunde table
331     */
332    public final String TABLE_Kunde_FIELDS =
333            "nummer" + "," + "Firma" + "," + "Anrede" + "," + "Vorname" +
334            "," + "Name" + "," + "Str" + "," + "PLZ" + "," + "Ort" + "," +
335            "Tel" + "," + "Fax" + "," + "Mobil" + "," + "Mail" + "," +
336            "Webseite" + "," + "Notizen" + "," + "Steuernummer";
337
338    private void importc() {
339        try {
340            qh.setTable2("kunden");
341            Object[][] data = qh.freeSelect(TABLE_Kunde_FIELDS).getData();
342            for (int i = 0; i < data.length; i++) {
343                Contact c = new Contact();
344                c.setCNumber(String.valueOf(data[i][0]));
345                c.setCompany(String.valueOf(data[i][1]));
346                c.setTitle(String.valueOf(data[i][2]));
347                c.setPrename(String.valueOf(data[i][3]));
348                c.setCname(String.valueOf(data[i][4]));
349                c.setStreet(String.valueOf(data[i][5]));
350                c.setZip(String.valueOf(data[i][6]));
351                c.setCity(String.valueOf(data[i][7]));
352                c.setMainphone(String.valueOf(data[i][8]));
353                c.setFax(String.valueOf(data[i][9]));
354                c.setMobilephone(String.valueOf(data[i][10]));
355                c.setMailaddress(String.valueOf(data[i][11]));
356                c.setWebsite(String.valueOf(data[i][12]));
357                c.setNotes(String.valueOf(data[i][12 + 1]));
358                c.setisCustomer(true);
359                c.setisManufacturer(false);
360                c.setisSupplier(false);
361                c.setisCompany(false);
362                c.setisMale(true);
363                c.saveImport();
364                imports++;
365            }
366        } catch (NodataFoundException ex) {
367            Log.Debug(this, ex.getMessage());
368        }
369    }
370    /**
371     * Fields in supplier table
372     */
373    public final String TABLE_SUPPLIER_FIELDS =
374            "nummer" + "," + "Firma" + "," + "Anrede" + "," + "Vorname" +
375            "," + "Name" + "," + "Str" + "," + "PLZ" + "," + "Ort" + "," +
376            "Tel" + "," + "Fax" + "," + "Mobil" + "," + "Mail" + "," + "Webseite" + "," + "Notizen" + "," + "id";
377    HashMap<Integer, Integer> supplier = new HashMap<Integer, Integer>();
378
379    private void importl() {
380        try {
381            qh.setTable2("lieferanten");
382            Object[][] data = qh.freeSelect(TABLE_SUPPLIER_FIELDS).getData();
383            for (int i = 0; i < data.length; i++) {
384                Contact c = new Contact();
385                c.setCNumber(String.valueOf(data[i][0]));
386                c.setCompany(String.valueOf(data[i][1]));
387                c.setTitle(String.valueOf(data[i][2]));
388                c.setPrename(String.valueOf(data[i][3]));
389                c.setCname(String.valueOf(data[i][4]));
390                c.setStreet(String.valueOf(data[i][5]));
391                c.setZip(String.valueOf(data[i][6]));
392                c.setCity(String.valueOf(data[i][7]));
393                c.setMainphone(String.valueOf(data[i][8]));
394                c.setFax(String.valueOf(data[i][9]));
395                c.setMobilephone(String.valueOf(data[i][10]));
396                c.setMailaddress(String.valueOf(data[i][11]));
397                c.setWebsite(String.valueOf(data[i][12]));
398                c.setNotes(String.valueOf(data[i][12 + 1]));
399                c.setisSupplier(true);
400                c.setisMale(true);
401                c.saveImport();
402                imports++;
403                supplier.put(Integer.valueOf(String.valueOf(data[i][14])), c.__getIDS());
404            }
405        } catch (NodataFoundException ex) {
406            Log.Debug(this, ex.getMessage());
407        }
408    }
409    /**
410     * Fields in products table
411     */
412    public final String TABLE_PRODUCTS_FIELDS =
413            "Produktnummer" + "," + "Name" + "," + "Text" + "," + "VK" + "," + "EK" +
414            "," + "steuersatzid" + "," + "herstellerid" + "," + "lieferantenid" + "," +
415            "warengruppenid" + "," + "Datum" + "," + "Url" + "," + "EAN" +
416            "," + "bestellnr" + "," + "herstellernr" + "," + "lieferantennr" + "," +
417            "bestelldatum" + "," + "bestellmenge" + "," + "lagermenge";
418
419    private void importp() {
420        try {
421            qh.setTable2("steuersaetze");
422            Object[][] txes = qh.freeSelect("id, name, wert").getData();
423            HashMap<Integer, Integer> taxes = new HashMap<Integer, Integer>();
424            for (int i = 0; i < txes.length; i++) {
425                Tax t = new Tax();
426                t.setCname(txes[i][1].toString());
427                t.setTaxvalue(new BigDecimal(txes[i][2].toString()));
428                t.save();
429                taxes.put(Integer.valueOf(txes[i][0].toString()), t.__getIDS());
430            }
431
432            qh.setTable2("warengruppengruppen");
433            Object[][] pg = qh.freeSelect("id, name").getData();
434            HashMap<Integer, Integer> productg = new HashMap<Integer, Integer>();
435            ProductGroup g = new ProductGroup("Import " + dbname.getText() + " " + RandomText.getNumberText());
436            g.save();
437            for (int i = 0; i < pg.length; i++) {
438                ProductGroup h = new ProductGroup(pg[i][1].toString());
439                h.setProductgroupsids(g.__getIDS());
440                productg.put(Integer.valueOf(pg[i][0].toString()), h.__getIDS());
441            }
442
443            qh.setTable2("produkte");
444            Object[][] data = qh.freeSelect(TABLE_PRODUCTS_FIELDS).getData();
445            for (int i = 0; i < data.length; i++) {
446                Product c = new Product();
447                c.setCnumber(String.valueOf(data[i][0]));
448                c.setCname(String.valueOf(data[i][1]));
449                c.setDescription(String.valueOf(data[i][2]));
450                c.setExternalnetvalue(new BigDecimal(data[i][3].toString()));
451                c.setInternalnetvalue(new BigDecimal(data[i][4].toString()));
452                c.setTaxids(taxes.get(Integer.valueOf(String.valueOf(data[i][5]))));
453                if (manufacturer.containsKey(Integer.valueOf(String.valueOf(data[i][6])))) {
454                    c.setManufacturersids(manufacturer.get(Integer.valueOf(String.valueOf(data[i][6]))));
455                }
456                if (supplier.containsKey(Integer.valueOf(String.valueOf(data[i][7])))) {
457                    c.setSuppliersids(supplier.get(Integer.valueOf(String.valueOf(data[i][7]))));
458                }
459                if (productg.containsKey(Integer.valueOf(String.valueOf(data[i][8])))) {
460                    c.setProductgroupsids(productg.get(Integer.valueOf(String.valueOf(data[i][8]))));
461                }
462                c.setUrl(String.valueOf(data[i][10]));
463                c.setEan(String.valueOf(data[i][11]));
464                c.setReference(String.valueOf(data[i][12]));
465                c.saveImport();
466                imports++;
467            }
468        } catch (NodataFoundException ex) {
469            Log.Debug(this, ex.getMessage());
470        }
471    }
472    /**
473     * Fields in products table
474     */
475    public final String TABLE_SERVICES_FIELDS =
476            "produktnummer,name ,beschreibung,einheit," +
477            "preis , steuersatzid ," +
478            "warengruppenid," + "datum";
479//       "CREATE TABLE warengruppenkategorien (ID BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), kategorienummer VARCHAR(120),name VARCHAR(500),deleted INTEGER DEFAULT 0,reserve1 VARCHAR(500) default NULL,reserve2 VARCHAR(500) default NULL,PRIMARY KEY  (id))",
480//        "CREATE TABLE warengruppenfamilien (ID BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), familienummer VARCHAR(120), kategorieid BIGINT  REFERENCES warengruppenkategorien(id) ON DELETE CASCADE, name VARCHAR(500),deleted INTEGER DEFAULT 0,reserve1 VARCHAR(500) default NULL,reserve2 VARCHAR(500) default NULL,PRIMARY KEY  (id))",
481//        "CREATE TABLE warengruppengruppen (ID BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), gruppenummer VARCHAR(120),familienid BIGINT  REFERENCES warengruppenfamilien(id) ON DELETE CASCADE, name VARCHAR(500),deleted INTEGER DEFAULT 0,reserve1 VARCHAR(500) default NULL,reserve2 VARCHAR(500) default NULL,PRIMARY KEY  (id))",
482}