@Test public void getAll() { LOG.info("\n===UserDaoTest.getAll===\n"); List<User> users = ESSuiteTest.userDao.getList(); for (User user : users) { LOG.info("User is: {}", user.toString()); } }
public List<User> getList() { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); ArrayList<User> users = new ArrayList<User>(); for ( SearchHit hit : response.getHits().hits() ) { if ( ShiroRealm.isAuthenticatedUserAdmin() ) { users.add( toUser( hit ) ); } else { users.add( get( ShiroRealm.getAuthenticatedUser() ) ); } } return users; }
UserDao extends Dao { public List<User> getList() { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); ArrayList<User> users = new ArrayList<User>(); for ( SearchHit hit : response.getHits().hits() ) { if ( ShiroRealm.isAuthenticatedUserAdmin() ) { users.add( toUser( hit ) ); } else { users.add( get( ShiroRealm.getAuthenticatedUser() ) ); } } return users; } }
UserDao extends Dao { public List<User> getList() { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); ArrayList<User> users = new ArrayList<User>(); for ( SearchHit hit : response.getHits().hits() ) { if ( ShiroRealm.isAuthenticatedUserAdmin() ) { users.add( toUser( hit ) ); } else { users.add( get( ShiroRealm.getAuthenticatedUser() ) ); } } return users; } @Inject  UserDao( IElasticSearchClient elasticSearchClient ); }
UserDao extends Dao { public List<User> getList() { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); ArrayList<User> users = new ArrayList<User>(); for ( SearchHit hit : response.getHits().hits() ) { if ( ShiroRealm.isAuthenticatedUserAdmin() ) { users.add( toUser( hit ) ); } else { users.add( get( ShiroRealm.getAuthenticatedUser() ) ); } } return users; } @Inject  UserDao( IElasticSearchClient elasticSearchClient ); boolean save( User user ); User get( String username ); List<User> getList(); boolean delete( String username ); }
UserDao extends Dao { public List<User> getList() { SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); ArrayList<User> users = new ArrayList<User>(); for ( SearchHit hit : response.getHits().hits() ) { if ( ShiroRealm.isAuthenticatedUserAdmin() ) { users.add( toUser( hit ) ); } else { users.add( get( ShiroRealm.getAuthenticatedUser() ) ); } } return users; } @Inject  UserDao( IElasticSearchClient elasticSearchClient ); boolean save( User user ); User get( String username ); List<User> getList(); boolean delete( String username ); static final String DAO_INDEX_KEY; static final String DAO_TYPE_KEY; }