Examples of findOne()


Examples of ariba.ui.meta.persistence.ObjectContext.findOne()

    }

    public static Global find (String key)
    {
        ObjectContext context = ObjectContext.get();
        return context.findOne(Global.class, Collections.singletonMap("key", (Object)key));
    }

    public static Global create (String key)
    {
        ObjectContext context = ObjectContext.get();
View Full Code Here

Examples of ch.inftec.ju.testing.db.data.repo.TestingEntityRepo.findOne()

    if (rollback) throw new RuntimeException("Rollback");
  }
 
  private String getName(EntityManager em, Long testingEntityId) {
    TestingEntityRepo teRepo = new JuEmUtil(em).getJpaRepository(TestingEntityRepo.class);
    return teRepo.findOne(testingEntityId).getName();
  }
 
  private void setName(EntityManager em, Long testingEntityId, String name) {
    TestingEntityRepo teRepo = new JuEmUtil(em).getJpaRepository(TestingEntityRepo.class);
    teRepo.findOne(testingEntityId).setName(name);
View Full Code Here

Examples of com.github.jmkgreen.morphia.testdaos.HotelDAO.findOne()

        Hotel hotelLoaded = hotelDAO.get(borg.getId());
        assertEquals(borg.getName(), hotelLoaded.getName());
        assertEquals(borg.getAddress().getPostCode(), hotelLoaded.getAddress().getPostCode());

        Hotel hotelByValue = hotelDAO.findOne("name", "Hotel Borg");
        assertNotNull(hotelByValue);
        assertEquals(borg.getStartDate(), hotelByValue.getStartDate());

        assertTrue(hotelDAO.exists("stars", 4));
View Full Code Here

Examples of com.massivecraft.mcore.xlib.mongodb.DBCollection.findOne()

 
  @Override
  public Long getMtime(Coll<?> coll, String id)
  {
    DBCollection dbcoll = fixColl(coll);
    BasicDBObject found = (BasicDBObject)dbcoll.findOne(new BasicDBObject(ID_FIELD, id), dboKeysMtime);
    if (found == null) return null;
    if ( ! found.containsField(MTIME_FIELD)) return null; // This should not happen! But better to ignore than crash?
    return found.getLong(MTIME_FIELD);
  }
 
View Full Code Here

Examples of com.mongodb.DBCollection.findOne()

            return null;
        }
        logger.debug("Searching {} in {}", info[1], info[0]);
        final DBCollection col = this.getCollection(info[0]);
        if ( col != null ) {
            final DBObject obj = col.findOne(QueryBuilder.start(getPROP_PATH()).is(info[1]).get());
            logger.debug("Found {}", obj);
            if ( obj != null ) {
                return new MongoDBResource(resourceResolver,
                        path,
                        info[0],
View Full Code Here

Examples of com.mongodb.DBCollection.findOne()

     */
    public MockMongoClientBuilderContext insert(String collectionName, DBObject object) {
      DBCollection collection = mock( DBCollection.class );
      collections.put( collectionName, collection );

      when( collection.findOne( any( DBObject.class ), any( DBObject.class ), any( ReadPreference.class ) ) ).thenReturn( object );

      WriteResult writeResult = mock( WriteResult.class );
      when( collection.remove( any( DBObject.class ), any( WriteConcern.class ) ) ).thenReturn( writeResult );

      return this;
View Full Code Here

Examples of com.mongodb.DBCollection.findOne()

      DBCollection collection = getCollection( key.getEntityKey() );
      DBObject searchObject = prepareIdObject( key.getEntityKey() );
      DBObject projection = getProjection( key, true );

      return collection.findOne( searchObject, projection, readPreference );
    }
  }

  private DBObject getObject(EntityKey key, TupleContext tupleContext) {
    ReadPreference readPreference = getReadPreference( tupleContext );
View Full Code Here

Examples of com.mongodb.DBCollection.findOne()

    DBCollection collection = getCollection( key );
    DBObject searchObject = prepareIdObject( key );
    BasicDBObject projection = getProjection( tupleContext );

    return collection.findOne( searchObject, projection, readPreference );
  }

  private BasicDBObject getProjection(TupleContext tupleContext) {
    return getProjection( tupleContext.getSelectableColumns() );
  }
View Full Code Here

Examples of com.mongodb.DBCollection.findOne()

        DBCollection coll = getCollection();
       
        DBObject query = new BasicDBObject();
        query.put("key", key);
       
        DBObject result = coll.findOne(query);
        if (result == null) {
            return false;
        }
       
        if (result.get("value").equals(true)) {
View Full Code Here

Examples of com.mongodb.DBCollection.findOne()

    public BasicDBList getList(String key) {
        DBCollection coll = getCollection();
        DBObject query = new BasicDBObject();
        query.put("key", key);

        DBObject result = coll.findOne(query);

        return (BasicDBList) result.get("value");
    }

    private DBCollection getCollection() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.