public Resource getZanataResource ( final String id ) throws NotModifiedException { ClientResponse < Resource > response = null ; try { final ISourceDocResource client = proxyFactory . getSourceDocResource ( details . getProject ( ) , details . getVersion ( ) ) ; response = client . getResource ( id , null ) ; final Status status = Response . Status . fromStatusCode ( response . getStatus ( ) ) ; if ( status == Response . Status . OK ) { final Resource entity = response . getEntity ( ) ; return entity ; } else if ( status == Status . NOT_MODIFIED ) { throw new NotModifiedException ( ) ; } } catch ( final Exception ex ) { if ( ex instanceof NotModifiedException ) { throw ( NotModifiedException ) ex ; } else { log . error ( "Failed to retrieve the Zanata Source Document" , ex ) ; } } finally { /* * If you are using RESTEasy client framework, and returning a Response from your service method, you will * explicitly need to release the connection. */ if ( response != null ) response . releaseConnection ( ) ; /* Perform a small wait to ensure zanata isn't overloaded */ performZanataRESTCallWaiting ( ) ; } return null ; }
Get a specific Source Document from Zanata .