List of usage examples for com.mongodb BasicDBObject BasicDBObject
public BasicDBObject(final String key, final Object value)
From source file:bd.DArticulo.java
@Override public Object buscar_id(String id_find) { ArrayList datos = new ArrayList(); CArticulo x = new CArticulo(); conecion con = new conecion(table); System.out.println(id_find + "warrennnnn"); BasicDBObject id = new BasicDBObject("_id", new ObjectId(id_find)); DBCursor cursor = con.get_colletion().find(id); try {//w w w. jav a 2 s . com while (cursor.hasNext()) { x = new CArticulo(); x.set_datos((HashMap) cursor.next().toMap()); datos.add(x); } } finally { cursor.close(); } con.end(); if (datos.size() == 0) return null; return datos.get(0); }
From source file:bd.DArticulo.java
@Override public ArrayList listar(String clave, String valor) { ArrayList datos = new ArrayList(); CArticulo x = new CArticulo(); conecion con = new conecion(table); BasicDBObject id = new BasicDBObject(clave, valor); DBCursor cursor = con.get_colletion().find(id); try {//from ww w . j av a 2s. c o m while (cursor.hasNext()) { x = new CArticulo(); x.set_datos((HashMap) cursor.next().toMap()); datos.add(x); } } finally { cursor.close(); } con.end(); return datos; }
From source file:bd.DCategoria.java
@Override public String eliminar(Object o) { CCategoria x = (CCategoria) o;//w w w. j ava 2s . c o m conecion con = new conecion(table); BasicDBObject datos = new BasicDBObject("_id", x.getId()); con.get_colletion().remove(datos); con.end(); return datos.getString("_id"); }
From source file:bd.DCategoria.java
@Override public Object buscar_id(String id_find) { ArrayList datos = new ArrayList(); CCategoria x = new CCategoria(); conecion con = new conecion(table); BasicDBObject id = new BasicDBObject("_id", new ObjectId(id_find)); DBCursor cursor = con.get_colletion().find(id); try {//from w ww .ja v a 2 s . c o m while (cursor.hasNext()) { x = new CCategoria(); x.set_datos((HashMap) cursor.next().toMap()); datos.add(x); } } finally { cursor.close(); } con.end(); System.out.println(id_find + "lllll" + datos.size()); if (datos.size() == 0) return null; return datos.get(0); }
From source file:bd.DCategoria.java
@Override public ArrayList listar(String clave, String valor) { ArrayList datos = new ArrayList(); CCategoria x = new CCategoria(); conecion con = new conecion(table); BasicDBObject id = new BasicDBObject(clave, valor); DBCursor cursor = con.get_colletion().find(id); try {/*from www . j ava2s . c o m*/ while (cursor.hasNext()) { x = new CCategoria(); x.set_datos((HashMap) cursor.next().toMap()); datos.add(x); } } finally { cursor.close(); } con.end(); return datos; }
From source file:bd.DPersona.java
@Override public String eliminar(Object o) { CPersona x = (CPersona) o;// www . j ava 2s.co m conecion con = new conecion(table); BasicDBObject datos = new BasicDBObject("_id", x.getId()); con.get_colletion().remove(datos); con.end(); return datos.getString("_id"); }
From source file:bd.DPersona.java
@Override public Object buscar_id(String id_find) { ArrayList datos = new ArrayList(); CPersona x = new CPersona(); conecion con = new conecion(table); BasicDBObject id = new BasicDBObject("_id", new ObjectId(id_find)); DBCursor cursor = con.get_colletion().find(id); try {//from ww w .j a v a2 s . c o m while (cursor.hasNext()) { x = new CPersona(); x.set_datos((HashMap) cursor.next().toMap()); datos.add(x); } } finally { cursor.close(); } con.end(); if (datos.size() == 0) return null; return datos.get(0); }
From source file:bd.DPersona.java
@Override public ArrayList listar(String clave, String valor) { ArrayList datos = new ArrayList(); CPersona x = new CPersona(); conecion con = new conecion(table); BasicDBObject id = new BasicDBObject(clave, valor); DBCursor cursor = con.get_colletion().find(id); try {// w ww . j a v a2 s .c o m while (cursor.hasNext()) { x = new CPersona(); x.set_datos((HashMap) cursor.next().toMap()); datos.add(x); } } finally { cursor.close(); } con.end(); return datos; }
From source file:bd.DSession.java
@Override public String eliminar(Object o) { CSession x = (CSession) o;/*from w w w . ja va2 s .c om*/ conecion con = new conecion(table); BasicDBObject datos = new BasicDBObject("_id", x.getId()); con.get_colletion().remove(datos); con.end(); return datos.getString("_id"); }
From source file:bd.DSession.java
@Override public Object buscar_id(String id_find) { ArrayList datos = new ArrayList(); CSession x = new CSession(); conecion con = new conecion(table); System.out.println(id_find + "warrennnnn"); BasicDBObject id = new BasicDBObject("_id", new ObjectId(id_find)); DBCursor cursor = con.get_colletion().find(id); try {/*from w ww .ja va 2 s . com*/ while (cursor.hasNext()) { x = new CSession(); x.set_datos((HashMap) cursor.next().toMap()); datos.add(x); } } finally { cursor.close(); } con.end(); if (datos.size() == 0) return null; return datos.get(0); }