本文整理匯總了Java中org.springframework.hateoas.Resource.getContent方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.getContent方法的具體用法?Java Resource.getContent怎麽用?Java Resource.getContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.hateoas.Resource
的用法示例。
在下文中一共展示了Resource.getContent方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: process
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
public Resource<SubmissionEnvelope> process(Resource<SubmissionEnvelope> resource) {
SubmissionEnvelope submissionEnvelope = resource.getContent();
// add subresource links for each type of metadata document in a submission envelope
resource.add(getAnalysesLink(submissionEnvelope));
resource.add(getAssaysLink(submissionEnvelope));
resource.add(getFilesLink(submissionEnvelope));
resource.add(getProjectsLink(submissionEnvelope));
resource.add(getProtocolsLink(submissionEnvelope));
resource.add(getSamplesLink(submissionEnvelope));
// add subresource links for events that occur in response to state transitions
submissionEnvelope.allowedStateTransitions().stream()
.map(submissionState -> getStateTransitionLink(submissionEnvelope, submissionState))
.filter(Optional::isPresent)
.map(Optional::get)
.forEach(resource::add);
return resource;
}
示例2: process
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@Override
public Resource<LineItem> process(Resource<LineItem> resource) {
LineItem content = resource.getContent();
Optional.ofNullable(productResource.getLink())//
.map(it -> it.expand(content.getProductNumber().getValue())) //
.map(it -> it.withRel("product")) //
.ifPresent(it -> resource.add(it));
return resource;
}
示例3: initProductInfo
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
private void initProductInfo(Resource<ProductAdded> resource) {
ProductId productId = ProductId.of(resource.getLink("product").getHref());
ProductAdded event = resource.getContent();
Product product = event.getProduct();
log.info("Creating inventory item for product {}.", product.getDescription());
productInfos.findByProductId(productId) //
.orElseGet(() -> productInfos.save(ProductInfo.of(productId, product.getDescription(), product.getPrice())));
}
示例4: findOne
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@GetMapping(value = "/supervisors/{id}", produces = MediaTypes.HAL_JSON_VALUE)
public ResponseEntity<Resource<Supervisor>> findOne(@PathVariable Long id) {
Resource<Manager> managerResource = controller.findOne(id).getBody();
Resource<Supervisor> supervisorResource = new Resource<>(
new Supervisor(managerResource.getContent()),
managerResource.getLinks());
return ResponseEntity.ok(supervisorResource);
}
示例5: process
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@Override public Resource<MetadataDocument> process(Resource<MetadataDocument> resource) {
MetadataDocument metadataDocument = resource.getContent();
metadataDocument.allowedStateTransitions().stream()
.map(validationState -> getStateTransitionLink(metadataDocument, validationState))
.filter(Optional::isPresent)
.map(Optional::get)
.forEach(resource::add);
return resource;
}
示例6: process
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
public Resource<Assay> process(Resource<Assay> assayResource) {
Assay assay = assayResource.getContent();
assayResource.add(getFileReferenceLink(assay));
return assayResource;
}
示例7: process
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
public Resource<Analysis> process(Resource<Analysis> analysisResource) {
Analysis analysis = analysisResource.getContent();
analysisResource.add(getBundleReferencesLink(analysis), getFileReferenceLink(analysis));
return analysisResource;
}
示例8: process
import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@Override
public Resource<ProductAdded> process(Resource<ProductAdded> resource) {
ProductAdded content = resource.getContent();
resource.add(entityLinks.linkToSingleResource(Product.class, content.getProduct().getId()));
return resource;
}