@Test public void findResourceEntryByIdForUser() { ResourceEntry validResourceEntry = resourceEntryDao.findById("first", "user1"); assertNotNull("The returned entry should not be null with valid query values", validResourceEntry); ResourceEntry invalidTopology = resourceEntryDao.findById("second", "user1"); assertNull("The returned entry should be null with invalid query values", invalidTopology); }
@Override public ResourceEntry findById(String id, String userId) { return query().field("_id").equal(id).field("userId").equal(userId).get(); }
MongoResourceEntryDao extends MongoDao<ResourceEntry, String> implements ResourceEntryDao { @Override public ResourceEntry findById(String id, String userId) { return query().field("_id").equal(id).field("userId").equal(userId).get(); } }
MongoResourceEntryDao extends MongoDao<ResourceEntry, String> implements ResourceEntryDao { @Override public ResourceEntry findById(String id, String userId) { return query().field("_id").equal(id).field("userId").equal(userId).get(); } @Inject  MongoResourceEntryDao(Datastore datastore); }
MongoResourceEntryDao extends MongoDao<ResourceEntry, String> implements ResourceEntryDao { @Override public ResourceEntry findById(String id, String userId) { return query().field("_id").equal(id).field("userId").equal(userId).get(); } @Inject  MongoResourceEntryDao(Datastore datastore); @Override ResourceEntry save(ResourceEntry resourceEntry, String userId); @Override ResourceEntry update(ResourceEntry resourceEntry, String userId); @Override boolean exists(String id, String userId); @Override List<ResourceEntry> findAllWithResource(String resource, String userId); @Override ResourceEntry findById(String id, String userId); @Override ResourceEntry findByResourceAndName(String resource, String resourceEntryName, String userId); @Override void delete(ResourceEntry resourceEntry, String userId); @Override void deleteById(String id, String userId); }
MongoResourceEntryDao extends MongoDao<ResourceEntry, String> implements ResourceEntryDao { @Override public ResourceEntry findById(String id, String userId) { return query().field("_id").equal(id).field("userId").equal(userId).get(); } @Inject  MongoResourceEntryDao(Datastore datastore); @Override ResourceEntry save(ResourceEntry resourceEntry, String userId); @Override ResourceEntry update(ResourceEntry resourceEntry, String userId); @Override boolean exists(String id, String userId); @Override List<ResourceEntry> findAllWithResource(String resource, String userId); @Override ResourceEntry findById(String id, String userId); @Override ResourceEntry findByResourceAndName(String resource, String resourceEntryName, String userId); @Override void delete(ResourceEntry resourceEntry, String userId); @Override void deleteById(String id, String userId);  }