use of ca.corefacility.bioinformatics.irida.model.remote.resource.ResourceWrapper in project irida by phac-nml.
the class RemoteRepositoryImpl method read.
/**
* {@inheritDoc}
*/
@Override
public Type read(String uri, RemoteAPI remoteAPI) {
OAuthTokenRestTemplate restTemplate = new OAuthTokenRestTemplate(tokenService, remoteAPI);
ResponseEntity<ResourceWrapper<Type>> exchange = restTemplate.exchange(uri, HttpMethod.GET, HttpEntity.EMPTY, objectTypeReference);
Type resource = exchange.getBody().getResource();
resource = setRemoteStatus(resource, remoteAPI);
return resource;
}
use of ca.corefacility.bioinformatics.irida.model.remote.resource.ResourceWrapper in project irida by phac-nml.
the class SampleRemoteRepositoryImpl method getSampleMetadata.
/**
* {@inheritDoc}
*/
public Map<String, MetadataEntry> getSampleMetadata(Sample sample) {
logger.trace("Requesting sample metadata for sample " + sample.getSelfHref());
RemoteAPI remoteAPI = sample.getRemoteStatus().getApi();
OAuthTokenRestTemplate restTemplate = new OAuthTokenRestTemplate(tokenService, remoteAPI);
// get the metadata link
Link metadataLink = sample.getLink(METADATA_REL);
// request metadata response
ResponseEntity<ResourceWrapper<SampleMetadataWrapper>> exchange = restTemplate.exchange(metadataLink.getHref(), HttpMethod.GET, HttpEntity.EMPTY, metadataTypeReference);
// pull metadata response from request
Map<String, MetadataEntry> resource = exchange.getBody().getResource().getMetadata();
return resource;
}
Aggregations