Package com.ledruide.druidecave.dao

Examples of com.ledruide.druidecave.dao.Bottle


        CombosProxy.add(comboVigneron, VigneronProxy.getKeyValueList(ComponentTools.getClefFromCombo(comboCountry),
                                                                     ComponentTools.getClefFromCombo(comboRegion),
                                                                     ComponentTools.getClefFromCombo(comboDenomination)), true);
        CombosProxy.add(comboCountry, CountryProxy.getKeyValueList(), true);

        Bottle bouteille =  BottlesProxy.getSessionBouteilleFromID();
        ComponentTools.positionnerCombo(comboCountry, bouteille.getCountry_id());
        ComponentTools.positionnerCombo(comboRegion, bouteille.getRegion_id());
        ComponentTools.positionnerCombo(comboDenomination, bouteille.getDenomination_id());
        ComponentTools.positionnerCombo(comboClassification, bouteille.getClassification_id());
        ComponentTools.positionnerCombo(comboFormat, bouteille.getFormat_id());
        ComponentTools.positionnerCombo(comboColor, bouteille.getColor_id());
        ComponentTools.positionnerCombo(comboVigneron, bouteille.getVigneron_id());
        fieldYear.setText(bouteille.getYear());
        fieldAwakening.setText(bouteille.getAwakening());
        fieldQuantity.setText(bouteille.getQuantity());
        fieldPrice.setText(bouteille.getPrice());
        fieldName.setText(bouteille.getName());

    }
View Full Code Here


            SwapFrame.getInstance().init(BottleSearch.class);
        }
        else if (e.getSource().equals(buttonDelete)) {
            try {
                if (showQuestion(I18nScreens.getInstance().get("screen.bottle.detail.button.delete.warning"))) {
                    Bottle boutanche = BottlesProxy.getSessionBouteilleFromID();
                    BottlePeer.delete(boutanche);
                    SwapFrame.getInstance().init(BottleSearch.class);
                }
                else {
                    SwapFrame.getInstance().init(BottleDetail.class);
                }

            }
            catch (Exception ex) {
                System.out.println("Impossible d'enregistrer ce r�coltant : ");
                // ERREUR
                ex.printStackTrace();
            }
        }
        else if (e.getSource().equals(buttonValidate)) {
            // Il nous faut enregistrer la bouteille !

            try {
                Bottle boutanche =  BottlesProxy.getSessionBouteilleFromID();
                boutanche.setYear(fieldYear.getText());
                boutanche.setAwakening(fieldAwakening.getText());
                boutanche.setDenomination_id(ComponentTools.getClefFromCombo(comboDenomination));
                boutanche.setClassification_id(ComponentTools.getClefFromCombo(comboClassification));
                boutanche.setFormat_id(ComponentTools.getClefFromCombo(comboFormat));
                boutanche.setName(fieldName.getText());
                boutanche.setCountry_id(ComponentTools.getClefFromCombo(comboCountry));
                boutanche.setPrice(fieldPrice.getText());
                boutanche.setQuantity(fieldQuantity.getText());
                boutanche.setVigneron_id(ComponentTools.getClefFromCombo(comboVigneron));
                boutanche.setRegion_id(ComponentTools.getClefFromCombo(comboRegion));
                boutanche.setColor_id(ComponentTools.getClefFromCombo(comboColor));

                if (boutanche.save()) {
                    SwapFrame.getInstance().init(BottleSearch.class);
                }
            }
            catch (Exception ex) {
                ex.printStackTrace();
View Full Code Here

        columnNames = LES_TITRES;
        dataVector = new Vector();
    }

    public Object getValueAt(int row, int col) {
        Bottle objet = (Bottle)dataVector.get(row);
        if (objet != null) {
            try {
                switch (col) {
                    case INDEX_NAME:
                        return objet.getName();
                    case INDEX_REGION:
                        return RegionProxy.get(objet.getCountry_id(), objet.getRegion_id());
                    case INDEX_COLOR:
                        return ColorProxy.get(objet.getColor_id());
                    case INDEX_YEAR:
                        return objet.getYear();
                    case INDEX_QUANTITY:
                        return objet.getQuantity();
                }
            }
            catch (Exception e) {
                System.out.println("Une erreur est survenue durant l'affichage : " + e.getMessage());
            }
View Full Code Here

        buttonBack.setText(I18nScreens.getInstance().get(buttonBack.getText()));
        buttonNew.setText(I18nScreens.getInstance().get(buttonNew.getText()));
    }

    public void initEach() throws Exception {
        Bottle bouteille =  BottlesProxy.getSessionBouteilleFromID();
        fieldName.setText(bouteille.getName());
        fieldYear.setText(bouteille.getYear());

        resultats.getSelectionModel().clearSelection();
        tableModel.vider();

        Tasting degust = new Tasting();
        degust.setBoltle_id(bouteille.getId());
        List results = TastingPeer.find(degust);
        tableModel.addRows(results);

        fieldDate.setText("");
        fieldNote.setText("");
View Full Code Here

              || e.getSource().equals(comboFormat)) {
            recherche();
        }
        else if (e.getSource().equals(buttonDetail)) {
            // ici on part sur le d�tail d'une bouteille
            Bottle bout = (Bottle) tableModel.getSelection(tableResultats.getSelectedRow());
            if (bout != null) {
                Session.getInstance().setAttribute("BOUTEILLE_ID", bout.getId());
                SwapFrame.getInstance().init(BottleDetail.class);
            }
        }
        else {
            System.out.println("Ce boutton n'existe pas : " + e.getSource().getClass().toString());
View Full Code Here

        String leType   = ComponentTools.getClefFromCombo(comboColor);
        String leNom  = fieldName.getText();
        String lAnnee = fieldYear.getText();
        String lEveil = fieldAwakening.getText();

        Bottle recherche = new Bottle();
        // Le nom n'est pas ajout� car on en fait un startWith
        if (!TextTools.isNullOrEmpty(lePays))   recherche.setCountry_id(lePays);
        if (!TextTools.isNullOrEmpty(laRegion)) recherche.setRegion_id(laRegion);
        if (!TextTools.isNullOrEmpty(lAppellation)) recherche.setDenomination_id(lAppellation);
        if (!TextTools.isNullOrEmpty(leFormat)) recherche.setFormat_id(leFormat);
        if (!TextTools.isNullOrEmpty(leType)) recherche.setColor_id(leType);
        if (!TextTools.isNullOrEmpty(lAnnee)) recherche.setYear(lAnnee);
        if (!TextTools.isNullOrEmpty(lEveil)) recherche.setAwakening(lEveil);

        try {
            List results = BottlePeer.find(recherche);
            // Si le nom pass� en argument n'est pas nul ou vide
            if (!TextTools.isNullOrEmpty(leNom)) {
                // Nous faisons une recherche sur chaque �l�ment qui peut contenir
                // une partie du nom pass� en argument
                Iterator liste = results.iterator();
                while (liste.hasNext()) {
                    Bottle bout = (Bottle) liste.next();
                    if (bout != null && bout.getName() != null) {
                        if (bout.getName().indexOf(leNom) == -1) {
                            liste.remove();
                        }
                    }
                }
            }
View Full Code Here

     * @throws Exception si une erreur survient
     */
    private void lesBouteilles() throws Exception {
        // Commen�ons par les bouteilles
        for (int i = 0; i < bouteilles.size(); i++) {
            Bottle orig = (Bottle) bouteilles.get(i);
            // Trouvons les caract�ristiques suivantes :

            // Pays
//            String ancien_pays = orig.getCountry_id();
//            String pays_id = Finder.pays(ancien_pays, pays);
//            if (pays_id != null) orig.setCountry_id(pays_id);
//            //else /* Demander � l'utilisateur */ continue;
//
//            // R�gion si pays non null
//            String ancien_region = orig.getRegion_id();
//            String region_id = Finder.region(ancien_region, ancien_pays, pays_id, regions);
//            if (region_id != null) orig.setRegion_id(region_id);
//            //else /* Demander � l'utilisateur */ continue;
//
//            // Appellation si region non nulle
//            String appellation_id = Finder.appellation(orig.getDenomination_id(), ancien_region, region_id, appellations);
//            if (appellation_id != null) orig.setDenomination_id(appellation_id);
//            //else /* Demander � l'utilisateur */ continue;
//
//            // Classification si region non nulle
//            String classification_id = Finder.classification(orig.getClassification_id(), ancien_region, region_id, classifications);
//            if (classification_id != null) orig.setClassification_id(classification_id);
//            //else /* Demander � l'utilisateur */ continue;
//
//            // Type
//            String type_id = Finder.type(orig.getColor_id(), types);
//            if (type_id != null) orig.setColor_id(type_id);
//            //else /* Demander � l'utilisateur */ continue;
//
//            // Format
//            String format_id = Finder.format(orig.getFormat_id(), formats);
//            if (format_id != null) orig.setFormat_id(format_id);
//            //else /* Demander � l'utilisateur */ continue;

            orig.save();
        }
    }
View Full Code Here

        if (TextTools.isNullOrEmpty(ihm.getFieldName().getText())) {
            ihm.addMessages(ihm.getFieldName(), I18nScreens.getInstance().get("screen.bottle.add.error.name"));
            return false;
        }

        Bottle boutanche = new Bottle();
        boutanche.setYear(ihm.getFieldYear().getText());
        boutanche.setAwakening(ihm.getFieldAwakening().getText());
        boutanche.setDenomination_id(ComponentTools.getClefFromCombo(ihm.getComboDenomination()));
        boutanche.setClassification_id(ComponentTools.getClefFromCombo(ihm.getComboClassification()));
        boutanche.setFormat_id(ComponentTools.getClefFromCombo(ihm.getComboFormat()));
        boutanche.setName(ihm.getFieldName().getText());
        boutanche.setCountry_id(ComponentTools.getClefFromCombo(ihm.getComboCountry()));
        boutanche.setPrice(ihm.getFieldPrice().getText());
        boutanche.setQuantity(ihm.getFieldQuantity().getText());
        boutanche.setVigneron_id(ComponentTools.getClefFromCombo(ihm.getComboVigneron()));
        boutanche.setRegion_id(ComponentTools.getClefFromCombo(ihm.getComboRegion()));
        boutanche.setColor_id(ComponentTools.getClefFromCombo(ihm.getComboColor()));

        try {
            return boutanche.save();
        }
        catch (Exception e) {
            ihm.addMessages(null, I18nScreens.getInstance().get("screen.bottle.add.error.name"));
            return false;
        }
View Full Code Here

        try {
            List bouteilles = BottlePeer.findAll();
            if (bouteilles != null) {
                // Ici il faut parcourir et r�cup�rer chaque quantit�
                for (int i = 0; i < bouteilles.size(); i++) {
                    Bottle bout = (Bottle) bouteilles.get(i);
                    String boutQ = bout.getQuantity();
                    if (TextTools.isNullOrEmpty(boutQ)) {
                        boutQ = "0";
                    }
                    quantite += Integer.parseInt(boutQ);
                }
View Full Code Here

        try {
            List bouteilles = BottlePeer.findAll();
            if (bouteilles != null) {
                // Ici il faut parcourir et r�cup�rer chaque quantit�
                for (int i = 0; i < bouteilles.size(); i++) {
                    Bottle bout = (Bottle) bouteilles.get(i);
                    // Si l'ann�e d'�veil est cette ann�e
                    if (annee.equals(bout.getAwakening())) {
                        String boutQ = bout.getQuantity();
                        if (TextTools.isNullOrEmpty(boutQ)) {
                            boutQ = "0";
                        }
                        quantite += Integer.parseInt(boutQ);
                    }
View Full Code Here

TOP

Related Classes of com.ledruide.druidecave.dao.Bottle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.