public Response getEntityListByType ( String entityType ) { try { Preconditions . checkNotNull ( entityType , "Entity type cannot be null" ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Fetching entity list for type={} " , entityType ) ; } final List < String > entityList = metadataService . getEntityList ( entityType ) ; JSONObject response = new JSONObject ( ) ; response . put ( AtlasClient . REQUEST_ID , Servlets . getRequestId ( ) ) ; response . put ( AtlasClient . TYPENAME , entityType ) ; response . put ( AtlasClient . RESULTS , new JSONArray ( entityList ) ) ; response . put ( AtlasClient . COUNT , entityList . size ( ) ) ; return Response . ok ( response ) . build ( ) ; } catch ( NullPointerException e ) { LOG . error ( "Entity type cannot be null" , e ) ; throw new WebApplicationException ( Servlets . getErrorResponse ( e , Response . Status . BAD_REQUEST ) ) ; } catch ( AtlasException | IllegalArgumentException e ) { LOG . error ( "Unable to get entity list for type {}" , entityType , e ) ; throw new WebApplicationException ( Servlets . getErrorResponse ( e , Response . Status . BAD_REQUEST ) ) ; } catch ( WebApplicationException e ) { LOG . error ( "Unable to get entity list for type {}" , entityType , e ) ; throw e ; } catch ( Throwable e ) { LOG . error ( "Unable to get entity list for type {}" , entityType , e ) ; throw new WebApplicationException ( Servlets . getErrorResponse ( e , Response . Status . INTERNAL_SERVER_ERROR ) ) ; } }
Gets the list of entities for a given entity type .