List of usage examples for com.mongodb DBCollection findOne
@Nullable public DBObject findOne(final Object id)
From source file:MDBInt.DBMongo.java
License:Apache License
/** * Method used for the retrieve Federated Tenant UUID from Borrower and cmp_endpoint. * @param tenant/*from w w w . j a va2 s . c om*/ * @param cmp_endpoint * @return tenantuuid */ public String getTenantuuidfromborrower(String tenant, String cmp_endpoint) { DB database = this.getDB(this.identityDB); DBCollection collection = database.getCollection("fedtenanttoBor"); BasicDBObject researchField = new BasicDBObject("fedUuid", tenant); researchField.append("cmp_endpoint", cmp_endpoint); DBObject risultato = collection.findOne(researchField); String tenantuuid = (String) risultato.get("fedUuid"); return tenantuuid; }
From source file:MDBInt.DBMongo.java
License:Apache License
/** * Returns generic federation infoes./* w w w. j a v a 2 s . co m*/ * @param dbName * @param value * @param type * @return */ public String getFederationCredential(String dbName, String value, String type) { DB dataBase = this.getDB(dbName); DBCollection collezione = this.getCollection(dataBase, "credentials"); DBObject federationUser = null; BasicDBObject query = new BasicDBObject(type, value); BasicDBList credList; Iterator it; BasicDBObject obj; String result = "{"; federationUser = collezione.findOne(query); if (federationUser == null) { return null; } BasicDBObject bo = new BasicDBObject(); bo.append("federationUser", (String) federationUser.get("federationUser")); bo.append("federationPassword", (String) federationUser.get("federationPassword")); return bo.toString();//result; }
From source file:MDBInt.DBMongo.java
License:Apache License
public DBObject find(String dbName, String collName, DBObject obj) { DB dataBase = this.getDB(dbName); DBCollection collezione = dataBase.getCollection(collName); // BasicDBObject obj = (BasicDBObject) JSON.parse(query); DBObject risultato = collezione.findOne(obj); return risultato; }
From source file:MDBInt.DBMongo.java
License:Apache License
public DBObject getDatacenterFromId(String dbName, String id) { DB dataBase = this.getDB(dbName); DBCollection collezione = dataBase.getCollection("datacenters"); BasicDBObject obj = new BasicDBObject("cloudId", id); DBObject risultato = collezione.findOne(obj); return risultato; }
From source file:MDBInt.DBMongo.java
License:Apache License
/** * Method used for the retrieve Database name for Federation Tenant. * @param field/*from w w w. j av a 2 s. c o m*/ * @param value * @return */ public String getTenantDBName(String field, String value) { DB database = this.getDB(this.identityDB); DBCollection collection = database.getCollection("Federation_Credential"); BasicDBObject researchField = new BasicDBObject(field, value); DBObject risultato = collection.findOne(researchField); String tenantDbName = (String) risultato.get("dbname"); return tenantDbName; }
From source file:MDBInt.DBMongo.java
License:Apache License
public String getTenantName(String field, String value) { DB database = this.getDB(this.identityDB); DBCollection collection = database.getCollection("Federation_Credential"); BasicDBObject researchField = new BasicDBObject(field, value); DBObject risultato = collection.findOne(researchField); String tenantName = (String) risultato.get("federationTenant"); return tenantName; }
From source file:MDBInt.DBMongo.java
License:Apache License
public String getTenantToken(String field, String value) { DB database = this.getDB(this.identityDB); DBCollection collection = database.getCollection("Federation_Credential"); BasicDBObject researchField = new BasicDBObject(field, value); DBObject risultato = collection.findOne(researchField); String tenantName = (String) risultato.get("token"); return tenantName; }
From source file:MDBInt.DBMongo.java
License:Apache License
public String getInfo_Endpoint(String field, String value) { DB database = this.getDB(this.identityDB); DBCollection collection = database.getCollection("SystemInfos"); BasicDBObject researchField = new BasicDBObject(field, value); DBObject risultato = collection.findOne(researchField); String valueSearched = (String) risultato.get("endpoint"); return valueSearched; }
From source file:MDBInt.DBMongo.java
License:Apache License
public String getfedsdnSite(String name) { DB database = this.getDB(this.identityDB); DBCollection collection = database.getCollection("fedsdnSite"); BasicDBObject researchField = new BasicDBObject("name", name); DBObject risultato = collection.findOne(researchField); return risultato.toString(); }
From source file:MDBInt.DBMongo.java
License:Apache License
public int getfedsdnSiteID(String name) { DB database = this.getDB(this.identityDB); DBCollection collection = database.getCollection("fedsdnSite"); BasicDBObject researchField = new BasicDBObject("name", name); DBObject risultato = collection.findOne(researchField); return ((Number) risultato.get("id")).intValue();//((Number) mapObj.get("autostart")).intValue()//(float) ((double) result.get(v)) }