protected String buildSparqlQueryToFindUser ( final String userIdentifier , boolean findAllUsers ) { if ( ! findAllUsers && userIdentifier == null ) { throw new NullPointerException ( "User identifier was null" ) ; } final StringBuilder query = new StringBuilder ( ) ; query . append ( " SELECT ?userIdentifier ?userUri ?userSecret ?userFirstName ?userLastName ?userEmail " ) ; query . append ( " WHERE " ) ; query . append ( " { " ) ; query . append ( " ?userUri a " ) ; query . append ( RenderUtils . getSPARQLQueryString ( SesameRealmConstants . OAS_USER ) ) ; query . append ( " . " ) ; query . append ( " ?userUri " ) ; query . append ( RenderUtils . getSPARQLQueryString ( SesameRealmConstants . OAS_USERIDENTIFIER ) ) ; query . append ( " ?userIdentifier . " ) ; query . append ( " OPTIONAL{ ?userUri " ) ; query . append ( RenderUtils . getSPARQLQueryString ( SesameRealmConstants . OAS_USERSECRET ) ) ; query . append ( " ?userSecret . } " ) ; query . append ( " OPTIONAL{ ?userUri " ) ; query . append ( RenderUtils . getSPARQLQueryString ( SesameRealmConstants . OAS_USERFIRSTNAME ) ) ; query . append ( " ?userFirstName . } " ) ; query . append ( " OPTIONAL{ ?userUri " ) ; query . append ( RenderUtils . getSPARQLQueryString ( SesameRealmConstants . OAS_USERLASTNAME ) ) ; query . append ( " ?userLastName . } " ) ; query . append ( " OPTIONAL{ ?userUri " ) ; query . append ( RenderUtils . getSPARQLQueryString ( SesameRealmConstants . OAS_USEREMAIL ) ) ; query . append ( " ?userEmail . } " ) ; if ( ! findAllUsers ) { query . append ( " FILTER(str(?userIdentifier) = \"" + RenderUtils . escape ( userIdentifier ) + "\") " ) ; } query . append ( " } " ) ; return query . toString ( ) ; }
Builds a SPARQL query to retrieve details of a RestletUtilUser . This method could be overridden to search for other information regarding a user .