Package net.n3.nanoxml

Examples of net.n3.nanoxml.XMLElement


        String label = "";
        String set = null;
        String trueValue = null;
        String falseValue = null;
        String variable = spec.getAttribute(VARIABLE);
        XMLElement detail = spec.getFirstChildNamed(SPEC);
        Vector suppress = getFieldSuppressionList( spec ); // ###ead
        if (variable == null) { return; }

        if (detail != null)
        {
            label = getText(detail);
            set = detail.getAttribute(SET);
            trueValue = detail.getAttribute(TRUE);
            falseValue = detail.getAttribute(FALSE);
        }

        VCheckBox checkbox = new VCheckBox(label, varMap, idata, spec);

        if (set != null)
        {
            if (set != null && !"".equals(set)){
                VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
                set = vs.substitute(set, null);
            }
            if (set.equals(FALSE))
            {
                checkbox.setSelected(false);
            }
            if (set.equals(TRUE))
            {
                checkbox.setSelected(true);
            }
        }

        // ----------------------------------------------------
        // get the description and add it to the list of UI
        // elements if it exists.
        // ----------------------------------------------------
        XMLElement element = spec.getFirstChildNamed(DESCRIPTION);
        addDescription( element, forPacks, forOs, suppress );

        TwoColumnConstraints constraints = new TwoColumnConstraints();
        constraints.position = TwoColumnConstraints.BOTH;
        constraints.stretch = true;
View Full Code Here


    /*--------------------------------------------------------------------------*/
    protected void addSearch(XMLElement spec)
    {
        Vector forPacks = spec.getChildrenNamed(SELECTEDPACKS);
        Vector forOs = spec.getChildrenNamed(OS);
        XMLElement element = spec.getFirstChildNamed(SPEC);
        String variable = spec.getAttribute(VARIABLE);
        String filename = null;
        String check_filename = null;
        int search_type = 0;
        int result_type = 0;
        JComboBox combobox = new JComboBox();
        JLabel label = null;

        // System.out.println ("adding search combobox, variable "+variable);

        // allow the user to enter something
        combobox.setEditable(true);

        // ----------------------------------------------------
        // extract the specification details
        // ----------------------------------------------------
        if (element != null)
        {
            label = new JLabel(getText(element));

            // search type is optional (default: file)
            search_type = SearchField.TYPE_FILE;

            String search_type_str = element.getAttribute(SEARCH_TYPE);

            if (search_type_str != null)
            {
                if (search_type_str.equals(SEARCH_FILE))
                {
                    search_type = SearchField.TYPE_FILE;
                }
                else if (search_type_str.equals(SEARCH_DIRECTORY))
                {
                    search_type = SearchField.TYPE_DIRECTORY;
                }
            }

            // result type is mandatory too
            String result_type_str = element.getAttribute(SEARCH_RESULT);

            if (result_type_str == null)
            {
                return;
            }
            else if (result_type_str.equals(SEARCH_FILE))
            {
                result_type = SearchField.RESULT_FILE;
            }
            else if (result_type_str.equals(SEARCH_DIRECTORY))
            {
                result_type = SearchField.RESULT_DIRECTORY;
            }
            else if (result_type_str.equals(SEARCH_PARENTDIR))
            {
                result_type = SearchField.RESULT_PARENTDIR;
            }
            else
            {
                return;
            }

            // might be missing - null is okay
            filename = element.getAttribute(SEARCH_FILENAME);

            check_filename = element.getAttribute(SEARCH_CHECKFILENAME);

            Vector choices = element.getChildrenNamed(SEARCH_CHOICE);

            if (choices == null) { return; }

            for (int i = 0; i < choices.size(); i++)
            {
                XMLElement choice_el = (XMLElement) choices.elementAt(i);

                if (!OsConstraint.oneMatchesCurrentSystem(choice_el)) continue;

                String value = choice_el.getAttribute(SEARCH_VALUE);

                combobox.addItem(value);

                String set = ((XMLElement) choices.elementAt(i)).getAttribute(SET);
                if (set != null)
View Full Code Here

        System.out.println("Descripciones ..." + ansDescriptions);
        PreparedStatement stmtItem = c.prepareStatement("insert into articulo ( codigo , descripcion , fecha_registro , "
                    + "codigo_de_barras , modelo , unidad_venta, "
                    + "existencia_actual, bloqueado, imagen, descuento ) values (?,?,now(),?,?,?,0,0,?,?)");
        PreparedStatement stmtBarcode = c.prepareStatement("insert IGNORE into codigo_de_barras(codigo_de_articulo,codigo_de_barras) values(?,?)");
        XMLElement xmlI = null;
        for (Object x : xml.getChildren()) {
            xmlI = (XMLElement)x;
            if ( !itemsNeededJustOnce.contains(xmlI.getAttribute("MATNR","")) ){
                stmtItem.setString(1, xmlI.getAttribute("MATNR",""));
                stmtItem.setString(2, xmlI.getAttribute("MAKTG",""));
                stmtItem.setString(3, xmlI.getAttribute("EAN11",""));
                stmtItem.setString(4, xmlI.getAttribute("MATKL",""));
                stmtItem.setString(5, xmlI.getAttribute("MSEH3",""));
                stmtItem.setString(6, Shared.getConfig("photoDir") + xmlI.getAttribute("MATNR","") + ".JPG");
                stmtItem.setString(7, "0");
                stmtItem.executeUpdate();

                stmtBarcode.setString(1, xmlI.getAttribute("MATNR",""));
                stmtBarcode.setString(2, xmlI.getAttribute("EAN11",""));
                stmtBarcode.executeUpdate();

                itemsNeededJustOnce.add(xmlI.getAttribute("MATNR",""));

            }
            xmlI = null;
        }

        itemsNeededJustOnce = null;
        xml = null;
        parser = null;
        reader = null;
        ansDescriptions = null;

        Iterator<XMLElement> itr = Shared.itemsNeeded.iterator();
        stmtItem = c.prepareStatement("update articulo set existencia_actual = existencia_actual + ? where codigo = ? ");
        while ( itr.hasNext() ){
            xmlI = itr.next();
            int reason = 1;
            if ( checkReason ){
                reason = Shared.calculateReason(xmlI.getAttribute("BWART",""), xmlI.getAttribute("SHKZG",""));
            }
            if ( reason == 0 ){
                // we are in problems... =(
            }else{
                stmtItem.setString(2, xmlI.getAttribute("MATNR",""));
                stmtItem.setInt(1, reason * Integer.parseInt(xmlI.getAttribute("MENGE","").split("\\.")[0]));
                int ans = stmtItem.executeUpdate();
                if ( ans == 0 ){
                    // We are in problemas again... ='(
                }
            }
View Full Code Here

        PreparedStatement stmtUpdate = c.prepareStatement("update articulo set descuento = ? where codigo = ? ");
        PreparedStatement stmtDelete = c.prepareStatement("delete from precio where codigo_de_articulo = ? and fecha = curdate() ");
        PreparedStatement stmtInsert = c.prepareStatement("insert into precio ( codigo_de_articulo , monto , fecha ) values ( ? , ? , curdate() ) ");
        PreparedStatement stmtItem = c.prepareStatement("select codigo from articulo where codigo = ?");
       
        XMLElement xmlI = null;
        Double dis = null;
        String disS = null;
        parser = null;
        reader = null;
        System.out.println("Comenzo a fijar los descuentos...");
        ResultSet rs = null;
        for (Object x : xml.getChildren()) {

            xmlI = (XMLElement)x;

            if ( xmlI.getAttribute("KONWA","").equals("%") ) {
                dis = -1*Double.parseDouble(xmlI.getAttribute("KBETR",""))/10;
                disS = (dis+"").substring(0,Math.min((dis+"").length(), 5));

                stmtUpdate.setString(1, disS);
                stmtUpdate.setString(2, xmlI.getAttribute("VAKEY","").substring(4));
                stmtUpdate.executeUpdate();
            }else{
                stmtItem.setString(1, xmlI.getAttribute("VAKEY","").substring(6));
                rs = stmtItem.executeQuery();

                if ( rs.next() ){
                    stmtDelete.setString(1, xmlI.getAttribute("VAKEY","").substring(6));
                    stmtDelete.executeUpdate();
                    stmtInsert.setString(1, xmlI.getAttribute("VAKEY","").substring(6));
                    stmtInsert.setString(2, Double.parseDouble(xmlI.getAttribute("KBETR",""))+"");
                    stmtInsert.executeUpdate();
                }
            }

            xmlI = null;
View Full Code Here

        PreparedStatement stmtDeletePrice = c.prepareStatement("delete from precio where codigo_de_articulo = ? and fecha = curdate() ");
        PreparedStatement stmtInsertPrice = c.prepareStatement("insert into precio ( codigo_de_articulo , monto , fecha ) values ( ? , ? , curdate() ) ");

        for (Object x : xml.getChildren()) {
            XMLElement xmlI = (XMLElement)x;

            stmtUpdateItem.setString(1, xmlI.getAttribute("MAKTG",""));
            stmtUpdateItem.setString(2, xmlI.getAttribute("EAN11",""));
            stmtUpdateItem.setString(3, xmlI.getAttribute("MATKL",""));
            stmtUpdateItem.setString(4, xmlI.getAttribute("MSEH3",""));
            stmtUpdateItem.setString(5, xmlI.getAttribute("DISC",""));
            stmtUpdateItem.setString(6, xmlI.getAttribute("MATNR",""));
            int ans = stmtUpdateItem.executeUpdate();
           
            if ( ans == 0 ){
                stmtItem.setString(1, xmlI.getAttribute("MATNR",""));
                stmtItem.setString(2, xmlI.getAttribute("MAKTG",""));
                stmtItem.setString(3, xmlI.getAttribute("EAN11",""));
                stmtItem.setString(4, xmlI.getAttribute("MATKL",""));
                stmtItem.setString(5, xmlI.getAttribute("MSEH3",""));
                stmtItem.setString(6, Shared.getConfig("photoDir") + xmlI.getAttribute("MATNR","") + ".JPG");
                stmtItem.setString(7, xmlI.getAttribute("DISC",""));
                stmtItem.executeUpdate();
            }

            stmtBarcode.setString(1, xmlI.getAttribute("MATNR",""));
            stmtBarcode.setString(2, xmlI.getAttribute("EAN11",""));
            stmtBarcode.executeUpdate();

            stmtDeletePrice.setString(1, xmlI.getAttribute("MATNR",""));
            stmtDeletePrice.executeUpdate();

            stmtInsertPrice.setString(1, xmlI.getAttribute("MATNR",""));
            stmtInsertPrice.setString(2, xmlI.getAttribute("PRICE",""));
            stmtInsertPrice.executeUpdate();

            lastMovement = xmlI.getAttribute("MBLNR");
            // TODO QUITAR
            /*if ( !xmlI.getAttribute("MBLNR").equals("4900458135") && !xmlI.getAttribute("MBLNR").equals("4900458134")
                    && !xmlI.getAttribute("MBLNR").equals("4900458133") && !xmlI.getAttribute("MBLNR").equals("4900458130") && !xmlI.getAttribute("MBLNR").equals("4900458129")){
                continue;
            }*/
            /*if (
                    !xmlI.getAttribute("MBLNR").equals("4900447579")&& !xmlI.getAttribute("MBLNR").equals("4900447580")
                    && !xmlI.getAttribute("MBLNR").equals("4900447581")){
                continue;
            }*/
            int reason = Shared.calculateReason(xmlI.getAttribute("BWART",""), xmlI.getAttribute("SHKZG",""));
            // TODO QUITAR
            //reason *= -1;

            System.out.println("MBLNR = " + xmlI.getAttribute("MBLNR","") + " reason = " + reason + " codigo_articulo = " + xmlI.getAttribute("MATNR",""));

            stmtDetailsMovements.setString(1, xmlI.getAttribute("MATNR",""));
            stmtDetailsMovements.setInt(2, reason * Integer.parseInt(xmlI.getAttribute("MENGE","").split("\\.")[0]));
            stmtDetailsMovements.setString(3, xmlI.getAttribute("BWART",""));
            stmtDetailsMovements.executeUpdate();


            System.out.println("Movimiento " + reason + " articulo " + xmlI.getAttribute("MATNR",""));
        }

        stmtMI.setString(1, "lastSAPcodeAtInitialStock");
        stmtMI.setString(2, lastMovement);
        stmtMI.setString(3, "Ultimo Movimiento Para Inventario Inicial");
View Full Code Here

        IXMLElement xml = (IXMLElement) parser.parse();

        PreparedStatement stmt = c.prepareStatement("truncate empleado");
        stmt.executeUpdate();
        for (Object x : xml.getChildren()) {
            XMLElement xmlI = (XMLElement)x;

            stmt = c.prepareStatement("insert into empleado (codigo,nombre_completo, departamento) values(?,?,?)");
            stmt.setString(1, xmlI.getAttribute("c",""));
            stmt.setString(2, xmlI.getAttribute("n",""));
            stmt.setString(3, xmlI.getAttribute("d",""));
            stmt.executeUpdate();
        }

        try{
            c.commit();
View Full Code Here

        PreparedStatement stmtItem = c.prepareStatement("update articulo set descripcion = ? , "
                    + "codigo_de_barras = ? , modelo = ? , unidad_venta = ? "
                    + " where codigo = ?");
        PreparedStatement stmtBarcode = c.prepareStatement("update codigo_de_barras set codigo_de_barras = ? where codigo_de_articulo = ?");

        XMLElement xmlI = null;
        for (Object x : xml.getChildren()) {
            xmlI = (XMLElement)x;
            stmtItem.setString(1, xmlI.getAttribute("MAKTG",""));
            stmtItem.setString(2, xmlI.getAttribute("EAN11",""));
            stmtItem.setString(3, xmlI.getAttribute("MATKL",""));
            stmtItem.setString(4, xmlI.getAttribute("MSEH3",""));
            stmtItem.setString(5, xmlI.getAttribute("MATNR",""));
            stmtItem.executeUpdate();

            stmtBarcode.setString(2, xmlI.getAttribute("MATNR",""));
            stmtBarcode.setString(1, xmlI.getAttribute("EAN11",""));
            stmtBarcode.executeUpdate();

            xmlI = null;
        }
    }
View Full Code Here

        }
        if ( rs.getSize() > 0 ){
            CreditNoteGroup.add(rs);
        }

        IXMLElement xmlCN = new XMLElement("NotasDeCredito");

        for (ReceiptSap receiptSap : CreditNoteGroup) {
            IXMLElement child = xmlCN.createElement("CN");
            xmlCN.addChild(child);
            child.setAttribute("getId", receiptSap.getId());
            child.setAttribute("getKind", receiptSap.getKind());
            child.setAttribute("getClient", receiptSap.getClient());
            child.setAttribute("range", receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
            child.setAttribute("getZ", receiptSap.getZ());
View Full Code Here

        }
        if ( rs.getSize() > 0 ){
            receiptGroup.add(rs);
        }

        IXMLElement xmlRe = new XMLElement("Facturas");

        for (ReceiptSap receiptSap : receiptGroup) {
            IXMLElement child = xmlRe.createElement("Re");
            xmlRe.addChild(child);
            child.setAttribute("getId", receiptSap.getId());
            child.setAttribute("getKind", receiptSap.getKind());
            child.setAttribute("getClient", receiptSap.getClient());
            child.setAttribute("range", receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
            child.setAttribute("getZ", receiptSap.getZ());
View Full Code Here

    }

    private IXMLElement createClients() throws SQLException{
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando xml para clientes");
        XMLElement clienXML = new XMLElement("Clientes");

        TreeSet<String> clientsAdded = new TreeSet<String>();
        for (String c : clients) {
            Client cc = ConnectionDrivers.listClients(c).get(0);
            if ( !clientsAdded.contains(cc.getId()) ){
                IXMLElement client = clienXML.createElement("C");
                client.setAttribute("ID", cc.getId());
                String tname = cc.getName();
                client.setAttribute("Name", tname.substring(0,Math.min(35, tname.length())));
                String tc = cc.getAddress() + " Tlf: " + cc.getPhone();
                client.setAttribute("Addr", (tc).substring(0, Math.min(30,tc.length())));
                clienXML.addChild(client);
                clientsAdded.add(cc.getId());
            }
        }
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creado XML para clientes");
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.XMLElement

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.