public List < RestletUtilUser > getUsers ( ) { List < RestletUtilUser > result = new ArrayList < RestletUtilUser > ( ) ; RepositoryConnection conn = null ; try { conn = this . repository . getConnection ( ) ; final String query = this . buildSparqlQueryToFindUser ( null , true ) ; this . log . debug ( "findUser: query={}" , query ) ; final TupleQuery tupleQuery = conn . prepareTupleQuery ( QueryLanguage . SPARQL , query ) ; final TupleQueryResult queryResult = tupleQuery . evaluate ( ) ; try { while ( queryResult . hasNext ( ) ) { final BindingSet bindingSet = queryResult . next ( ) ; Binding binding = bindingSet . getBinding ( "userIdentifier" ) ; result . add ( this . buildRestletUserFromSparqlResult ( binding . getValue ( ) . stringValue ( ) , bindingSet ) ) ; } } finally { queryResult . close ( ) ; } } catch ( final RepositoryException e ) { throw new RuntimeException ( "Failure finding user in repository" , e ) ; } catch ( final MalformedQueryException e ) { throw new RuntimeException ( "Failure finding user in repository" , e ) ; } catch ( final QueryEvaluationException e ) { throw new RuntimeException ( "Failure finding user in repository" , e ) ; } finally { try { conn . close ( ) ; } catch ( final RepositoryException e ) { this . log . error ( "Failure to close connection" , e ) ; } } return Collections . unmodifiableList ( result ) ; }
Returns an unmodifiable list of users .