示例#1
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id    = null;
            string val   = null;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"   : id    = reader.Value; break;
                    case "val"  : val   = reader.Value; break;
                    default     : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null) this.id = id;
            // carga el valor
            if (val != null) this.valor = val;
        }
示例#2
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id    = null;
            string tipo  = null;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"   : id    = reader.Value; break;
                    case "tipo" : tipo  = reader.Value; break;
                    default     : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null) this.id = id;
            // carga el tipo
            if (tipo != null)
            {
                switch (tipo)
                {
                    case "M": // Mayúsculas
                        min = (int) 'A';
                        max = (int) 'Z' + 1;
                        break;
                    case "m": // minúsculas
                        min = (int) 'a';
                        max = (int) 'z' + 1;
                        break;
                    default:
                        ErrorValor(entidad, id, "tipo", tipo);
                        break;
                }
                this.tipo = tipo;
            }
            else
            {
                // existe una ordenación secuencial A-Z y a-Z
                min = Math.Min((int) 'a', (int) 'A');
                max = Math.Max((int) 'z', (int) 'Z') + 1;
            }
        }
示例#3
0
        public ETLGenerador()
        {
            delim     = "\"";
            sepCampos = ";";
            sepFilas  = "\r\n";
            tamMax    = 50;

            candidatas = new ArrayList();
            unicas     = new ArrayList();
            noNulos    = new ArrayList();
            candidatasGeneradas = new ArrayList();
            unicasGeneradas     = new ArrayList();
            numFilasDescartadas = 0;

            configuracion = new ETLConfig();
            generadores   = new ArrayList();
        }
示例#4
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id    = null;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"   : id    = reader.Value; break;
                    default     : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga la constante
            if (reader.Read() && reader.NodeType == XmlNodeType.Text)
            {
                constante = reader.Value;
            }
            else
            {
                throw new XmlException(GetType() +
                    ": se esperaba un nodo de texto (línea " + reader.LineNumber + ")");
            }
            // @TODO Solucionar
            if (!reader.Read() || reader.NodeType != XmlNodeType.EndElement)
            {
                throw new XmlException("se esperaba la etiqueta de cierre");
            }
            // carga el id
            if (id != null) this.id = id;
        }
示例#5
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id  = null;
            string gen = null;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id" : id  = reader.Value; break;
                    case "gen": gen = reader.Value; break;
                    default   : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null) this.id = id;
            // carga la referencia
            if (gen != null)
            {
                this.gen = gen;
            }
            else
            {
                ErrorValor(entidad, id, "gen", "");
            }
            // carga el generador referenciado
            generador = configuracion.GetGenerador(gen);
        }
示例#6
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id   = null;
            string file = null;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"  : id  = reader.Value;  break;
                    case "file": file = reader.Value; break;
                    default   : ErrorAtributo(entidad,
                                    reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null) this.id = id;
            // carga el archivo
            if (file != null)
            {
                this.file = file;
            }
            else
            {
                ErrorValor(entidad, id, "file", "");
            }

            CargarFechas();
        }
示例#7
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id         = null;
            string tabla      = null;
            string delimColum = null;
            string spColum    = null;
            string spFilas    = null;
            ArrayList nums = new ArrayList();
            ArrayList noms = new ArrayList();

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"         : id         = reader.Value; break;
                    case "tabla"      : tabla      = reader.Value; break;
                    case "delim-colum": delimColum = reader.Value; break;
                    case "sp-colum"   : spColum    = reader.Value; break;
                    case "sp-filas"   : spFilas    = reader.Value; break;
                    case "nom-colum":
                        noms.Add(reader.Value);
                        break;
                    case "num-colum":
                        if (int.Parse(reader.Value) <= 0)
                        {
                            ErrorValor(entidad, id, "num-colum", reader.Value);
                        }
                        nums.Add(int.Parse(reader.Value).ToString());
                        break;
                    default: ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga la especificación de las columnas
            if ((nums.Count == 0) && (noms.Count == 0))
            {
                ErrorValor(entidad, id, "nombre-columnas", "");
            }
            else if ((nums.Count != 0) && (noms.Count != 0))
            {
                ErrorValor(entidad, id, "nombre-columnas", "");
            }
            else
            {
                if (nums.Count != 0)
                {
                    especColumnas = nums;
                    especNumeros  = true;
                }
                else // noms.Count != 0
                {
                    especColumnas = noms;
                    especNumeros  = false;
                }
            }
            // descompone la clave ajena en las columnas necesarias
            Descomponer();
            // carga el id
            if (id != null) this.id = id;
            // carga el delimitador de columnas
            if (delimColum != null)
            {
                delimColum = delimColum;
                if (delimColum.Length > 1)
                {
                    ErrorValor(entidad, id, "delim-colum", delimColum);
                }
                else
                {
                    this.delimColum = delimColum[0];
                }
            }
            // carga el separador de columnas
            if (spColum != null)
            {
                spColum = spColum.Replace(@"\t", "\t");
                if (spColum.Length > 1)
                {
                    ErrorValor(entidad, id, "sp-colum", spColum);
                }
                else
                {
                    this.spColum = spColum[0];
                }
            }
            // carga el separador de filas
            if (spFilas != null)
            {
                spFilas = spFilas.Replace(@"\n", "\n");
                spFilas = spFilas.Replace(@"\r", "\r");
                if (spFilas.Length > 1)
                {
                    ErrorValor(entidad, id, "sp-filas", spFilas);
                }
                else
                {
                    this.spFilas = spFilas[0];
                }
            }
            // carga la tabla
            if (tabla != null)
            {
                CargarFilas(TABLA_PATH + tabla + TABLA_EXT);
                this.tabla = tabla;
            }
            else
            {
                ErrorValor(entidad, id, "tabla", "");
            }
        }
示例#8
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id        = null;
            double min       = 0.0;
            double max       = 0.0;
            double paso      = -1.0;
            int    escala    = -1;
            bool   iniMin    = false;
            bool   iniMax    = false;
            bool   iniPaso   = false;
            bool   iniEscala = false;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"    : id     = reader.Value; break;
                    case "min"   : min    = double.Parse(reader.Value, estilo, formatoEntrada); iniMin    = true; break;
                    case "max"   : max    = double.Parse(reader.Value, estilo, formatoEntrada); iniMax    = true; break;
                    case "paso"  : paso   = double.Parse(reader.Value, estilo, formatoEntrada); iniPaso   = true; break;
                    case "escala": escala = int   .Parse(reader.Value, estilo, formatoEntrada); iniEscala = true; break;
                    default     : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null)
            {
                this.id = id;
            }
            // carga los límites
            if (iniMin && iniMax)
            {
                if (min > max)
                {
                    ErrorValor(entidad, id, "max", max.ToString("F" + escala, formatoEntrada));
                }
                else
                {
                    this.min = min;
                    this.max = max;
                }
            }
            else if (iniMin)
            {
                if (min > this.max)
                {
                    ErrorValor(entidad, id, "min", min.ToString("F" + escala, formatoEntrada));
                }
                else
                {
                    this.min = min;
                }
            }
            else if (iniMax)
            {
                if (this.min > max)
                {
                    ErrorValor(entidad, id, "max", max.ToString("F" + escala, formatoEntrada));
                }
                else
                {
                    this.max = max;
                }
            }
            // carga el paso
            if (iniPaso && (paso >= 0.0))
            {
                this.paso = paso;
            }
            else if (iniPaso)
            {
                ErrorValor(entidad, id, "paso", paso.ToString("F" + escala, formatoEntrada));
            }
            // carga la precision
            // carga el paso
            if (iniEscala && (escala >= 0))
            {
                this.escala = (uint) escala;
            }
            else if (iniEscala)
            {
                ErrorValor(entidad, id, "escala", escala.ToString());
            }
        }
示例#9
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id      = null;
            long    min     = -1;
            long    max     = -1;
            long    paso    = -1;
            bool   iniMin  = false;
            bool   iniMax  = false;
            bool   iniPaso = false;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"   : id    = reader.Value; break;
                    case "min"  : min   = long.Parse(reader.Value); iniMin  = true; break;
                    case "max"  : max   = long.Parse(reader.Value); iniMax  = true; break;
                    case "paso" : paso  = long.Parse(reader.Value); iniPaso = true; break;
                    default     : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null)
            {
                this.id = id;
            }
            // carga los límites
            if (iniMin && iniMax)
            {
                if (min > max)
                {
                    ErrorValor(entidad, id, "max", max.ToString());
                }
                else
                {
                    this.min = min;
                    this.max = max;
                }
            }
            else if (iniMin)
            {
                if (min > this.max)
                {
                    ErrorValor(entidad, id, "min", min.ToString());
                }
                else
                {
                    this.min = min;
                }
            }
            else if (iniMax)
            {
                if (this.min > max)
                {
                    ErrorValor(entidad, id, "max", max.ToString());
                }
                else
                {
                    this.max = max;
                }
            }
            // carga el paso
            if (iniPaso && (paso >= 0))
            {
                this.paso = (uint) paso;
            }
            else if (iniPaso)
            {
                ErrorValor(entidad, id, "paso", paso.ToString());
            }
        }