List of usage examples for java.sql ResultSet getFloat
float getFloat(String columnLabel) throws SQLException;
ResultSet
object as a float
in the Java programming language. From source file:GestoSAT.GestoSAT.java
public Map recuperarVenta(int idAlbaran) { this.getStock(); try {//from www . j av a 2s . co m Statement st = con.createStatement(); ResultSet res = st.executeQuery("Select * FROM albaranes WHERE id_Albaran='" + idAlbaran + "' AND id_Presupuesto IS NULL ORDER BY id_Albaran DESC "); Statement stMaps; ResultSet resMaps; Map albaranes = new HashMap(); if (res.next()) { stMaps = con.createStatement(); resMaps = stMaps.executeQuery( "Select m_u.*,s.id_Proveedor FROM materiales_utilizados m_u INNER JOIN stock s ON m_u.id_Stock = s.id_Stock WHERE m_u.id_Albaran='" + idAlbaran + "' ORDER BY m_u.id_Albaran DESC "); Map materiales = new HashMap(); while (resMaps.next()) { // Materiales materiales .put(resMaps.getInt("m_u.id_Stock"), new MaterialTrabajos( ((Proveedor) this.proveedor.get(resMaps.getInt("s.id_Proveedor"))) .getStock(resMaps.getInt("m_u.id_Stock")), resMaps.getFloat("m_u.Cantidad"))); } Albaran albaran = new Albaran(res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total"), (res.getTimestamp("fch_Creacion")), this.getCliente(res.getInt("id_Cliente")), this); if (this.documento.putIfAbsent(idAlbaran + ";Albaran", albaran) == null) { albaran.getCliente().setAlbaran(idAlbaran, albaran); albaranes.put(idAlbaran, albaran); } else { ((Albaran) this.documento.get(idAlbaran + ";Albaran")).actualizarVenta( res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total")); albaranes.put(idAlbaran, this.documento.get(idAlbaran + ";Albaran")); } //((Cliente)this.cliente.get(res.getInt("id_cliente"))).setAlbaran(idAlbaran,(Albaran)this.documento.get(idAlbaran+";Albaran")); stMaps.close(); } st.close(); return albaranes; } catch (Exception ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); return new HashMap(); } }
From source file:GestoSAT.GestoSAT.java
public void cargarVentasPendientes(int idCliente) { int id_Albaran = 0; this.getStock(); try {/* www. j ava 2 s . c o m*/ Statement st = con.createStatement(); ResultSet res = st.executeQuery("Select * FROM albaranes WHERE id_Cliente='" + idCliente + "' AND id_Factura IS NULL AND id_Presupuesto IS NULL ORDER BY id_Albaran DESC "); Statement stMaps; ResultSet resMaps; while (res.next()) { id_Albaran = res.getInt("id_Albaran"); stMaps = con.createStatement(); resMaps = stMaps.executeQuery( "Select m_u.*,s.id_Proveedor FROM materiales_utilizados m_u INNER JOIN stock s ON m_u.id_Stock = s.id_Stock WHERE m_u.id_Albaran='" + id_Albaran + "' ORDER BY m_u.id_Albaran DESC "); Map materiales = new HashMap(); while (resMaps.next()) { // Materiales materiales .put(resMaps.getInt("m_u.id_Stock"), new MaterialTrabajos( ((Proveedor) this.proveedor.get(resMaps.getInt("s.id_Proveedor"))) .getStock(resMaps.getInt("m_u.id_Stock")), resMaps.getFloat("m_u.Cantidad"))); } Albaran albaran = new Albaran(res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total"), (res.getTimestamp("fch_Creacion")), this.getCliente(idCliente), this); if (this.documento.putIfAbsent(id_Albaran + ";Albaran", albaran) == null) albaran.getCliente().setAlbaran(id_Albaran, albaran); else ((Albaran) this.documento.get(id_Albaran + ";Albaran")).actualizarVenta( res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total")); stMaps.close(); } st.close(); } catch (Exception ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:GestoSAT.GestoSAT.java
public void reuperarVentasCliente(int idCliente) { int id_Albaran = 0; this.getStock(); try {// w w w . ja va 2 s . c om Statement st = con.createStatement(); ResultSet res = st.executeQuery("Select * FROM albaranes WHERE id_Cliente='" + idCliente + "' AND id_Presupuesto IS NULL ORDER BY id_Albaran DESC "); Statement stMaps; ResultSet resMaps; while (res.next()) { id_Albaran = res.getInt("id_Albaran"); stMaps = con.createStatement(); resMaps = stMaps.executeQuery( "Select m_u.*,s.id_Proveedor FROM materiales_utilizados m_u INNER JOIN stock s ON m_u.id_Stock = s.id_Stock WHERE m_u.id_Albaran='" + id_Albaran + "' ORDER BY m_u.id_Albaran DESC "); Map materiales = new HashMap(); while (resMaps.next()) { // Materiales materiales .put(resMaps.getInt("m_u.id_Stock"), new MaterialTrabajos( ((Proveedor) this.proveedor.get(resMaps.getInt("s.id_Proveedor"))) .getStock(resMaps.getInt("m_u.id_Stock")), resMaps.getFloat("m_u.Cantidad"))); } Albaran albaran = new Albaran(res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total"), (res.getTimestamp("fch_Creacion")), this.getCliente(idCliente), this); if (this.documento.putIfAbsent(id_Albaran + ";Albaran", albaran) == null) { albaran.getCliente().setAlbaran(id_Albaran, albaran); } else ((Albaran) this.documento.get(id_Albaran + ";Albaran")).actualizarVenta( res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total")); stMaps.close(); ((Cliente) this.cliente.get(idCliente)).setAlbaran(id_Albaran, (Albaran) this.documento.get(id_Albaran + ";Albaran")); } st.close(); } catch (Exception ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:GestoSAT.GestoSAT.java
public Map buscarAlbaran(String buscar, boolean pendiente) { try {/*from w w w . ja v a 2s . com*/ Statement st = con.createStatement(); Map albaranes = new HashMap(); // Albaran de Cita String consulta = "Select e.*, cli.*,cita.*, dir.*, a.*, GROUP_CONCAT(c_e.id_Usuario) empleados FROM (entradas e INNER JOIN" + " (presupuestos p INNER JOIN albaranes a ON p.id_Presupuesto = a.id_Presupuesto) ON e.id_Entrada = p.id_Entrada) INNER JOIN " + " ((direccion_citas dir INNER JOIN ((citas cita LEFT JOIN citas_empleados c_e ON cita.id_Cita = c_e.id_Cita)" + " LEFT JOIN usuarios u ON u.id_Usuario = c_e.id_Usuario) ON cita.Direccion = dir.id_Direccion )" + " INNER JOIN clientes cli ON cli.id_Cliente = cita.id_Cliente) ON e.id_entrada = cita.id_Entrada" + " WHERE (CONCAT(cli.nombre,' ',cli.apellidos) LIKE '%" + buscar + "%'" + " OR cli.Observaciones LIKE '%" + buscar + "%' OR cli.NIF LIKE'%" + buscar + "%' " + " OR cli.Provincia LIKE '%" + buscar + "%' OR cli.Poblacion LIKE '%" + buscar + "%' " + " OR cli.CP LIKE '%" + buscar + "%' OR cli.Calle LIKE '%" + buscar + "%' " + " OR cli.Numero LIKE '%" + buscar + "%' OR cli.Escalera LIKE '%" + buscar + "%' " + " OR cli.Piso LIKE '%" + buscar + "%' OR cli.Puerta LIKE '%" + buscar + "%' " + " OR cli.Correo_electronico LIKE '%" + buscar + "%' OR cli.tlf_Contacto LIKE '%" + buscar + "%' " + " OR cli.tlf_Auxiliar LIKE '%" + buscar + "%' OR e.lugar LIKE '%" + buscar + "%'" + " OR e.observaciones LIKE '%" + buscar + "%' OR cita.motivo LIKE '%" + buscar + "%'" + " OR cita.observaciones LIKE '%" + buscar + "%' OR dir.provincia LIKE '%" + buscar + "%'" + " OR dir.poblacion LIKE '%" + buscar + "%' OR dir.CP LIKE '%" + buscar + "%'" + " OR dir.Calle LIKE '%" + buscar + "%' OR dir.Numero LIKE '%" + buscar + "%'" + " OR dir.Escalera LIKE '%" + buscar + "%' OR dir.Piso LIKE '%" + buscar + "%'" + " OR dir.Puerta LIKE '%" + buscar + "%' OR a.concepto LIKE '%" + buscar + "%'" + " OR a.total LIKE '%" + buscar + "%' OR a.observaciones LIKE '%" + buscar + "%'" + " OR a.Provincia LIKE '%" + buscar + "%' OR a.Poblacion LIKE '%" + buscar + "%' " + " OR a.CP LIKE '%" + buscar + "%' OR a.Calle LIKE '%" + buscar + "%' " + " OR a.Numero LIKE '%" + buscar + "%' OR a.Escalera LIKE '%" + buscar + "%' " + " OR a.Piso LIKE '%" + buscar + "%' OR a.Puerta LIKE '%" + buscar + "%')"; if (pendiente) consulta += " AND a.id_Factura IS NULL "; consulta += " GROUP BY cita.id_Cita ORDER BY a.fch_Creacion DESC"; ResultSet res = st.executeQuery(consulta); Entrada entrada; Cliente cli; while (res.next()) { Map aux_empleados = new HashMap(); if (res.getString("empleados") != null) { String[] aux = res.getString("empleados").split(","); for (int i = 0; i < aux.length; i++) aux_empleados.put(aux[i], this.getEmpleado(Integer.parseInt(aux[i]))); } if (this.documento.get(res.getString("id_Entrada") + ";Entrada") == null) { if (this.cliente.get(res.getInt("cli.id_Cliente")) == null) { cli = new Cliente(res.getString("cli.nombre"), res.getString("cli.apellidos"), res.getString("cli.nif"), res.getString("cli.provincia"), res.getString("cli.poblacion"), res.getInt("cli.cp"), res.getString("cli.calle"), res.getString("cli.numero"), res.getString("cli.escalera"), res.getInt("cli.piso"), res.getString("cli.puerta"), res.getInt("cli.tlf_Contacto"), res.getInt("cli.tlf_Auxiliar"), res.getString("cli.correo_electronico"), res.getString("cli.observaciones"), this); this.cliente.putIfAbsent(res.getInt("cli.id_Cliente"), cli); } else { cli = (Cliente) this.cliente.get(res.getInt("cli.id_Cliente")); } entrada = new Entrada(res.getString("e.observaciones"), res.getString("e.lugar"), res.getTimestamp("e.fch_Entrada"), this, cli, new Cita(res.getTimestamp("cita.fch_Cita"), res.getString("dir.provincia"), res.getString("dir.poblacion"), res.getInt("dir.cp"), res.getString("dir.calle"), res.getString("dir.numero"), res.getString("dir.escalera"), res.getInt("dir.piso"), res.getString("dir.puerta"), aux_empleados, res.getString("cita.motivo"), res.getString("cita.observaciones"), res.getString("dir.observaciones"), null)); cli.setEntrada(res.getInt("id_Entrada"), entrada); this.documento.putIfAbsent(res.getInt("e.id_Entrada") + ";Entrada", entrada); } else { entrada = (Entrada) this.documento.get(res.getInt("e.id_Entrada") + ";Entrada"); } entrada.cargarPresupuesto(res.getInt("e.id_Entrada")); albaranes.put(res.getInt("a.id_Albaran") + ";Albaran", this.documento.get(res.getInt("a.id_Albaran") + ";Albaran")); } // Obtener albaranes averias consulta = "Select e.*, cli.*,av.*, ap.*, a.* FROM (entradas e INNER JOIN (presupuestos p " + "INNER JOIN albaranes a ON p.id_Presupuesto = a.id_Presupuesto) ON e.id_Entrada = p.id_Entrada ) INNER JOIN " + "((clientes cli INNER JOIN aparatos ap ON cli.id_Cliente = ap.id_Cliente) INNER JOIN averias av ON " + "ap.id_Aparato = av.id_Aparato) ON av.id_Entrada = e.id_Entrada WHERE (" + " CONCAT(cli.nombre,' ',cli.apellidos) LIKE '%" + buscar + "%'" + " OR cli.Observaciones LIKE '%" + buscar + "%' OR cli.NIF LIKE'%" + buscar + "%' " + " OR cli.Provincia LIKE '%" + buscar + "%' OR cli.Poblacion LIKE '%" + buscar + "%' " + " OR cli.CP LIKE '%" + buscar + "%' OR cli.Calle LIKE '%" + buscar + "%' " + " OR cli.Numero LIKE '%" + buscar + "%' OR cli.Escalera LIKE '%" + buscar + "%' " + " OR cli.Piso LIKE '%" + buscar + "%' OR cli.Puerta LIKE '%" + buscar + "%' " + " OR cli.Correo_electronico LIKE '%" + buscar + "%' OR cli.tlf_Contacto LIKE '%" + buscar + "%' " + " OR cli.tlf_Auxiliar LIKE '%" + buscar + "%' OR e.lugar LIKE '%" + buscar + "%'" + " OR e.observaciones LIKE '%" + buscar + "%' OR av.motivo LIKE '%" + buscar + "%'" + " OR av.descripcion LIKE '%" + buscar + "%' OR ap.tipo LIKE '%" + buscar + "%'" + " OR ap.marca LIKE '%" + buscar + "%' OR ap.modelo LIKE '%" + buscar + "%'" + " OR ap.color LIKE '%" + buscar + "%' OR ap.numero_serie LIKE '%" + buscar + "%'" + " OR ap.observaciones LIKE '%" + buscar + "%' OR a.concepto LIKE '%" + buscar + "%'" + " OR a.total LIKE '%" + buscar + "%' OR a.observaciones LIKE '%" + buscar + "%'" + " OR a.Provincia LIKE '%" + buscar + "%' OR a.Poblacion LIKE '%" + buscar + "%' " + " OR a.CP LIKE '%" + buscar + "%' OR a.Calle LIKE '%" + buscar + "%' " + " OR a.Numero LIKE '%" + buscar + "%' OR a.Escalera LIKE '%" + buscar + "%' " + " OR a.Piso LIKE '%" + buscar + "%' OR a.Puerta LIKE '%" + buscar + "%')"; if (pendiente) consulta += " AND a.id_Factura IS NULL "; consulta += " ORDER BY a.fch_Creacion DESC"; res = st.executeQuery(consulta); while (res.next()) { if (this.documento.get(res.getString("id_Entrada") + ";Entrada") == null) { if (this.cliente.get(res.getInt("cli.id_Cliente")) == null) { cli = new Cliente(res.getString("cli.nombre"), res.getString("cli.apellidos"), res.getString("cli.nif"), res.getString("cli.provincia"), res.getString("cli.poblacion"), res.getInt("cli.cp"), res.getString("cli.calle"), res.getString("cli.numero"), res.getString("cli.escalera"), res.getInt("cli.piso"), res.getString("cli.puerta"), res.getInt("cli.tlf_Contacto"), res.getInt("cli.tlf_Auxiliar"), res.getString("cli.correo_electronico"), res.getString("cli.observaciones"), this); this.cliente.putIfAbsent(res.getInt("cli.id_Cliente"), cli); } else { cli = (Cliente) this.cliente.get(res.getInt("cli.id_Cliente")); } entrada = new Entrada(res.getString("e.observaciones"), res.getString("e.lugar"), res.getTimestamp("e.fch_Entrada"), this, cli, new Averia(res.getString("av.motivo"), res.getString("av.descripcion"), new Aparato(res.getString("ap.tipo"), res.getString("ap.marca"), res.getString("ap.modelo"), res.getString("ap.color"), res.getString("ap.numero_serie"), res.getString("ap.observaciones"), cli, res.getInt("ap.id_Aparato")), null)); cli.setEntrada(res.getInt("id_Entrada"), entrada); this.documento.putIfAbsent(res.getInt("e.id_Entrada") + ";Etrada", entrada); } else { entrada = (Entrada) this.documento.get(res.getInt("e.id_Entrada") + ";Entrada"); } entrada.cargarPresupuesto(res.getInt("e.id_Entrada")); albaranes.put(res.getInt("a.id_Albaran") + ";Albaran", this.documento.get(res.getInt("a.id_Albaran") + ";Albaran")); } // Buscar en ventas consulta = "SELECT a.*, cli.* FROM (((albaranes a INNER JOIN clientes cli ON a.id_Cliente = cli.id_Cliente)" + " INNER JOIN materiales_utilizados mat ON mat.id_Albaran=a.id_Albaran) INNER JOIN stock s ON s.id_stock = mat.id_stock)" + " WHERE (CONCAT(cli.nombre,' ',cli.apellidos) LIKE '%" + buscar + "%'" + " OR cli.Observaciones LIKE '%" + buscar + "%' OR cli.NIF LIKE'%" + buscar + "%' " + " OR cli.Provincia LIKE '%" + buscar + "%' OR cli.Poblacion LIKE '%" + buscar + "%' " + " OR cli.CP LIKE '%" + buscar + "%' OR cli.Calle LIKE '%" + buscar + "%' " + " OR cli.Numero LIKE '%" + buscar + "%' OR cli.Escalera LIKE '%" + buscar + "%' " + " OR cli.Piso LIKE '%" + buscar + "%' OR cli.Puerta LIKE '%" + buscar + "%' " + " OR cli.Correo_electronico LIKE '%" + buscar + "%' OR cli.tlf_Contacto LIKE '%" + buscar + "%' " + " OR cli.tlf_Auxiliar LIKE '%" + buscar + "%' OR a.concepto LIKE '%" + buscar + "%'" + " OR a.total LIKE '%" + buscar + "%' OR a.observaciones LIKE '%" + buscar + "%'" + " OR a.Provincia LIKE '%" + buscar + "%' OR a.Poblacion LIKE '%" + buscar + "%' " + " OR a.CP LIKE '%" + buscar + "%' OR a.Calle LIKE '%" + buscar + "%' " + " OR a.Numero LIKE '%" + buscar + "%' OR a.Escalera LIKE '%" + buscar + "%' " + " OR a.Piso LIKE '%" + buscar + "%' OR a.Puerta LIKE '%" + buscar + "%'" + " OR s.nombre LIKE '%" + buscar + "%' OR s.descripcion LIKE '" + buscar + "')"; if (pendiente) consulta += " AND a.id_Factura IS NULL "; consulta += " ORDER BY a.fch_Creacion DESC"; res = st.executeQuery(consulta); int id_Albaran; ResultSet resMaps; Statement stMaps; this.getStock(); while (res.next()) { id_Albaran = res.getInt("id_Albaran"); stMaps = con.createStatement(); resMaps = stMaps.executeQuery( "Select m_u.*,s.id_Proveedor FROM materiales_utilizados m_u INNER JOIN stock s ON m_u.id_Stock = s.id_Stock WHERE m_u.id_Albaran='" + id_Albaran + "' ORDER BY m_u.id_Albaran DESC "); Map materiales = new HashMap(); while (resMaps.next()) { // Materiales materiales .put(resMaps.getInt("m_u.id_Stock"), new MaterialTrabajos( ((Proveedor) this.proveedor.get(resMaps.getInt("s.id_Proveedor"))) .getStock(resMaps.getInt("m_u.id_Stock")), resMaps.getFloat("m_u.Cantidad"))); } stMaps.close(); Albaran albaran = new Albaran(res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total"), res.getTimestamp("fch_Creacion"), this.getCliente(res.getInt("id_Cliente")), this); if (this.documento.putIfAbsent(id_Albaran + ";Albaran", albaran) == null) albaran.getCliente().setAlbaran(id_Albaran, albaran); else ((Albaran) this.documento.get(id_Albaran + ";Albaran")).actualizarVenta( res.getString("Concepto"), res.getString("Provincia"), res.getString("Poblacion"), res.getInt("CP"), res.getString("calle"), res.getString("numero"), res.getString("escalera"), res.getInt("piso"), res.getString("Puerta"), materiales, res.getString("Observaciones"), res.getFloat("Total")); albaranes.put(id_Albaran + ";Albaran", albaran); } return albaranes; } catch (SQLException ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); return new HashMap(); } }
From source file:GestoSAT.GestoSAT.java
public boolean guardarAlbaran(int idAlbaran, Albaran albaran) { try {// www . ja v a 2 s .c o m Map stock = this.getStock(); Statement st = con.createStatement(); if (st.executeUpdate("UPDATE albaranes SET Concepto='" + albaran.getConcepto() + "'," + " Provincia='" + albaran.getProvincia() + "'," + " Poblacion='" + albaran.getPoblacion() + "'," + " CP='" + albaran.getCp() + "'," + " Calle='" + albaran.getCalle() + "'," + " Numero='" + albaran.getNumero() + "'," + " Escalera='" + albaran.getEscalera() + "'," + " Piso='" + albaran.getPiso() + "'," + " Puerta='" + albaran.getPuerta() + "'," + " Observaciones='" + albaran.getObservaciones() + "'," + " Total='" + albaran.getTotal() + "'" + " WHERE id_Albaran='" + idAlbaran + "'") > 0) { st.close(); // Trabajo Statement stWorkers = con.createStatement(); ResultSet resWorkers = stWorkers.executeQuery( "Select GROUP_CONCAT(id_Usuario) Empleados FROM trabajos_realizados WHERE id_Albaran='" + idAlbaran + "' GROUP BY id_Albaran"); String[] idUsuarios; boolean[] empleadosExistentes; while (resWorkers.next()) { // Comprobar els que esxistisen i el que no idUsuarios = resWorkers.getString("Empleados").split(","); empleadosExistentes = new boolean[idUsuarios.length]; Statement stDelUsuarios = con.createStatement(); for (int x = 0; x < idUsuarios.length; x++) { for (int y = 0; y < albaran.getTrabajoRealizado().size() && !empleadosExistentes[x]; y++) if (idUsuarios[x].equals( albaran.getTrabajoRealizado().entrySet().toArray()[y].toString().split("=")[0])) empleadosExistentes[x] = true; if (!empleadosExistentes[x]) // Delete unused workers stDelUsuarios.executeUpdate("DELETE FROM trabajos_realizados WHERE id_Usuario='" + idUsuarios[x] + "' AND id_Albaran='" + idAlbaran + "'"); // Borrar de la base de datos else stDelUsuarios.executeUpdate("UPDATE trabajos_realizados SET horas='" + ((Trabajo) albaran.getTrabajoRealizado().get(Integer.parseInt(idUsuarios[x]))) .getHoras() + "', descripcion='" + ((Trabajo) albaran.getTrabajoRealizado().get(Integer.parseInt(idUsuarios[x]))) .getDescripcion() + "' WHERE id_Usuario='" + idUsuarios[x] + "' AND id_Albaran='" + idAlbaran + "'"); } stDelUsuarios.close(); } // Add els nous treballs Iterator itTrabajo = albaran.getTrabajoRealizado().entrySet().iterator(); while (itTrabajo.hasNext()) { Map.Entry auxTrabajo = (Map.Entry) itTrabajo.next(); stWorkers.executeUpdate("INSERT IGNORE INTO trabajos_realizados" + " (id_Albaran, id_Usuario, horas, descripcion) VALUES (" + " '" + idAlbaran + "','" + auxTrabajo.getKey() + "'," + " '" + ((Trabajo) auxTrabajo.getValue()).getHoras() + "'," + " '" + ((Trabajo) auxTrabajo.getValue()).getDescripcion() + "')"); } stWorkers.close(); // Material Statement stStock = con.createStatement(); ResultSet resStock = stStock.executeQuery( "Select GROUP_CONCAT(id_Stock) Materiales FROM materiales_utilizados WHERE id_Albaran='" + idAlbaran + "' GROUP BY id_Albaran"); String[] idStock = null; boolean[] stockExistentes = null; float aux_Cantidad; if (resStock.next()) { // Comprobar els que esxistisen i el que no idStock = resStock.getString("Materiales").split(","); stockExistentes = new boolean[idStock.length]; Statement stDelStock = con.createStatement(); ResultSet resActStock; for (int x = 0; x < idStock.length; x++) { for (int y = 0; y < albaran.getMaterialUtilizado().size() && !stockExistentes[x]; y++) if (idStock[x].equals(albaran.getMaterialUtilizado().entrySet().toArray()[y].toString() .split("=")[0])) stockExistentes[x] = true; if (!stockExistentes[x]) { // Delete unused workers { resActStock = stDelStock .executeQuery("SELECT cantidad FROM materiales_utilizados WHERE id_Stock='" + idStock[x] + "' AND id_Albaran='" + idAlbaran + "'"); resActStock.next(); aux_Cantidad = resActStock.getFloat("cantidad"); resActStock = stDelStock .executeQuery("SELECT unidades FROM stock WHERE id_Stock=" + idStock[x]); resActStock.next(); stDelStock.executeUpdate("UPDATE stock SET unidades='" + (aux_Cantidad + resActStock.getFloat("unidades")) + "' WHERE id_Stock=" + idStock[x]); ((Stock) stock.get(Integer.parseInt(idStock[x]))).anyadir(aux_Cantidad); stDelStock.executeUpdate("DELETE FROM materiales_utilizados WHERE id_Stock='" + idStock[x] + "' AND id_Albaran='" + idAlbaran + "'"); // Borrar de la base de datos } else { resActStock = stDelStock .executeQuery("SELECT cantidad FROM materiales_utilizados WHERE id_Stock='" + idStock[x] + "' AND id_Albaran='" + idAlbaran + "'"); resActStock.next(); aux_Cantidad = resActStock.getFloat("cantidad"); resActStock = stDelStock .executeQuery("SELECT unidades FROM stock WHERE id_Stock=" + idStock[x]); resActStock.next(); stDelStock .executeUpdate( "UPDATE stock SET unidades='" + ((aux_Cantidad - ((MaterialTrabajos) albaran.getMaterialUtilizado() .get(Integer.parseInt(idStock[x]))) .getCantidad()) + resActStock.getFloat("unidades")) + "' WHERE id_Stock=" + idStock[x]); if (aux_Cantidad > ((MaterialTrabajos) albaran.getMaterialUtilizado() .get(Integer.parseInt(idStock[x]))).getCantidad()) ((Stock) stock.get(Integer.parseInt(idStock[x]))) .anyadir((aux_Cantidad - ((MaterialTrabajos) albaran.getMaterialUtilizado() .get(Integer.parseInt(idStock[x]))).getCantidad())); else ((Stock) stock.get(Integer.parseInt(idStock[x]))) .quitar(-(aux_Cantidad - ((MaterialTrabajos) albaran.getMaterialUtilizado() .get(Integer.parseInt(idStock[x]))).getCantidad())); stDelStock.executeUpdate("UPDATE materiales_utilizados SET cantidad='" + ((MaterialTrabajos) albaran.getMaterialUtilizado() .get(Integer.parseInt(idStock[x]))).getCantidad() + "' WHERE id_Stock='" + idStock[x] + "' AND id_Albaran='" + idAlbaran + "'"); } } stDelStock.close(); } // Add els nous treballs Iterator itStock = albaran.getMaterialUtilizado().entrySet().iterator(); while (itStock.hasNext()) { Map.Entry auxStock = (Map.Entry) itStock.next(); if (idStock != null && stockExistentes != null) { for (int x = 0; x < idStock.length; x++) for (int y = 0; y < albaran.getMaterialUtilizado().size() && !stockExistentes[x]; y++) if (idStock[x].equals(albaran.getMaterialUtilizado().entrySet().toArray()[y] .toString().split("=")[0])) { resStock = stStock.executeQuery( "SELECT unidades FROM stock WHERE id_Stock=" + auxStock.getKey()); resStock.next(); aux_Cantidad = resStock.getFloat("unidades"); ((Stock) stock.get(Integer.parseInt(idStock[x]))).quitar(aux_Cantidad); stStock.executeUpdate("UPDATE stock SET unidades='" + (aux_Cantidad - ((MaterialTrabajos) auxStock.getValue()).getCantidad()) + "' WHERE id_Stock=" + auxStock.getKey()); } } else { resStock = stStock .executeQuery("SELECT unidades FROM stock WHERE id_Stock=" + auxStock.getKey()); resStock.next(); aux_Cantidad = resStock.getFloat("unidades"); ((Stock) stock.get(Integer.parseInt(auxStock.getKey().toString()))).quitar(aux_Cantidad); stStock.executeUpdate("UPDATE stock SET unidades='" + (aux_Cantidad - ((MaterialTrabajos) auxStock.getValue()).getCantidad()) + "' WHERE id_Stock=" + auxStock.getKey()); } stStock.executeUpdate("INSERT IGNORE INTO materiales_utilizados" + " (id_Albaran, id_Stock, cantidad) VALUES (" + " '" + idAlbaran + "','" + auxStock.getKey() + "'," + " '" + ((MaterialTrabajos) auxStock.getValue()).getCantidad() + "')"); } resStock.close(); return true; } else return false; } catch (SQLException ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); return false; } }
From source file:GestoSAT.GestoSAT.java
public int iniciarSesion(String correo, String pass) { File f = new File("confGestoSAT"); if (f.exists()) { try {/*from w ww .j a va 2 s. c o m*/ Class.forName("com.mysql.jdbc.Driver"); Statement st = con.createStatement(); ResultSet res = st.executeQuery( "Select * From usuarios u INNER JOIN entidades e ON u.id_Entidad = e.id_Entidad Where u.Correo_electronico ='" + correo + "' AND u.Activo = 1"); if (res.next()) { String p = (String) res.getObject("u.Password"); MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); sha256.update(pass.getBytes("UTF-8")); byte[] digest = sha256.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < digest.length; i++) { sb.append(String.format("%02x", digest[i])); } String password = sb.toString(); if (p.equals(password)) { if ((res.getString("u.Gerente")).equals("1")) empleado = new Gerente(res.getString("u.Nombre"), res.getString("u.Apellidos"), res.getString("u.DNI"), res.getString("u.Poblacion"), res.getString("u.Provincia"), res.getInt("u.CP"), res.getString("u.Calle"), res.getString("u.Numero"), res.getString("u.Escalera"), res.getInt("u.Piso"), res.getString("u.Puerta"), res.getInt("u.tlf_Fijo"), res.getInt("u.tlf_Movil"), res.getFloat("u.Sueldo_base"), res.getFloat("u.Precio_hora"), correo, res.getString("e.nombre"), res.getString("e.nif"), res.getString("e.provincia"), res.getString("e.poblacion"), res.getInt("e.CP"), res.getString("e.Calle"), res.getString("e.numero"), res.getString("e.correo_electronico"), res.getInt("e.tlf_fijo"), res.getInt("e.tlf_movil"), res.getInt("e.fax")); else empleado = new Empleado(res.getString("u.Nombre"), res.getString("u.Apellidos"), res.getString("u.DNI"), res.getString("u.Poblacion"), res.getString("u.Provincia"), res.getInt("u.CP"), res.getString("u.Calle"), res.getString("u.Numero"), res.getString("u.Escalera"), res.getInt("u.Piso"), res.getString("u.Puerta"), res.getInt("u.tlf_Fijo"), res.getInt("u.tlf_Movil"), res.getFloat("u.Sueldo_base"), res.getFloat("u.Precio_hora"), correo, res.getString("e.nombre"), res.getString("e.nif"), res.getString("e.provincia"), res.getString("e.poblacion"), res.getInt("e.CP"), res.getString("e.Calle"), res.getString("e.numero"), res.getString("e.correo_electronico"), res.getInt("e.tlf_fijo"), res.getInt("e.tlf_movil"), res.getInt("e.fax")); empleado.setGestoSAT(this); int devolver = res.getInt("u.id_Usuario"); res.close(); this.empleados.put(devolver, empleado); this.getEmpleados(devolver); return devolver; } else { res.close(); return 0; } } else return 0; } catch (SQLException ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); return 0; } catch (ClassNotFoundException ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); return 0; } catch (NoSuchAlgorithmException ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); return 0; } catch (UnsupportedEncodingException ex) { Logger.getLogger(GestoSAT.class.getName()).log(Level.SEVERE, null, ex); return 0; } } else { String defaultUser = "admin@default.es"; String defaultPass = "admin"; if (defaultUser.equals(correo) && defaultPass.equals(pass)) return 1; else return 0; } }
From source file:oscar.oscarRx.data.RxPrescriptionData.java
public Prescription[] getUniquePrescriptionsByPatient(int demographicNo) { Prescription[] arr = {};//from w w w. ja v a2s .c o m ArrayList lst = new ArrayList(); try { // Get Prescription from database ResultSet rs, rs2; String sql = "SELECT * FROM drugs d WHERE d.archived = 0 AND d.demographic_no = " + demographicNo + " ORDER BY position DESC,rx_date DESC, drugId DESC"; String indivoSql = "SELECT indivoDocIdx FROM indivoDocs i WHERE i.oscarDocNo = ? and docType = 'Rx' limit 1"; boolean myOscarEnabled = OscarProperties.getInstance().getProperty("MY_OSCAR", "").trim() .equalsIgnoreCase("YES"); Prescription p; logger.info(sql + " RETURNS"); rs = DBHandler.GetSQL(sql); while (rs.next()) { boolean b = true; for (int i = 0; i < lst.size(); i++) { Prescription p2 = (Prescription) lst.get(i); if (p2.getGCN_SEQNO() == rs.getInt("GCN_SEQNO")) { if (p2.getGCN_SEQNO() != 0) // not custom - safe GCN { b = false; } else // custom { if (p2.getCustomName() != null && oscar.Misc.getString(rs, "customName") != null) { if (p2.getCustomName().equals(oscar.Misc.getString(rs, "customName"))) // same custom { b = false; } } } } } if (b) { logger.info("ADDING PRESCRIPTION"); p = new Prescription(rs.getInt("drugid"), oscar.Misc.getString(rs, "provider_no"), demographicNo); p.setRxCreatedDate(rs.getDate("create_date")); p.setRxDate(rs.getDate("rx_date")); p.setEndDate(rs.getDate("end_date")); p.setWrittenDate(rs.getDate("written_date")); p.setBrandName(oscar.Misc.getString(rs, "BN")); p.setGCN_SEQNO(rs.getInt("GCN_SEQNO")); p.setCustomName(oscar.Misc.getString(rs, "customName")); p.setTakeMin(rs.getFloat("takemin")); p.setTakeMax(rs.getFloat("takemax")); p.setFrequencyCode(oscar.Misc.getString(rs, "freqcode")); p.setDuration(oscar.Misc.getString(rs, "duration")); p.setDurationUnit(oscar.Misc.getString(rs, "durunit")); p.setQuantity(oscar.Misc.getString(rs, "quantity")); p.setRepeat(rs.getInt("repeat")); p.setLastRefillDate(rs.getDate("last_refill_date")); p.setNosubs(rs.getInt("nosubs")); p.setPrn(rs.getInt("prn")); p.setSpecial(oscar.Misc.getString(rs, "special")); p.setGenericName(oscar.Misc.getString(rs, "GN")); p.setAtcCode(oscar.Misc.getString(rs, "ATC")); p.setScript_no(oscar.Misc.getString(rs, "script_no")); p.setRegionalIdentifier(oscar.Misc.getString(rs, "regional_identifier")); p.setUnit(oscar.Misc.getString(rs, "unit")); p.setUnitName(oscar.Misc.getString(rs, "unitName")); p.setMethod(oscar.Misc.getString(rs, "method")); p.setRoute(oscar.Misc.getString(rs, "route")); p.setDrugForm(oscar.Misc.getString(rs, "drug_form")); p.setCustomInstr(rs.getBoolean("custom_instructions")); p.setDosage(oscar.Misc.getString(rs, "dosage")); p.setLongTerm(rs.getBoolean("long_term")); p.setCustomNote(rs.getBoolean("custom_note")); p.setPastMed(rs.getBoolean("past_med")); p.setStartDateUnknown(rs.getBoolean("start_date_unknown")); p.setComment(rs.getString("comment")); if (rs.getObject("patient_compliance") == null) p.setPatientCompliance(null); else p.setPatientCompliance(rs.getBoolean("patient_compliance")); p.setOutsideProviderName(oscar.Misc.getString(rs, "outside_provider_name")); p.setOutsideProviderOhip(oscar.Misc.getString(rs, "outside_provider_ohip")); p.setHideCpp(rs.getBoolean("hide_cpp")); p.setPickupDate(rs.getDate("pickup_datetime")); p.setPickupTime(rs.getDate("pickup_datetime")); p.setETreatmentType(rs.getString("eTreatmentType")); p.setRxStatus(rs.getString("rxStatus")); if (rs.getObject("dispense_interval") != null) p.setDispenseInterval(rs.getInt("dispense_interval")); if (rs.getObject("refill_duration") != null) p.setRefillDuration(rs.getInt("refill_duration")); if (rs.getObject("refill_quantity") != null) p.setRefillQuantity(rs.getInt("refill_quantity")); if (myOscarEnabled) { String tmp = indivoSql.replaceFirst("\\?", oscar.Misc.getString(rs, "drugid")); rs2 = DBHandler.GetSQL(tmp); if (rs2.next()) { p.setIndivoIdx(rs2.getString("indivoDocIdx")); if (p.getIndivoIdx() != null && p.getIndivoIdx().length() > 0) p.setRegisterIndivo(); } rs2.close(); } p.setPosition(rs.getInt("position")); lst.add(p); } } rs.close(); arr = (Prescription[]) lst.toArray(arr); } catch (SQLException e) { logger.error("unexpected error", e); } finally { DbConnectionFilter.releaseThreadLocalDbConnection(); } return arr; }
From source file:org.apache.openjpa.jdbc.sql.DBDictionary.java
/** * Convert the specified column of the SQL ResultSet to the proper * java type./*from ww w.j a v a 2 s . c om*/ */ public float getFloat(ResultSet rs, int column) throws SQLException { return rs.getFloat(column); }
From source file:info.raack.appliancedetection.evaluation.data.JDBCDatabase.java
public Simulation getSimulation(String simulationId, final Date start, final Date end, final boolean includeRawPowerMeasurements) { // save simulation return jdbcTemplate.queryForObject(queryForSimulationById, new Object[] { simulationId }, new RowMapper<Simulation>() { public Simulation mapRow(ResultSet rs, int arg1) throws SQLException { final String simulationId = rs.getString("id"); Date startTime = new Date(rs.getLong("start_time")); int resultDuration = rs.getInt("duration"); int numAppliances = rs.getInt("num_appliances"); int onConcurrency = rs.getInt("on_concurrency"); int labelsPerAppliance = rs.getInt("labels_per_appliance"); Calendar time = new GregorianCalendar(); time.setTime(startTime); time.add(Calendar.SECOND, resultDuration); Date endTime = time.getTime(); EnergyMonitor monitor = getSimulatedEnergyMonitor(simulationId); final Date queryStartDate = start == null ? startTime : start; final Date queryEndDate = end == null ? endTime : end; int duration = (int) ((queryEndDate.getTime() - queryStartDate.getTime()) / 1000); List<SecondData> simulatedPowerDraw = new ArrayList<SecondData>(); if (includeRawPowerMeasurements) { simulatedPowerDraw = engineDatabase.getEnergyMeasurementsForMonitor(monitor, queryStartDate, queryEndDate, 200); }/* w w w . j a va2 s .co m*/ // create empty list of simulated appliances first, so that the simulation is already constructed when it is needed by the appliance constructor List<SimulatedAppliance> appliances = new ArrayList<SimulatedAppliance>(); final Simulation simulation = new Simulation(simulationId, queryStartDate, duration, numAppliances, onConcurrency, labelsPerAppliance, appliances, simulatedPowerDraw); List<SimulatedAppliance> newAppliances = jdbcTemplate.query( queryForSimulatedAppliancesBySimulationId, new Object[] { simulationId }, new RowMapper<SimulatedAppliance>() { public SimulatedAppliance mapRow(ResultSet rs, int arg1) throws SQLException { final int simulatedApplianceId = rs.getInt("id"); int applianceNum = rs.getInt("appliance_num"); String className = rs.getString("class"); try { // create the specific class called for Class<? extends SimulatedAppliance> clazz = (Class<? extends SimulatedAppliance>) Class .forName(className); final SimulatedAppliance simulatedAppliance = clazz.newInstance() .initialize(simulation, applianceNum, true); int labeledApplianceId = rs.getInt("labeled_appliance_id"); if (labeledApplianceId > 0) { UserAppliance labeledAppliance = engineDatabase .getUserApplianceById(labeledApplianceId); simulatedAppliance.setLabeledAppliance(labeledAppliance); } // get energy timesteps List<EnergyTimestep> energyTimesteps = jdbcTemplate.query( queryForSimulatedEnergyTimestepsBySimulatedApplianceIdAndDates, new Object[] { simulatedApplianceId, queryStartDate.getTime(), queryEndDate.getTime() }, new RowMapper<EnergyTimestep>() { public EnergyTimestep mapRow(ResultSet rs, int arg1) throws SQLException { EnergyTimestep energyTimestep = new EnergyTimestep(); energyTimestep.setStartTime( new Date(rs.getLong("start_time"))); energyTimestep .setEndTime(new Date(rs.getLong("end_time"))); energyTimestep.setEnergyConsumed( rs.getFloat("energy_consumed")); return energyTimestep; } }); simulatedAppliance.setEnergyTimesteps(energyTimesteps); // get state transitions List<ApplianceStateTransition> stateTransitions = jdbcTemplate.query( queryForSimulatedStateTransitionsBySimulatedApplianceIdAndDates, new Object[] { simulatedApplianceId, queryStartDate.getTime(), queryEndDate.getTime() }, new RowMapper<ApplianceStateTransition>() { public ApplianceStateTransition mapRow(ResultSet rs, int arg1) throws SQLException { SimulatedStateTransition transition = new SimulatedStateTransition( rs.getInt("id"), simulatedAppliance, 0, rs.getBoolean("start_on"), rs.getLong("time")); return transition; } }); simulatedAppliance.setAllStateTransitions(stateTransitions); return simulatedAppliance; } catch (Exception e) { throw new RuntimeException("Could not create simulated appliance class", e); } } }); // now add the actual appliances to the correct appliances list appliances.addAll(newAppliances); return simulation; } }); }
From source file:talonetl.loadpropertyimages_0_2.loadPropertyImages.java
public void tMysqlInput_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tMysqlInput_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {/*from ww w. j a va 2 s. c o m*/ String currentMethodName = new Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; row2Struct row2 = new row2Struct(); /** * [tAdvancedHash_row2 begin ] start */ ok_Hash.put("tAdvancedHash_row2", false); start_Hash.put("tAdvancedHash_row2", System.currentTimeMillis()); currentComponent = "tAdvancedHash_row2"; int tos_count_tAdvancedHash_row2 = 0; // connection name:row2 // source node:tMysqlInput_2 - inputs:(after_tFileInputXML_1) // outputs:(row2,row2) | target node:tAdvancedHash_row2 - // inputs:(row2) outputs:() // linked node: tMap_2 - inputs:(row5,row2) outputs:(loadData) org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_row2 = org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.UNIQUE_MATCH; org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<row2Struct> tHash_Lookup_row2 = org.talend.designer.components.lookup.memory.AdvancedMemoryLookup .<row2Struct>getLookup(matchingModeEnum_row2); globalMap.put("tHash_Lookup_row2", tHash_Lookup_row2); /** * [tAdvancedHash_row2 begin ] stop */ /** * [tMysqlInput_2 begin ] start */ ok_Hash.put("tMysqlInput_2", false); start_Hash.put("tMysqlInput_2", System.currentTimeMillis()); currentComponent = "tMysqlInput_2"; int tos_count_tMysqlInput_2 = 0; java.util.Calendar calendar_tMysqlInput_2 = java.util.Calendar.getInstance(); calendar_tMysqlInput_2.set(0, 0, 0, 0, 0, 0); java.util.Date year0_tMysqlInput_2 = calendar_tMysqlInput_2.getTime(); int nb_line_tMysqlInput_2 = 0; java.sql.Connection conn_tMysqlInput_2 = null; java.util.Map<String, routines.system.TalendDataSource> dataSources_tMysqlInput_2 = (java.util.Map<String, routines.system.TalendDataSource>) globalMap .get(KEY_DB_DATASOURCES); if (null != dataSources_tMysqlInput_2) { conn_tMysqlInput_2 = dataSources_tMysqlInput_2.get("").getConnection(); } else { java.lang.Class.forName("org.gjt.mm.mysql.Driver"); String url_tMysqlInput_2 = "jdbc:mysql://" + context.talon_Server + ":" + context.talon_Port + "/" + context.talon_Database + "?" + context.talon_AdditionalParams; String dbUser_tMysqlInput_2 = context.talon_Login; String dbPwd_tMysqlInput_2 = context.talon_Password; conn_tMysqlInput_2 = java.sql.DriverManager.getConnection(url_tMysqlInput_2, dbUser_tMysqlInput_2, dbPwd_tMysqlInput_2); } java.sql.Statement stmt_tMysqlInput_2 = conn_tMysqlInput_2.createStatement(); String dbquery_tMysqlInput_2 = "SELECT `PROPERTY_DATA`.`ID`, `PROPERTY_DATA`.`UUID`, `PROPERTY_DATA`.`PROP_NAME`, `PROPERTY_DATA`.`PRICE`, `PROPERTY_DATA`.`SQFT`, `PROPERTY_DATA`.`DESCRIPTION`, `PROPERTY_DATA`.`NUM_BEDS`, `PROPERTY_DATA`.`NUM_BATHS`, `PROPERTY_DATA`.`TYPE`, `PROPERTY_DATA`.`STATUS`, `PROPERTY_DATA`.`ZIP_CODE`, `PROPERTY_DATA`.`DATA_SOURCE_ID` FROM `PROPERTY_DATA`"; globalMap.put("tMysqlInput_2_QUERY", dbquery_tMysqlInput_2); java.sql.ResultSet rs_tMysqlInput_2 = stmt_tMysqlInput_2.executeQuery(dbquery_tMysqlInput_2); java.sql.ResultSetMetaData rsmd_tMysqlInput_2 = rs_tMysqlInput_2.getMetaData(); int colQtyInRs_tMysqlInput_2 = rsmd_tMysqlInput_2.getColumnCount(); String tmpContent_tMysqlInput_2 = null; while (rs_tMysqlInput_2.next()) { nb_line_tMysqlInput_2++; if (colQtyInRs_tMysqlInput_2 < 1) { row2.ID = 0; } else { if (rs_tMysqlInput_2.getObject(1) != null) { row2.ID = rs_tMysqlInput_2.getInt(1); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_2 < 2) { row2.UUID = null; } else { tmpContent_tMysqlInput_2 = rs_tMysqlInput_2.getString(2); if (tmpContent_tMysqlInput_2 != null) { row2.UUID = tmpContent_tMysqlInput_2; } else { row2.UUID = null; } } if (colQtyInRs_tMysqlInput_2 < 3) { row2.PROP_NAME = null; } else { tmpContent_tMysqlInput_2 = rs_tMysqlInput_2.getString(3); if (tmpContent_tMysqlInput_2 != null) { row2.PROP_NAME = tmpContent_tMysqlInput_2; } else { row2.PROP_NAME = null; } } if (colQtyInRs_tMysqlInput_2 < 4) { row2.PRICE = 0; } else { if (rs_tMysqlInput_2.getObject(4) != null) { row2.PRICE = rs_tMysqlInput_2.getFloat(4); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_2 < 5) { row2.SQFT = 0; } else { if (rs_tMysqlInput_2.getObject(5) != null) { row2.SQFT = rs_tMysqlInput_2.getFloat(5); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_2 < 6) { row2.DESCRIPTION = null; } else { tmpContent_tMysqlInput_2 = rs_tMysqlInput_2.getString(6); if (tmpContent_tMysqlInput_2 != null) { row2.DESCRIPTION = tmpContent_tMysqlInput_2; } else { row2.DESCRIPTION = null; } } if (colQtyInRs_tMysqlInput_2 < 7) { row2.NUM_BEDS = 0; } else { if (rs_tMysqlInput_2.getObject(7) != null) { row2.NUM_BEDS = rs_tMysqlInput_2.getFloat(7); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_2 < 8) { row2.NUM_BATHS = 0; } else { if (rs_tMysqlInput_2.getObject(8) != null) { row2.NUM_BATHS = rs_tMysqlInput_2.getFloat(8); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_2 < 9) { row2.TYPE = null; } else { tmpContent_tMysqlInput_2 = rs_tMysqlInput_2.getString(9); if (tmpContent_tMysqlInput_2 != null) { row2.TYPE = tmpContent_tMysqlInput_2; } else { row2.TYPE = null; } } if (colQtyInRs_tMysqlInput_2 < 10) { row2.STATUS = null; } else { tmpContent_tMysqlInput_2 = rs_tMysqlInput_2.getString(10); if (tmpContent_tMysqlInput_2 != null) { row2.STATUS = tmpContent_tMysqlInput_2; } else { row2.STATUS = null; } } if (colQtyInRs_tMysqlInput_2 < 11) { row2.DATA_SOURCE_ID = 0; } else { if (rs_tMysqlInput_2.getObject(11) != null) { row2.DATA_SOURCE_ID = rs_tMysqlInput_2.getInt(11); } else { throw new RuntimeException("Null value in non-Nullable column"); } } if (colQtyInRs_tMysqlInput_2 < 12) { row2.ZIP_CODE = 0; } else { if (rs_tMysqlInput_2.getObject(12) != null) { row2.ZIP_CODE = rs_tMysqlInput_2.getInt(12); } else { throw new RuntimeException("Null value in non-Nullable column"); } } /** * [tMysqlInput_2 begin ] stop */ /** * [tMysqlInput_2 main ] start */ currentComponent = "tMysqlInput_2"; tos_count_tMysqlInput_2++; /** * [tMysqlInput_2 main ] stop */ /** * [tAdvancedHash_row2 main ] start */ currentComponent = "tAdvancedHash_row2"; row2Struct row2_HashRow = new row2Struct(); row2_HashRow.ID = row2.ID; row2_HashRow.UUID = row2.UUID; row2_HashRow.PROP_NAME = row2.PROP_NAME; row2_HashRow.PRICE = row2.PRICE; row2_HashRow.SQFT = row2.SQFT; row2_HashRow.DESCRIPTION = row2.DESCRIPTION; row2_HashRow.NUM_BEDS = row2.NUM_BEDS; row2_HashRow.NUM_BATHS = row2.NUM_BATHS; row2_HashRow.TYPE = row2.TYPE; row2_HashRow.STATUS = row2.STATUS; row2_HashRow.DATA_SOURCE_ID = row2.DATA_SOURCE_ID; row2_HashRow.ZIP_CODE = row2.ZIP_CODE; tHash_Lookup_row2.put(row2_HashRow); tos_count_tAdvancedHash_row2++; /** * [tAdvancedHash_row2 main ] stop */ /** * [tMysqlInput_2 end ] start */ currentComponent = "tMysqlInput_2"; } rs_tMysqlInput_2.close(); stmt_tMysqlInput_2.close(); conn_tMysqlInput_2.close(); globalMap.put("tMysqlInput_2_NB_LINE", nb_line_tMysqlInput_2); ok_Hash.put("tMysqlInput_2", true); end_Hash.put("tMysqlInput_2", System.currentTimeMillis()); /** * [tMysqlInput_2 end ] stop */ /** * [tAdvancedHash_row2 end ] start */ currentComponent = "tAdvancedHash_row2"; tHash_Lookup_row2.endPut(); ok_Hash.put("tAdvancedHash_row2", true); end_Hash.put("tAdvancedHash_row2", System.currentTimeMillis()); /** * [tAdvancedHash_row2 end ] stop */ } // end the resume } catch (Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { throw new java.lang.Error(error); } globalMap.put("tMysqlInput_2_SUBPROCESS_STATE", 1); }