List of usage examples for com.mongodb BasicDBObject getDate
public Date getDate(final String field)
From source file:spntoolsdata.map.Historial.java
public void makePojofromBson(DBObject bson) { BasicDBObject b = (BasicDBObject) bson; this.Usuario = (String) b.get("Usuario"); this.Fecha = (Date) b.getDate("Fecha"); this.EstadoOrden = (String) b.get("EstadoOrden"); }
From source file:Vistas.PanelFoto.java
@Override public void rellenarCampos(BasicDBObject obj, int posi, int l) { if (obj.getString("nombre") == null) { Nombre.setText("-"); } else {//from www .j av a 2s.c o m Nombre.setText(obj.getString("nombre")); } if (obj.getString("marca") == null) { Marca.setText("-"); } else { Marca.setText(obj.getString("marca")); } if (obj.getString("modelo") == null) { Modelo.setText("-"); } else { Modelo.setText(obj.getString("modelo")); } if (obj.getString("Flash") == null) { Flash.setText("-"); } else if (obj.getBoolean("Flash")) { Flash.setText("Si"); } else { Flash.setText("No"); } if (obj.getString("Photoshop") == null) { Photoshop.setText("-"); } else if (obj.getBoolean("Photoshop")) { Photoshop.setText("Si"); } else { Photoshop.setText("No"); } if (obj.getString("fecha") == null) { Fecha.setText("-"); } else { DateFormat dateFormatHora = new SimpleDateFormat("HH:mm"); DateFormat dateFormatFecha = new SimpleDateFormat("dd/MM/yyyy"); Date fechaTime = obj.getDate("fecha"); String fecha = dateFormatFecha.format(fechaTime); String hora = dateFormatHora.format(fechaTime); Fecha.setText(fecha + " - " + hora); } BufferedImage originalImage = null; if (obj.getString("ruta") == null) { Foto.setText("-"); } else { try { File f = new File(obj.getString("ruta") + "\\" + obj.getString("nombre")); if (f.isFile()) { originalImage = ImageIO.read(f); Image scaledImage = originalImage.getScaledInstance(250, 200, Image.SCALE_SMOOTH); ImageIcon icon = new ImageIcon(scaledImage); Foto.setIcon(icon); } else { Foto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagen/imageNotFound-2.jpg"))); } } catch (IOException ex) { Logger.getLogger(PanelFoto.class.getName()).log(Level.SEVERE, null, ex); } } pos.setText((posi + 1) + "/" + (l)); }