@Test public void get() { LOG.info("\n===ModuleDaoTest.get===\n"); Module module = ESSuiteTest.moduleDao.get( ESSuiteTest.MODULE_ID_1 ); LOG.info( "Module by ID: {} is {}", ESSuiteTest.MODULE_ID_1, module.toString() ); assertEquals( ESSuiteTest.MODULE_GROUPID, module.getGroupId() ); }
public Module get( String id ) { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( termQuery( "_id", id ) ) .execute() .actionGet(); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toModule( hits[ 0 ] ) : null; }
ModuleDao extends Dao { public Module get( String id ) { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( termQuery( "_id", id ) ) .execute() .actionGet(); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toModule( hits[ 0 ] ) : null; } }
ModuleDao extends Dao { public Module get( String id ) { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( termQuery( "_id", id ) ) .execute() .actionGet(); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toModule( hits[ 0 ] ) : null; } @Inject  ModuleDao( IElasticSearchClient elasticSearchClient ); }
ModuleDao extends Dao { public Module get( String id ) { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( termQuery( "_id", id ) ) .execute() .actionGet(); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toModule( hits[ 0 ] ) : null; } @Inject  ModuleDao( IElasticSearchClient elasticSearchClient ); boolean save( Module module ); Module get( String id ); List<Module> getAll(); }
ModuleDao extends Dao { public Module get( String id ) { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( termQuery( "_id", id ) ) .execute() .actionGet(); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toModule( hits[ 0 ] ) : null; } @Inject  ModuleDao( IElasticSearchClient elasticSearchClient ); boolean save( Module module ); Module get( String id ); List<Module> getAll(); static final String DAO_INDEX_KEY; static final String DAO_TYPE_KEY; }