Primer commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package org.palomafp.aadd.tma;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.palomafp.aadd.tma.vo.Pais;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
BufferedReader bfr = new BufferedReader(new FileReader("C:\\Users\\alumnoT\\aadd\\fic02\\informacion_paises.txt"));
|
||||
String linea;
|
||||
String[] datos;
|
||||
while((linea = bfr.readLine()) != null) {
|
||||
if (!linea.startsWith("#") && !linea.startsWith("-")) {
|
||||
linea = linea.replace("\"", "");
|
||||
linea = linea.replace(" ", "");
|
||||
datos = linea.split(",");
|
||||
Pais p = new Pais(Integer.parseInt(datos[1]), datos[2], datos[3], datos[0]);
|
||||
System.out.println(p);
|
||||
System.out.println("INSERT INTO T_PAIS VALUES("+linea.replace('"', '\'')+");");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.palomafp.aadd.tma.vo;
|
||||
|
||||
public class Continente {
|
||||
|
||||
private String codigo;
|
||||
private String nombre;
|
||||
|
||||
|
||||
public Continente() {
|
||||
codigo = null;
|
||||
nombre = null;
|
||||
}
|
||||
|
||||
public Continente(String cod) {
|
||||
codigo = cod;
|
||||
nombre = null;
|
||||
}
|
||||
|
||||
public String getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
public void setCodigo(String codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String imprimir = "Continente [codigo="+this.codigo+", nombre="+this.nombre+"]";
|
||||
return imprimir;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.palomafp.aadd.tma.vo;
|
||||
|
||||
public class Pais {
|
||||
|
||||
private int identificador;
|
||||
private String nombre;
|
||||
private String capital;
|
||||
private Continente continente;
|
||||
|
||||
public Pais() {
|
||||
identificador = -1;
|
||||
nombre = null;
|
||||
capital = null;
|
||||
continente = null;
|
||||
}
|
||||
|
||||
public Pais(int id, String name, String cap, String con) {
|
||||
identificador = id;
|
||||
nombre = name;
|
||||
capital = cap;
|
||||
this.continente = new Continente(con);
|
||||
}
|
||||
|
||||
public int getIdentificador() {
|
||||
return identificador;
|
||||
}
|
||||
public void setIdentificador(int identificador) {
|
||||
this.identificador = identificador;
|
||||
}
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
public String getCapital() {
|
||||
return capital;
|
||||
}
|
||||
public void setCapital(String capital) {
|
||||
this.capital = capital;
|
||||
}
|
||||
public Continente getContinente() {
|
||||
return continente;
|
||||
}
|
||||
public void setContinente(Continente continente) {
|
||||
this.continente = continente;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String imprimir = "Pais [identificador="+this.identificador+", nombre="+this.nombre+", capital="+this.capital+", continente="+this.continente.toString()+"]";
|
||||
|
||||
return imprimir;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user