public List < RESTLayer > getAllImportedLayers ( Integer importJobId , List < RESTImportTask > tasks ) throws Exception { ArrayList < RESTLayer > layers = new ArrayList < RESTLayer > ( ) ; for ( RESTImportTask task : tasks ) { RESTImportTask refreshedTask = this . getRESTImportTask ( importJobId , task . getId ( ) ) ; if ( refreshedTask . getState ( ) . equalsIgnoreCase ( "COMPLETE" ) ) { Response httpResponse = HttpUtil . get ( this . addEndPoint ( importJobId + "/tasks/" + task . getId ( ) + "/layer" ) , this . username , this . password ) ; RESTLayer layer = ( RESTLayer ) this . asEntity ( httpResponse . getBody ( ) , RESTLayer . class ) ; if ( layer != null ) { layers . add ( layer ) ; } } else if ( ( tasks . size ( ) == 1 ) && refreshedTask . getState ( ) . equalsIgnoreCase ( "ERROR" ) ) { throw new GeoServerRESTImporterException ( refreshedTask . getErrorMessage ( ) ) ; } } return layers ; }
fetch all created Layers of import job